From 82ea670c8df1aa3fc00ca872c1105c9fbf59a678 Mon Sep 17 00:00:00 2001 From: awstools Date: Tue, 6 Aug 2024 18:13:44 +0000 Subject: [PATCH] feat(client-cost-optimization-hub): This release adds savings percentage support to the ListRecommendationSummaries API. --- .../ListRecommendationSummariesCommand.ts | 6 ++ .../commands/UpdateEnrollmentStatusCommand.ts | 4 +- .../src/models/models_0.ts | 53 ++++++++++++++-- .../src/protocols/Aws_json1_0.ts | 6 ++ .../aws-models/cost-optimization-hub.json | 61 +++++++++++++++++-- 5 files changed, 119 insertions(+), 11 deletions(-) diff --git a/clients/client-cost-optimization-hub/src/commands/ListRecommendationSummariesCommand.ts b/clients/client-cost-optimization-hub/src/commands/ListRecommendationSummariesCommand.ts index 700ce18287782..70c04dd727bac 100644 --- a/clients/client-cost-optimization-hub/src/commands/ListRecommendationSummariesCommand.ts +++ b/clients/client-cost-optimization-hub/src/commands/ListRecommendationSummariesCommand.ts @@ -83,6 +83,9 @@ export interface ListRecommendationSummariesCommandOutput * }, * groupBy: "STRING_VALUE", // required * maxResults: Number("int"), + * metrics: [ // SummaryMetricsList + * "SavingsPercentage", + * ], * nextToken: "STRING_VALUE", * }; * const command = new ListRecommendationSummariesCommand(input); @@ -98,6 +101,9 @@ export interface ListRecommendationSummariesCommandOutput * // ], * // groupBy: "STRING_VALUE", * // currencyCode: "STRING_VALUE", + * // metrics: { // SummaryMetricsResult + * // savingsPercentage: "STRING_VALUE", + * // }, * // nextToken: "STRING_VALUE", * // }; * diff --git a/clients/client-cost-optimization-hub/src/commands/UpdateEnrollmentStatusCommand.ts b/clients/client-cost-optimization-hub/src/commands/UpdateEnrollmentStatusCommand.ts index 1ec5d8110601d..3746713ed7b57 100644 --- a/clients/client-cost-optimization-hub/src/commands/UpdateEnrollmentStatusCommand.ts +++ b/clients/client-cost-optimization-hub/src/commands/UpdateEnrollmentStatusCommand.ts @@ -34,8 +34,8 @@ export interface UpdateEnrollmentStatusCommandOutput extends UpdateEnrollmentSta /** *

Updates the enrollment (opt in and opt out) status of an account to the Cost Optimization * Hub service.

- *

If the account is a management account of an organization, this action can also be used to - * enroll member accounts of the organization.

+ *

If the account is a management account or delegated administrator of an organization, this + * action can also be used to enroll member accounts of the organization.

*

You must have the appropriate permissions to opt in to Cost Optimization Hub and to view * its recommendations. When you opt in, Cost Optimization Hub automatically creates a * service-linked role in your account to access its data.

diff --git a/clients/client-cost-optimization-hub/src/models/models_0.ts b/clients/client-cost-optimization-hub/src/models/models_0.ts index bb8167a31ade3..e76adbd532335 100644 --- a/clients/client-cost-optimization-hub/src/models/models_0.ts +++ b/clients/client-cost-optimization-hub/src/models/models_0.ts @@ -2233,7 +2233,7 @@ export interface ListEnrollmentStatusesResponse { /** *

The enrollment status of all member accounts in the organization if the account is the - * management account.

+ * management account or delegated administrator.

* @public */ includeMemberAccounts?: boolean; @@ -2536,6 +2536,19 @@ export interface ListRecommendationsResponse { nextToken?: string; } +/** + * @public + * @enum + */ +export const SummaryMetrics = { + SAVINGS_PERCENTAGE: "SavingsPercentage", +} as const; + +/** + * @public + */ +export type SummaryMetrics = (typeof SummaryMetrics)[keyof typeof SummaryMetrics]; + /** * @public */ @@ -2554,11 +2567,18 @@ export interface ListRecommendationSummariesRequest { groupBy: string | undefined; /** - *

The maximum number of recommendations that are returned for the request.

+ *

The maximum number of recommendations to be returned for the request.

* @public */ maxResults?: number; + /** + *

Additional metrics to be returned for the request. The only valid value is + * savingsPercentage.

+ * @public + */ + metrics?: SummaryMetrics[]; + /** *

The token to retrieve the next set of results.

* @public @@ -2591,6 +2611,24 @@ export interface RecommendationSummary { recommendationCount?: number; } +/** + *

The results or descriptions for the additional metrics, based on whether the metrics were + * or were not requested.

+ * @public + */ +export interface SummaryMetricsResult { + /** + *

The savings percentage based on your Amazon Web Services spend over the past 30 + * days.

+ * + *

Savings percentage is only supported when filtering by Region, account ID, or + * tags.

+ *
+ * @public + */ + savingsPercentage?: string; +} + /** * @public */ @@ -2602,7 +2640,7 @@ export interface ListRecommendationSummariesResponse { estimatedTotalDedupedSavings?: number; /** - *

List of all savings recommendations.

+ *

A list of all savings recommendations.

* @public */ items?: RecommendationSummary[]; @@ -2619,6 +2657,13 @@ export interface ListRecommendationSummariesResponse { */ currencyCode?: string; + /** + *

The results or descriptions for the additional metrics, based on whether the metrics were + * or were not requested.

+ * @public + */ + metrics?: SummaryMetricsResult; + /** *

The token to retrieve the next set of results.

* @public @@ -2638,7 +2683,7 @@ export interface UpdateEnrollmentStatusRequest { /** *

Indicates whether to enroll member accounts of the organization if the account is the - * management account.

+ * management account or delegated administrator.

* @public */ includeMemberAccounts?: boolean; diff --git a/clients/client-cost-optimization-hub/src/protocols/Aws_json1_0.ts b/clients/client-cost-optimization-hub/src/protocols/Aws_json1_0.ts index b93e4a365bf3e..aaa95eefd7dcd 100644 --- a/clients/client-cost-optimization-hub/src/protocols/Aws_json1_0.ts +++ b/clients/client-cost-optimization-hub/src/protocols/Aws_json1_0.ts @@ -98,6 +98,7 @@ import { SavingsPlansCostCalculation, SavingsPlansPricing, StorageConfiguration, + SummaryMetrics, Tag, ThrottlingException, UpdateEnrollmentStatusRequest, @@ -476,6 +477,8 @@ const de_ValidationExceptionRes = async (parsedOutput: any, context: __SerdeCont // se_ResourceTypeList omitted. +// se_SummaryMetricsList omitted. + // se_Tag omitted. // se_TagList omitted. @@ -749,6 +752,7 @@ const de_ListRecommendationSummariesResponse = ( estimatedTotalDedupedSavings: __limitedParseDouble, groupBy: __expectString, items: (_: any) => de_RecommendationSummariesList(_, context), + metrics: _json, nextToken: __expectString, }) as any; }; @@ -1063,6 +1067,8 @@ const de_StorageConfiguration = (output: any, context: __SerdeContext): StorageC }) as any; }; +// de_SummaryMetricsResult omitted. + // de_Tag omitted. // de_TagList omitted. diff --git a/codegen/sdk-codegen/aws-models/cost-optimization-hub.json b/codegen/sdk-codegen/aws-models/cost-optimization-hub.json index 53d322bf16094..80143b476d21f 100644 --- a/codegen/sdk-codegen/aws-models/cost-optimization-hub.json +++ b/codegen/sdk-codegen/aws-models/cost-optimization-hub.json @@ -1943,7 +1943,7 @@ "includeMemberAccounts": { "target": "smithy.api#Boolean", "traits": { - "smithy.api#documentation": "

The enrollment status of all member accounts in the organization if the account is the\n management account.

" + "smithy.api#documentation": "

The enrollment status of all member accounts in the organization if the account is the\n management account or delegated administrator.

" } }, "nextToken": { @@ -2006,13 +2006,20 @@ "maxResults": { "target": "com.amazonaws.costoptimizationhub#MaxResults", "traits": { - "smithy.api#documentation": "

The maximum number of recommendations that are returned for the request.

", + "smithy.api#documentation": "

The maximum number of recommendations to be returned for the request.

", "smithy.api#range": { "min": 0, "max": 1000 } } }, + "metrics": { + "target": "com.amazonaws.costoptimizationhub#SummaryMetricsList", + "traits": { + "smithy.api#documentation": "

Additional metrics to be returned for the request. The only valid value is\n savingsPercentage.

", + "smithy.api#tags": ["delegatedAdmin"] + } + }, "nextToken": { "target": "smithy.api#String", "traits": { @@ -2036,7 +2043,7 @@ "items": { "target": "com.amazonaws.costoptimizationhub#RecommendationSummariesList", "traits": { - "smithy.api#documentation": "

List of all savings recommendations.

" + "smithy.api#documentation": "

A list of all savings recommendations.

" } }, "groupBy": { @@ -2051,6 +2058,13 @@ "smithy.api#documentation": "

The currency code used for the recommendation.

" } }, + "metrics": { + "target": "com.amazonaws.costoptimizationhub#SummaryMetricsResult", + "traits": { + "smithy.api#documentation": "

The results or descriptions for the additional metrics, based on whether the metrics were\n or were not requested.

", + "smithy.api#tags": ["delegatedAdmin"] + } + }, "nextToken": { "target": "smithy.api#String", "traits": { @@ -3341,6 +3355,43 @@ "smithy.api#documentation": "

The storage configuration used for recommendations.

" } }, + "com.amazonaws.costoptimizationhub#SummaryMetrics": { + "type": "enum", + "members": { + "SAVINGS_PERCENTAGE": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "SavingsPercentage" + } + } + } + }, + "com.amazonaws.costoptimizationhub#SummaryMetricsList": { + "type": "list", + "member": { + "target": "com.amazonaws.costoptimizationhub#SummaryMetrics" + }, + "traits": { + "smithy.api#length": { + "min": 1, + "max": 100 + } + } + }, + "com.amazonaws.costoptimizationhub#SummaryMetricsResult": { + "type": "structure", + "members": { + "savingsPercentage": { + "target": "smithy.api#String", + "traits": { + "smithy.api#documentation": "

The savings percentage based on your Amazon Web Services spend over the past 30\n days.

\n \n

Savings percentage is only supported when filtering by Region, account ID, or\n tags.

\n
" + } + } + }, + "traits": { + "smithy.api#documentation": "

The results or descriptions for the additional metrics, based on whether the metrics were\n or were not requested.

" + } + }, "com.amazonaws.costoptimizationhub#Tag": { "type": "structure", "members": { @@ -3409,7 +3460,7 @@ } ], "traits": { - "smithy.api#documentation": "

Updates the enrollment (opt in and opt out) status of an account to the Cost Optimization\n Hub service.

\n

If the account is a management account of an organization, this action can also be used to\n enroll member accounts of the organization.

\n

You must have the appropriate permissions to opt in to Cost Optimization Hub and to view\n its recommendations. When you opt in, Cost Optimization Hub automatically creates a\n service-linked role in your account to access its data.

" + "smithy.api#documentation": "

Updates the enrollment (opt in and opt out) status of an account to the Cost Optimization\n Hub service.

\n

If the account is a management account or delegated administrator of an organization, this\n action can also be used to enroll member accounts of the organization.

\n

You must have the appropriate permissions to opt in to Cost Optimization Hub and to view\n its recommendations. When you opt in, Cost Optimization Hub automatically creates a\n service-linked role in your account to access its data.

" } }, "com.amazonaws.costoptimizationhub#UpdateEnrollmentStatusRequest": { @@ -3425,7 +3476,7 @@ "includeMemberAccounts": { "target": "smithy.api#Boolean", "traits": { - "smithy.api#documentation": "

Indicates whether to enroll member accounts of the organization if the account is the\n management account.

" + "smithy.api#documentation": "

Indicates whether to enroll member accounts of the organization if the account is the\n management account or delegated administrator.

" } } },