@azure/arm-advisor 3.0.4-alpha.20221026.1 → 3.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.
- package/CHANGELOG.md +9 -11
- package/dist/index.js +205 -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/advisorManagementClient.d.ts +2 -0
- package/dist-esm/src/advisorManagementClient.d.ts.map +1 -1
- package/dist-esm/src/advisorManagementClient.js +54 -6
- package/dist-esm/src/advisorManagementClient.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 +25 -6
- package/dist-esm/src/models/index.d.ts.map +1 -1
- package/dist-esm/src/models/index.js +19 -0
- package/dist-esm/src/models/index.js.map +1 -1
- package/dist-esm/src/operations/configurations.d.ts.map +1 -1
- package/dist-esm/src/operations/configurations.js +27 -11
- package/dist-esm/src/operations/configurations.js.map +1 -1
- package/dist-esm/src/operations/operations.d.ts.map +1 -1
- package/dist-esm/src/operations/operations.js +19 -7
- package/dist-esm/src/operations/operations.js.map +1 -1
- package/dist-esm/src/operations/recommendationMetadata.d.ts.map +1 -1
- package/dist-esm/src/operations/recommendationMetadata.js +19 -7
- package/dist-esm/src/operations/recommendationMetadata.js.map +1 -1
- package/dist-esm/src/operations/recommendations.d.ts.map +1 -1
- package/dist-esm/src/operations/recommendations.js +19 -7
- package/dist-esm/src/operations/recommendations.js.map +1 -1
- package/dist-esm/src/operations/suppressions.d.ts.map +1 -1
- package/dist-esm/src/operations/suppressions.js +19 -7
- package/dist-esm/src/operations/suppressions.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 +14 -10
- package/review/arm-advisor.api.md +28 -44
- package/src/advisorManagementClient.ts +69 -6
- package/src/index.ts +1 -0
- package/src/models/index.ts +25 -6
- package/src/operations/configurations.ts +36 -14
- package/src/operations/operations.ts +21 -8
- package/src/operations/recommendationMetadata.ts +22 -9
- package/src/operations/recommendations.ts +22 -9
- package/src/operations/suppressions.ts +22 -9
- package/src/pagingHelper.ts +39 -0
- package/types/arm-advisor.d.ts +36 -6
- 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 { Recommendations } from "../operationsInterfaces";
|
|
11
12
|
import * as coreClient from "@azure/core-client";
|
|
12
13
|
import * as Mappers from "../models/mappers";
|
|
@@ -16,10 +17,10 @@ import {
|
|
|
16
17
|
ResourceRecommendationBase,
|
|
17
18
|
RecommendationsListNextOptionalParams,
|
|
18
19
|
RecommendationsListOptionalParams,
|
|
20
|
+
RecommendationsListResponse,
|
|
19
21
|
RecommendationsGenerateOptionalParams,
|
|
20
22
|
RecommendationsGenerateResponse,
|
|
21
23
|
RecommendationsGetGenerateStatusOptionalParams,
|
|
22
|
-
RecommendationsListResponse,
|
|
23
24
|
RecommendationsGetOptionalParams,
|
|
24
25
|
RecommendationsGetResponse,
|
|
25
26
|
RecommendationsListNextResponse
|
|
@@ -54,22 +55,34 @@ export class RecommendationsImpl implements Recommendations {
|
|
|
54
55
|
[Symbol.asyncIterator]() {
|
|
55
56
|
return this;
|
|
56
57
|
},
|
|
57
|
-
byPage: () => {
|
|
58
|
-
|
|
58
|
+
byPage: (settings?: PageSettings) => {
|
|
59
|
+
if (settings?.maxPageSize) {
|
|
60
|
+
throw new Error("maxPageSize is not supported by this operation.");
|
|
61
|
+
}
|
|
62
|
+
return this.listPagingPage(options, settings);
|
|
59
63
|
}
|
|
60
64
|
};
|
|
61
65
|
}
|
|
62
66
|
|
|
63
67
|
private async *listPagingPage(
|
|
64
|
-
options?: RecommendationsListOptionalParams
|
|
68
|
+
options?: RecommendationsListOptionalParams,
|
|
69
|
+
settings?: PageSettings
|
|
65
70
|
): AsyncIterableIterator<ResourceRecommendationBase[]> {
|
|
66
|
-
let result
|
|
67
|
-
|
|
68
|
-
|
|
71
|
+
let result: RecommendationsListResponse;
|
|
72
|
+
let continuationToken = settings?.continuationToken;
|
|
73
|
+
if (!continuationToken) {
|
|
74
|
+
result = await this._list(options);
|
|
75
|
+
let page = result.value || [];
|
|
76
|
+
continuationToken = result.nextLink;
|
|
77
|
+
setContinuationToken(page, continuationToken);
|
|
78
|
+
yield page;
|
|
79
|
+
}
|
|
69
80
|
while (continuationToken) {
|
|
70
81
|
result = await this._listNext(continuationToken, options);
|
|
71
82
|
continuationToken = result.nextLink;
|
|
72
|
-
|
|
83
|
+
let page = result.value || [];
|
|
84
|
+
setContinuationToken(page, continuationToken);
|
|
85
|
+
yield page;
|
|
73
86
|
}
|
|
74
87
|
}
|
|
75
88
|
|
|
@@ -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 { Suppressions } from "../operationsInterfaces";
|
|
11
12
|
import * as coreClient from "@azure/core-client";
|
|
12
13
|
import * as Mappers from "../models/mappers";
|
|
@@ -16,12 +17,12 @@ import {
|
|
|
16
17
|
SuppressionContract,
|
|
17
18
|
SuppressionsListNextOptionalParams,
|
|
18
19
|
SuppressionsListOptionalParams,
|
|
20
|
+
SuppressionsListResponse,
|
|
19
21
|
SuppressionsGetOptionalParams,
|
|
20
22
|
SuppressionsGetResponse,
|
|
21
23
|
SuppressionsCreateOptionalParams,
|
|
22
24
|
SuppressionsCreateResponse,
|
|
23
25
|
SuppressionsDeleteOptionalParams,
|
|
24
|
-
SuppressionsListResponse,
|
|
25
26
|
SuppressionsListNextResponse
|
|
26
27
|
} from "../models";
|
|
27
28
|
|
|
@@ -54,22 +55,34 @@ export class SuppressionsImpl implements Suppressions {
|
|
|
54
55
|
[Symbol.asyncIterator]() {
|
|
55
56
|
return this;
|
|
56
57
|
},
|
|
57
|
-
byPage: () => {
|
|
58
|
-
|
|
58
|
+
byPage: (settings?: PageSettings) => {
|
|
59
|
+
if (settings?.maxPageSize) {
|
|
60
|
+
throw new Error("maxPageSize is not supported by this operation.");
|
|
61
|
+
}
|
|
62
|
+
return this.listPagingPage(options, settings);
|
|
59
63
|
}
|
|
60
64
|
};
|
|
61
65
|
}
|
|
62
66
|
|
|
63
67
|
private async *listPagingPage(
|
|
64
|
-
options?: SuppressionsListOptionalParams
|
|
68
|
+
options?: SuppressionsListOptionalParams,
|
|
69
|
+
settings?: PageSettings
|
|
65
70
|
): AsyncIterableIterator<SuppressionContract[]> {
|
|
66
|
-
let result
|
|
67
|
-
|
|
68
|
-
|
|
71
|
+
let result: SuppressionsListResponse;
|
|
72
|
+
let continuationToken = settings?.continuationToken;
|
|
73
|
+
if (!continuationToken) {
|
|
74
|
+
result = await this._list(options);
|
|
75
|
+
let page = result.value || [];
|
|
76
|
+
continuationToken = result.nextLink;
|
|
77
|
+
setContinuationToken(page, continuationToken);
|
|
78
|
+
yield page;
|
|
79
|
+
}
|
|
69
80
|
while (continuationToken) {
|
|
70
81
|
result = await this._listNext(continuationToken, options);
|
|
71
82
|
continuationToken = result.nextLink;
|
|
72
|
-
|
|
83
|
+
let page = result.value || [];
|
|
84
|
+
setContinuationToken(page, continuationToken);
|
|
85
|
+
yield page;
|
|
73
86
|
}
|
|
74
87
|
}
|
|
75
88
|
|
|
@@ -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/types/arm-advisor.d.ts
CHANGED
|
@@ -13,6 +13,8 @@ export declare class AdvisorManagementClient extends coreClient.ServiceClient {
|
|
|
13
13
|
* @param options The parameter options
|
|
14
14
|
*/
|
|
15
15
|
constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: AdvisorManagementClientOptionalParams);
|
|
16
|
+
/** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
|
|
17
|
+
private addCustomApiVersionPolicy;
|
|
16
18
|
recommendationMetadata: RecommendationMetadata;
|
|
17
19
|
configurations: Configurations;
|
|
18
20
|
recommendations: Recommendations;
|
|
@@ -57,14 +59,14 @@ export declare interface ARMErrorResponseBody {
|
|
|
57
59
|
export declare type Category = string;
|
|
58
60
|
|
|
59
61
|
/** The Advisor configuration data structure. */
|
|
60
|
-
export declare
|
|
62
|
+
export declare interface ConfigData extends Resource {
|
|
61
63
|
/** Exclude the resource from Advisor evaluations. Valid values: False (default) or True. */
|
|
62
64
|
exclude?: boolean;
|
|
63
65
|
/** Minimum percentage threshold for Advisor low CPU utilization evaluation. Valid only for subscriptions. Valid values: 5 (default), 10, 15 or 20. */
|
|
64
66
|
lowCpuThreshold?: CpuThreshold;
|
|
65
67
|
/** Advisor digest configuration. Valid only for subscriptions */
|
|
66
68
|
digests?: DigestConfig[];
|
|
67
|
-
}
|
|
69
|
+
}
|
|
68
70
|
|
|
69
71
|
/** The list of Advisor configurations. */
|
|
70
72
|
export declare interface ConfigurationListResult {
|
|
@@ -187,6 +189,15 @@ export declare interface DigestConfig {
|
|
|
187
189
|
*/
|
|
188
190
|
export declare type DigestConfigState = string;
|
|
189
191
|
|
|
192
|
+
/**
|
|
193
|
+
* Given a result page from a pageable operation, returns a
|
|
194
|
+
* continuation token that can be used to begin paging from
|
|
195
|
+
* that point later.
|
|
196
|
+
* @param page A result object from calling .byPage() on a paged operation.
|
|
197
|
+
* @returns The continuation token that can be passed into byPage().
|
|
198
|
+
*/
|
|
199
|
+
export declare function getContinuationToken(page: unknown): string | undefined;
|
|
200
|
+
|
|
190
201
|
/**
|
|
191
202
|
* Defines values for Impact. \
|
|
192
203
|
* {@link KnownImpact} can be used interchangeably with Impact,
|
|
@@ -200,48 +211,67 @@ export declare type Impact = string;
|
|
|
200
211
|
|
|
201
212
|
/** Known values of {@link Category} that the service accepts. */
|
|
202
213
|
export declare enum KnownCategory {
|
|
214
|
+
/** HighAvailability */
|
|
203
215
|
HighAvailability = "HighAvailability",
|
|
216
|
+
/** Security */
|
|
204
217
|
Security = "Security",
|
|
218
|
+
/** Performance */
|
|
205
219
|
Performance = "Performance",
|
|
220
|
+
/** Cost */
|
|
206
221
|
Cost = "Cost",
|
|
222
|
+
/** OperationalExcellence */
|
|
207
223
|
OperationalExcellence = "OperationalExcellence"
|
|
208
224
|
}
|
|
209
225
|
|
|
210
226
|
/** Known values of {@link ConfigurationName} that the service accepts. */
|
|
211
227
|
export declare enum KnownConfigurationName {
|
|
228
|
+
/** Default */
|
|
212
229
|
Default = "default"
|
|
213
230
|
}
|
|
214
231
|
|
|
215
232
|
/** Known values of {@link CpuThreshold} that the service accepts. */
|
|
216
233
|
export declare enum KnownCpuThreshold {
|
|
234
|
+
/** Five */
|
|
217
235
|
Five = "5",
|
|
236
|
+
/** Ten */
|
|
218
237
|
Ten = "10",
|
|
238
|
+
/** Fifteen */
|
|
219
239
|
Fifteen = "15",
|
|
240
|
+
/** Twenty */
|
|
220
241
|
Twenty = "20"
|
|
221
242
|
}
|
|
222
243
|
|
|
223
244
|
/** Known values of {@link DigestConfigState} that the service accepts. */
|
|
224
245
|
export declare enum KnownDigestConfigState {
|
|
246
|
+
/** Active */
|
|
225
247
|
Active = "Active",
|
|
248
|
+
/** Disabled */
|
|
226
249
|
Disabled = "Disabled"
|
|
227
250
|
}
|
|
228
251
|
|
|
229
252
|
/** Known values of {@link Impact} that the service accepts. */
|
|
230
253
|
export declare enum KnownImpact {
|
|
254
|
+
/** High */
|
|
231
255
|
High = "High",
|
|
256
|
+
/** Medium */
|
|
232
257
|
Medium = "Medium",
|
|
258
|
+
/** Low */
|
|
233
259
|
Low = "Low"
|
|
234
260
|
}
|
|
235
261
|
|
|
236
262
|
/** Known values of {@link Risk} that the service accepts. */
|
|
237
263
|
export declare enum KnownRisk {
|
|
264
|
+
/** Error */
|
|
238
265
|
Error = "Error",
|
|
266
|
+
/** Warning */
|
|
239
267
|
Warning = "Warning",
|
|
268
|
+
/** None */
|
|
240
269
|
None = "None"
|
|
241
270
|
}
|
|
242
271
|
|
|
243
272
|
/** Known values of {@link Scenario} that the service accepts. */
|
|
244
273
|
export declare enum KnownScenario {
|
|
274
|
+
/** Alerts */
|
|
245
275
|
Alerts = "Alerts"
|
|
246
276
|
}
|
|
247
277
|
|
|
@@ -487,7 +517,7 @@ export declare interface ResourceMetadata {
|
|
|
487
517
|
}
|
|
488
518
|
|
|
489
519
|
/** Advisor Recommendation. */
|
|
490
|
-
export declare
|
|
520
|
+
export declare interface ResourceRecommendationBase extends Resource {
|
|
491
521
|
/** The category of the recommendation. */
|
|
492
522
|
category?: Category;
|
|
493
523
|
/** The business impact of the recommendation. */
|
|
@@ -536,7 +566,7 @@ export declare type ResourceRecommendationBase = Resource & {
|
|
|
536
566
|
exposedMetadataProperties?: {
|
|
537
567
|
[propertyName: string]: Record<string, unknown>;
|
|
538
568
|
};
|
|
539
|
-
}
|
|
569
|
+
}
|
|
540
570
|
|
|
541
571
|
/** The list of Advisor recommendations. */
|
|
542
572
|
export declare interface ResourceRecommendationBaseListResult {
|
|
@@ -575,7 +605,7 @@ export declare interface ShortDescription {
|
|
|
575
605
|
}
|
|
576
606
|
|
|
577
607
|
/** The details of the snoozed or dismissed rule; for example, the duration, name, and GUID associated with the rule. */
|
|
578
|
-
export declare
|
|
608
|
+
export declare interface SuppressionContract extends Resource {
|
|
579
609
|
/** The GUID of the suppression. */
|
|
580
610
|
suppressionId?: string;
|
|
581
611
|
/** The duration for which the suppression is valid. */
|
|
@@ -585,7 +615,7 @@ export declare type SuppressionContract = Resource & {
|
|
|
585
615
|
* NOTE: This property will not be serialized. It can only be populated by the server.
|
|
586
616
|
*/
|
|
587
617
|
readonly expirationTimeStamp?: Date;
|
|
588
|
-
}
|
|
618
|
+
}
|
|
589
619
|
|
|
590
620
|
/** The list of Advisor suppressions. */
|
|
591
621
|
export declare interface SuppressionContractListResult {
|