Skip to content

Commit 2b03158

Browse files
author
awstools
committed
feat(client-cost-optimization-hub): Release ListEfficiencyMetrics API
1 parent 40ffa77 commit 2b03158

File tree

12 files changed

+678
-48
lines changed

12 files changed

+678
-48
lines changed

clients/client-cost-optimization-hub/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,14 @@ GetRecommendation
218218

219219
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/cost-optimization-hub/command/GetRecommendationCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-cost-optimization-hub/Interface/GetRecommendationCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-cost-optimization-hub/Interface/GetRecommendationCommandOutput/)
220220

221+
</details>
222+
<details>
223+
<summary>
224+
ListEfficiencyMetrics
225+
</summary>
226+
227+
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/cost-optimization-hub/command/ListEfficiencyMetricsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-cost-optimization-hub/Interface/ListEfficiencyMetricsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-cost-optimization-hub/Interface/ListEfficiencyMetricsCommandOutput/)
228+
221229
</details>
222230
<details>
223231
<summary>

clients/client-cost-optimization-hub/src/CostOptimizationHub.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ import {
1212
GetRecommendationCommandInput,
1313
GetRecommendationCommandOutput,
1414
} from "./commands/GetRecommendationCommand";
15+
import {
16+
ListEfficiencyMetricsCommand,
17+
ListEfficiencyMetricsCommandInput,
18+
ListEfficiencyMetricsCommandOutput,
19+
} from "./commands/ListEfficiencyMetricsCommand";
1520
import {
1621
ListEnrollmentStatusesCommand,
1722
ListEnrollmentStatusesCommandInput,
@@ -42,6 +47,7 @@ import { CostOptimizationHubClient, CostOptimizationHubClientConfig } from "./Co
4247
const commands = {
4348
GetPreferencesCommand,
4449
GetRecommendationCommand,
50+
ListEfficiencyMetricsCommand,
4551
ListEnrollmentStatusesCommand,
4652
ListRecommendationsCommand,
4753
ListRecommendationSummariesCommand,
@@ -82,6 +88,23 @@ export interface CostOptimizationHub {
8288
cb: (err: any, data?: GetRecommendationCommandOutput) => void
8389
): void;
8490

91+
/**
92+
* @see {@link ListEfficiencyMetricsCommand}
93+
*/
94+
listEfficiencyMetrics(
95+
args: ListEfficiencyMetricsCommandInput,
96+
options?: __HttpHandlerOptions
97+
): Promise<ListEfficiencyMetricsCommandOutput>;
98+
listEfficiencyMetrics(
99+
args: ListEfficiencyMetricsCommandInput,
100+
cb: (err: any, data?: ListEfficiencyMetricsCommandOutput) => void
101+
): void;
102+
listEfficiencyMetrics(
103+
args: ListEfficiencyMetricsCommandInput,
104+
options: __HttpHandlerOptions,
105+
cb: (err: any, data?: ListEfficiencyMetricsCommandOutput) => void
106+
): void;
107+
85108
/**
86109
* @see {@link ListEnrollmentStatusesCommand}
87110
*/

clients/client-cost-optimization-hub/src/CostOptimizationHubClient.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ import {
5959
} from "./auth/httpAuthSchemeProvider";
6060
import { GetPreferencesCommandInput, GetPreferencesCommandOutput } from "./commands/GetPreferencesCommand";
6161
import { GetRecommendationCommandInput, GetRecommendationCommandOutput } from "./commands/GetRecommendationCommand";
62+
import {
63+
ListEfficiencyMetricsCommandInput,
64+
ListEfficiencyMetricsCommandOutput,
65+
} from "./commands/ListEfficiencyMetricsCommand";
6266
import {
6367
ListEnrollmentStatusesCommandInput,
6468
ListEnrollmentStatusesCommandOutput,
@@ -93,6 +97,7 @@ export { __Client };
9397
export type ServiceInputTypes =
9498
| GetPreferencesCommandInput
9599
| GetRecommendationCommandInput
100+
| ListEfficiencyMetricsCommandInput
96101
| ListEnrollmentStatusesCommandInput
97102
| ListRecommendationSummariesCommandInput
98103
| ListRecommendationsCommandInput
@@ -105,6 +110,7 @@ export type ServiceInputTypes =
105110
export type ServiceOutputTypes =
106111
| GetPreferencesCommandOutput
107112
| GetRecommendationCommandOutput
113+
| ListEfficiencyMetricsCommandOutput
108114
| ListEnrollmentStatusesCommandOutput
109115
| ListRecommendationSummariesCommandOutput
110116
| ListRecommendationsCommandOutput
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
// smithy-typescript generated code
2+
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
3+
import { Command as $Command } from "@smithy/smithy-client";
4+
import { MetadataBearer as __MetadataBearer } from "@smithy/types";
5+
6+
import {
7+
CostOptimizationHubClientResolvedConfig,
8+
ServiceInputTypes,
9+
ServiceOutputTypes,
10+
} from "../CostOptimizationHubClient";
11+
import { commonParams } from "../endpoint/EndpointParameters";
12+
import { ListEfficiencyMetricsRequest, ListEfficiencyMetricsResponse } from "../models/models_0";
13+
import { ListEfficiencyMetrics } from "../schemas/schemas_0";
14+
15+
/**
16+
* @public
17+
*/
18+
export type { __MetadataBearer };
19+
export { $Command };
20+
/**
21+
* @public
22+
*
23+
* The input for {@link ListEfficiencyMetricsCommand}.
24+
*/
25+
export interface ListEfficiencyMetricsCommandInput extends ListEfficiencyMetricsRequest {}
26+
/**
27+
* @public
28+
*
29+
* The output of {@link ListEfficiencyMetricsCommand}.
30+
*/
31+
export interface ListEfficiencyMetricsCommandOutput extends ListEfficiencyMetricsResponse, __MetadataBearer {}
32+
33+
/**
34+
* <p>Returns cost efficiency metrics aggregated over time and optionally grouped by a specified dimension. The metrics provide insights into your cost optimization progress by tracking estimated savings, spending, and measures how effectively you're optimizing your Cloud resources.</p> <p>The operation supports both daily and monthly time granularities and allows grouping results by account ID, Amazon Web Services Region. Results are returned as time-series data, enabling you to analyze trends in your cost optimization performance over the specified time period.</p>
35+
* @example
36+
* Use a bare-bones client and the command you need to make an API call.
37+
* ```javascript
38+
* import { CostOptimizationHubClient, ListEfficiencyMetricsCommand } from "@aws-sdk/client-cost-optimization-hub"; // ES Modules import
39+
* // const { CostOptimizationHubClient, ListEfficiencyMetricsCommand } = require("@aws-sdk/client-cost-optimization-hub"); // CommonJS import
40+
* // import type { CostOptimizationHubClientConfig } from "@aws-sdk/client-cost-optimization-hub";
41+
* const config = {}; // type is CostOptimizationHubClientConfig
42+
* const client = new CostOptimizationHubClient(config);
43+
* const input = { // ListEfficiencyMetricsRequest
44+
* groupBy: "STRING_VALUE",
45+
* granularity: "Daily" || "Monthly", // required
46+
* timePeriod: { // TimePeriod
47+
* start: "STRING_VALUE", // required
48+
* end: "STRING_VALUE", // required
49+
* },
50+
* maxResults: Number("int"),
51+
* orderBy: { // OrderBy
52+
* dimension: "STRING_VALUE",
53+
* order: "Asc" || "Desc",
54+
* },
55+
* nextToken: "STRING_VALUE",
56+
* };
57+
* const command = new ListEfficiencyMetricsCommand(input);
58+
* const response = await client.send(command);
59+
* // { // ListEfficiencyMetricsResponse
60+
* // efficiencyMetricsByGroup: [ // EfficiencyMetricsByGroupList
61+
* // { // EfficiencyMetricsByGroup
62+
* // metricsByTime: [ // MetricsByTimeList
63+
* // { // MetricsByTime
64+
* // score: Number("double"),
65+
* // savings: Number("double"),
66+
* // spend: Number("double"),
67+
* // timestamp: "STRING_VALUE",
68+
* // },
69+
* // ],
70+
* // group: "STRING_VALUE",
71+
* // message: "STRING_VALUE",
72+
* // },
73+
* // ],
74+
* // nextToken: "STRING_VALUE",
75+
* // };
76+
*
77+
* ```
78+
*
79+
* @param ListEfficiencyMetricsCommandInput - {@link ListEfficiencyMetricsCommandInput}
80+
* @returns {@link ListEfficiencyMetricsCommandOutput}
81+
* @see {@link ListEfficiencyMetricsCommandInput} for command's `input` shape.
82+
* @see {@link ListEfficiencyMetricsCommandOutput} for command's `response` shape.
83+
* @see {@link CostOptimizationHubClientResolvedConfig | config} for CostOptimizationHubClient's `config` shape.
84+
*
85+
* @throws {@link AccessDeniedException} (client fault)
86+
* <p>You are not authorized to use this operation with the given parameters.</p>
87+
*
88+
* @throws {@link InternalServerException} (server fault)
89+
* <p>An error on the server occurred during the processing of your request. Try again later.</p>
90+
*
91+
* @throws {@link ThrottlingException} (client fault)
92+
* <p>The request was denied due to request throttling.</p>
93+
*
94+
* @throws {@link ValidationException} (client fault)
95+
* <p>The input fails to satisfy the constraints specified by an Amazon Web Services service.</p>
96+
*
97+
* @throws {@link CostOptimizationHubServiceException}
98+
* <p>Base exception class for all service exceptions from CostOptimizationHub service.</p>
99+
*
100+
*
101+
* @public
102+
*/
103+
export class ListEfficiencyMetricsCommand extends $Command
104+
.classBuilder<
105+
ListEfficiencyMetricsCommandInput,
106+
ListEfficiencyMetricsCommandOutput,
107+
CostOptimizationHubClientResolvedConfig,
108+
ServiceInputTypes,
109+
ServiceOutputTypes
110+
>()
111+
.ep(commonParams)
112+
.m(function (this: any, Command: any, cs: any, config: CostOptimizationHubClientResolvedConfig, o: any) {
113+
return [getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
114+
})
115+
.s("CostOptimizationHubService", "ListEfficiencyMetrics", {})
116+
.n("CostOptimizationHubClient", "ListEfficiencyMetricsCommand")
117+
.sc(ListEfficiencyMetrics)
118+
.build() {
119+
/** @internal type navigation helper, not in runtime. */
120+
protected declare static __types: {
121+
api: {
122+
input: ListEfficiencyMetricsRequest;
123+
output: ListEfficiencyMetricsResponse;
124+
};
125+
sdk: {
126+
input: ListEfficiencyMetricsCommandInput;
127+
output: ListEfficiencyMetricsCommandOutput;
128+
};
129+
};
130+
}

clients/client-cost-optimization-hub/src/commands/UpdateEnrollmentStatusCommand.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export interface UpdateEnrollmentStatusCommandInput extends UpdateEnrollmentStat
3131
export interface UpdateEnrollmentStatusCommandOutput extends UpdateEnrollmentStatusResponse, __MetadataBearer {}
3232

3333
/**
34-
* <p>Updates the enrollment (opt in and opt out) status of an account to the Cost Optimization Hub service.</p> <p>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.</p> <p>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.</p>
34+
* <p>Updates the enrollment (opt in and opt out) status of an account to the Cost Optimization Hub service.</p> <p>If the account is a management account of an organization, this action can also be used to enroll member accounts of the organization.</p> <p>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.</p>
3535
* @example
3636
* Use a bare-bones client and the command you need to make an API call.
3737
* ```javascript

clients/client-cost-optimization-hub/src/commands/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// smithy-typescript generated code
22
export * from "./GetPreferencesCommand";
33
export * from "./GetRecommendationCommand";
4+
export * from "./ListEfficiencyMetricsCommand";
45
export * from "./ListEnrollmentStatusesCommand";
56
export * from "./ListRecommendationSummariesCommand";
67
export * from "./ListRecommendationsCommand";

clients/client-cost-optimization-hub/src/models/enums.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,25 @@ export const Source = {
182182
*/
183183
export type Source = (typeof Source)[keyof typeof Source];
184184

185+
/**
186+
* @public
187+
* @enum
188+
*/
189+
export const GranularityType = {
190+
/**
191+
* <p>Metrics are aggregated daily, with each data point representing a single day's worth of efficiency data. Timestamps are formatted as YYYY-MM-DD.</p>
192+
*/
193+
DAILY: "Daily",
194+
/**
195+
* <p>Metrics are aggregated monthly, with each data point representing a full month's worth of efficiency data. Timestamps are formatted as YYYY-MM.</p>
196+
*/
197+
MONTHLY: "Monthly",
198+
} as const;
199+
/**
200+
* @public
201+
*/
202+
export type GranularityType = (typeof GranularityType)[keyof typeof GranularityType];
203+
185204
/**
186205
* @public
187206
* @enum

0 commit comments

Comments
 (0)