Skip to content

Commit 5f784a2

Browse files
author
awstools
committed
feat(client-redshift): LisRecommendations API to fetch Amazon Redshift Advisor recommendations.
1 parent a8559c4 commit 5f784a2

File tree

10 files changed

+900
-7
lines changed

10 files changed

+900
-7
lines changed

clients/client-redshift/README.md

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,16 @@ using your favorite package manager:
4444

4545
The AWS SDK is modulized by clients and commands.
4646
To send a request, you only need to import the `RedshiftClient` and
47-
the commands you need, for example `DescribeClustersCommand`:
47+
the commands you need, for example `ListRecommendationsCommand`:
4848

4949
```js
5050
// ES5 example
51-
const { RedshiftClient, DescribeClustersCommand } = require("@aws-sdk/client-redshift");
51+
const { RedshiftClient, ListRecommendationsCommand } = require("@aws-sdk/client-redshift");
5252
```
5353

5454
```ts
5555
// ES6+ example
56-
import { RedshiftClient, DescribeClustersCommand } from "@aws-sdk/client-redshift";
56+
import { RedshiftClient, ListRecommendationsCommand } from "@aws-sdk/client-redshift";
5757
```
5858

5959
### Usage
@@ -72,7 +72,7 @@ const client = new RedshiftClient({ region: "REGION" });
7272
const params = {
7373
/** input parameters */
7474
};
75-
const command = new DescribeClustersCommand(params);
75+
const command = new ListRecommendationsCommand(params);
7676
```
7777

7878
#### Async/await
@@ -151,15 +151,15 @@ const client = new AWS.Redshift({ region: "REGION" });
151151

152152
// async/await.
153153
try {
154-
const data = await client.describeClusters(params);
154+
const data = await client.listRecommendations(params);
155155
// process data.
156156
} catch (error) {
157157
// error handling.
158158
}
159159

160160
// Promises.
161161
client
162-
.describeClusters(params)
162+
.listRecommendations(params)
163163
.then((data) => {
164164
// process data.
165165
})
@@ -168,7 +168,7 @@ client
168168
});
169169

170170
// callbacks.
171-
client.describeClusters(params, (err, data) => {
171+
client.listRecommendations(params, (err, data) => {
172172
// process err and data.
173173
});
174174
```
@@ -1015,6 +1015,14 @@ GetResourcePolicy
10151015

10161016
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/redshift/command/GetResourcePolicyCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-redshift/Interface/GetResourcePolicyCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-redshift/Interface/GetResourcePolicyCommandOutput/)
10171017

1018+
</details>
1019+
<details>
1020+
<summary>
1021+
ListRecommendations
1022+
</summary>
1023+
1024+
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/redshift/command/ListRecommendationsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-redshift/Interface/ListRecommendationsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-redshift/Interface/ListRecommendationsCommandOutput/)
1025+
10181026
</details>
10191027
<details>
10201028
<summary>

clients/client-redshift/src/Redshift.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,11 @@ import {
485485
GetResourcePolicyCommandInput,
486486
GetResourcePolicyCommandOutput,
487487
} from "./commands/GetResourcePolicyCommand";
488+
import {
489+
ListRecommendationsCommand,
490+
ListRecommendationsCommandInput,
491+
ListRecommendationsCommandOutput,
492+
} from "./commands/ListRecommendationsCommand";
488493
import {
489494
ModifyAquaConfigurationCommand,
490495
ModifyAquaConfigurationCommandInput,
@@ -752,6 +757,7 @@ const commands = {
752757
GetReservedNodeExchangeConfigurationOptionsCommand,
753758
GetReservedNodeExchangeOfferingsCommand,
754759
GetResourcePolicyCommand,
760+
ListRecommendationsCommand,
755761
ModifyAquaConfigurationCommand,
756762
ModifyAuthenticationProfileCommand,
757763
ModifyClusterCommand,
@@ -2405,6 +2411,23 @@ export interface Redshift {
24052411
cb: (err: any, data?: GetResourcePolicyCommandOutput) => void
24062412
): void;
24072413

2414+
/**
2415+
* @see {@link ListRecommendationsCommand}
2416+
*/
2417+
listRecommendations(
2418+
args: ListRecommendationsCommandInput,
2419+
options?: __HttpHandlerOptions
2420+
): Promise<ListRecommendationsCommandOutput>;
2421+
listRecommendations(
2422+
args: ListRecommendationsCommandInput,
2423+
cb: (err: any, data?: ListRecommendationsCommandOutput) => void
2424+
): void;
2425+
listRecommendations(
2426+
args: ListRecommendationsCommandInput,
2427+
options: __HttpHandlerOptions,
2428+
cb: (err: any, data?: ListRecommendationsCommandOutput) => void
2429+
): void;
2430+
24082431
/**
24092432
* @see {@link ModifyAquaConfigurationCommand}
24102433
*/

clients/client-redshift/src/RedshiftClient.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,10 @@ import {
381381
GetReservedNodeExchangeOfferingsCommandOutput,
382382
} from "./commands/GetReservedNodeExchangeOfferingsCommand";
383383
import { GetResourcePolicyCommandInput, GetResourcePolicyCommandOutput } from "./commands/GetResourcePolicyCommand";
384+
import {
385+
ListRecommendationsCommandInput,
386+
ListRecommendationsCommandOutput,
387+
} from "./commands/ListRecommendationsCommand";
384388
import {
385389
ModifyAquaConfigurationCommandInput,
386390
ModifyAquaConfigurationCommandOutput,
@@ -603,6 +607,7 @@ export type ServiceInputTypes =
603607
| GetReservedNodeExchangeConfigurationOptionsCommandInput
604608
| GetReservedNodeExchangeOfferingsCommandInput
605609
| GetResourcePolicyCommandInput
610+
| ListRecommendationsCommandInput
606611
| ModifyAquaConfigurationCommandInput
607612
| ModifyAuthenticationProfileCommandInput
608613
| ModifyClusterCommandInput
@@ -740,6 +745,7 @@ export type ServiceOutputTypes =
740745
| GetReservedNodeExchangeConfigurationOptionsCommandOutput
741746
| GetReservedNodeExchangeOfferingsCommandOutput
742747
| GetResourcePolicyCommandOutput
748+
| ListRecommendationsCommandOutput
743749
| ModifyAquaConfigurationCommandOutput
744750
| ModifyAuthenticationProfileCommandOutput
745751
| ModifyClusterCommandOutput
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
// smithy-typescript generated code
2+
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
3+
import { getSerdePlugin } from "@smithy/middleware-serde";
4+
import { Command as $Command } from "@smithy/smithy-client";
5+
import { MetadataBearer as __MetadataBearer } from "@smithy/types";
6+
7+
import { commonParams } from "../endpoint/EndpointParameters";
8+
import { ListRecommendationsMessage, ListRecommendationsResult } from "../models/models_1";
9+
import { de_ListRecommendationsCommand, se_ListRecommendationsCommand } from "../protocols/Aws_query";
10+
import { RedshiftClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RedshiftClient";
11+
12+
/**
13+
* @public
14+
*/
15+
export { __MetadataBearer, $Command };
16+
/**
17+
* @public
18+
*
19+
* The input for {@link ListRecommendationsCommand}.
20+
*/
21+
export interface ListRecommendationsCommandInput extends ListRecommendationsMessage {}
22+
/**
23+
* @public
24+
*
25+
* The output of {@link ListRecommendationsCommand}.
26+
*/
27+
export interface ListRecommendationsCommandOutput extends ListRecommendationsResult, __MetadataBearer {}
28+
29+
/**
30+
* @public
31+
* <p>List the Amazon Redshift Advisor recommendations for one or multiple Amazon Redshift clusters in an Amazon Web Services account.</p>
32+
* @example
33+
* Use a bare-bones client and the command you need to make an API call.
34+
* ```javascript
35+
* import { RedshiftClient, ListRecommendationsCommand } from "@aws-sdk/client-redshift"; // ES Modules import
36+
* // const { RedshiftClient, ListRecommendationsCommand } = require("@aws-sdk/client-redshift"); // CommonJS import
37+
* const client = new RedshiftClient(config);
38+
* const input = { // ListRecommendationsMessage
39+
* ClusterIdentifier: "STRING_VALUE",
40+
* NamespaceArn: "STRING_VALUE",
41+
* MaxRecords: Number("int"),
42+
* Marker: "STRING_VALUE",
43+
* };
44+
* const command = new ListRecommendationsCommand(input);
45+
* const response = await client.send(command);
46+
* // { // ListRecommendationsResult
47+
* // Recommendations: [ // RecommendationList
48+
* // { // Recommendation
49+
* // Id: "STRING_VALUE",
50+
* // ClusterIdentifier: "STRING_VALUE",
51+
* // NamespaceArn: "STRING_VALUE",
52+
* // CreatedAt: new Date("TIMESTAMP"),
53+
* // RecommendationType: "STRING_VALUE",
54+
* // Title: "STRING_VALUE",
55+
* // Description: "STRING_VALUE",
56+
* // Observation: "STRING_VALUE",
57+
* // ImpactRanking: "HIGH" || "MEDIUM" || "LOW",
58+
* // RecommendationText: "STRING_VALUE",
59+
* // RecommendedActions: [ // RecommendedActionList
60+
* // { // RecommendedAction
61+
* // Text: "STRING_VALUE",
62+
* // Database: "STRING_VALUE",
63+
* // Command: "STRING_VALUE",
64+
* // Type: "SQL" || "CLI",
65+
* // },
66+
* // ],
67+
* // ReferenceLinks: [ // ReferenceLinkList
68+
* // { // ReferenceLink
69+
* // Text: "STRING_VALUE",
70+
* // Link: "STRING_VALUE",
71+
* // },
72+
* // ],
73+
* // },
74+
* // ],
75+
* // Marker: "STRING_VALUE",
76+
* // };
77+
*
78+
* ```
79+
*
80+
* @param ListRecommendationsCommandInput - {@link ListRecommendationsCommandInput}
81+
* @returns {@link ListRecommendationsCommandOutput}
82+
* @see {@link ListRecommendationsCommandInput} for command's `input` shape.
83+
* @see {@link ListRecommendationsCommandOutput} for command's `response` shape.
84+
* @see {@link RedshiftClientResolvedConfig | config} for RedshiftClient's `config` shape.
85+
*
86+
* @throws {@link ClusterNotFoundFault} (client fault)
87+
* <p>The <code>ClusterIdentifier</code> parameter does not refer to an existing cluster.
88+
* </p>
89+
*
90+
* @throws {@link UnsupportedOperationFault} (client fault)
91+
* <p>The requested operation isn't supported.</p>
92+
*
93+
* @throws {@link RedshiftServiceException}
94+
* <p>Base exception class for all service exceptions from Redshift service.</p>
95+
*
96+
*/
97+
export class ListRecommendationsCommand extends $Command
98+
.classBuilder<
99+
ListRecommendationsCommandInput,
100+
ListRecommendationsCommandOutput,
101+
RedshiftClientResolvedConfig,
102+
ServiceInputTypes,
103+
ServiceOutputTypes
104+
>()
105+
.ep({
106+
...commonParams,
107+
})
108+
.m(function (this: any, Command: any, cs: any, config: RedshiftClientResolvedConfig, o: any) {
109+
return [
110+
getSerdePlugin(config, this.serialize, this.deserialize),
111+
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
112+
];
113+
})
114+
.s("RedshiftServiceVersion20121201", "ListRecommendations", {})
115+
.n("RedshiftClient", "ListRecommendationsCommand")
116+
.f(void 0, void 0)
117+
.ser(se_ListRecommendationsCommand)
118+
.de(de_ListRecommendationsCommand)
119+
.build() {}

clients/client-redshift/src/commands/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ export * from "./GetClusterCredentialsWithIAMCommand";
9898
export * from "./GetReservedNodeExchangeConfigurationOptionsCommand";
9999
export * from "./GetReservedNodeExchangeOfferingsCommand";
100100
export * from "./GetResourcePolicyCommand";
101+
export * from "./ListRecommendationsCommand";
101102
export * from "./ModifyAquaConfigurationCommand";
102103
export * from "./ModifyAuthenticationProfileCommand";
103104
export * from "./ModifyClusterCommand";

0 commit comments

Comments
 (0)