Skip to content

Commit

Permalink
feat(client-eks): Add support for cluster insights, new EKS capabilit…
Browse files Browse the repository at this point in the history
…y that surfaces potentially upgrade impacting issues.
  • Loading branch information
awstools committed Dec 20, 2023
1 parent ff9baa6 commit 864e50e
Show file tree
Hide file tree
Showing 10 changed files with 1,159 additions and 5 deletions.
16 changes: 16 additions & 0 deletions clients/client-eks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,14 @@ DescribeIdentityProviderConfig

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/eks/command/DescribeIdentityProviderConfigCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-eks/Interface/DescribeIdentityProviderConfigCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-eks/Interface/DescribeIdentityProviderConfigCommandOutput/)

</details>
<details>
<summary>
DescribeInsight
</summary>

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/eks/command/DescribeInsightCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-eks/Interface/DescribeInsightCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-eks/Interface/DescribeInsightCommandOutput/)

</details>
<details>
<summary>
Expand Down Expand Up @@ -522,6 +530,14 @@ ListIdentityProviderConfigs

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/eks/command/ListIdentityProviderConfigsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-eks/Interface/ListIdentityProviderConfigsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-eks/Interface/ListIdentityProviderConfigsCommandOutput/)

</details>
<details>
<summary>
ListInsights
</summary>

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/eks/command/ListInsightsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-eks/Interface/ListInsightsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-eks/Interface/ListInsightsCommandOutput/)

</details>
<details>
<summary>
Expand Down
37 changes: 37 additions & 0 deletions clients/client-eks/src/EKS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ import {
DescribeIdentityProviderConfigCommandInput,
DescribeIdentityProviderConfigCommandOutput,
} from "./commands/DescribeIdentityProviderConfigCommand";
import {
DescribeInsightCommand,
DescribeInsightCommandInput,
DescribeInsightCommandOutput,
} from "./commands/DescribeInsightCommand";
import {
DescribeNodegroupCommand,
DescribeNodegroupCommandInput,
Expand Down Expand Up @@ -185,6 +190,11 @@ import {
ListIdentityProviderConfigsCommandInput,
ListIdentityProviderConfigsCommandOutput,
} from "./commands/ListIdentityProviderConfigsCommand";
import {
ListInsightsCommand,
ListInsightsCommandInput,
ListInsightsCommandOutput,
} from "./commands/ListInsightsCommand";
import {
ListNodegroupsCommand,
ListNodegroupsCommandInput,
Expand Down Expand Up @@ -277,6 +287,7 @@ const commands = {
DescribeEksAnywhereSubscriptionCommand,
DescribeFargateProfileCommand,
DescribeIdentityProviderConfigCommand,
DescribeInsightCommand,
DescribeNodegroupCommand,
DescribePodIdentityAssociationCommand,
DescribeUpdateCommand,
Expand All @@ -290,6 +301,7 @@ const commands = {
ListEksAnywhereSubscriptionsCommand,
ListFargateProfilesCommand,
ListIdentityProviderConfigsCommand,
ListInsightsCommand,
ListNodegroupsCommand,
ListPodIdentityAssociationsCommand,
ListTagsForResourceCommand,
Expand Down Expand Up @@ -711,6 +723,20 @@ export interface EKS {
cb: (err: any, data?: DescribeIdentityProviderConfigCommandOutput) => void
): void;

/**
* @see {@link DescribeInsightCommand}
*/
describeInsight(
args: DescribeInsightCommandInput,
options?: __HttpHandlerOptions
): Promise<DescribeInsightCommandOutput>;
describeInsight(args: DescribeInsightCommandInput, cb: (err: any, data?: DescribeInsightCommandOutput) => void): void;
describeInsight(
args: DescribeInsightCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: DescribeInsightCommandOutput) => void
): void;

/**
* @see {@link DescribeNodegroupCommand}
*/
Expand Down Expand Up @@ -917,6 +943,17 @@ export interface EKS {
cb: (err: any, data?: ListIdentityProviderConfigsCommandOutput) => void
): void;

/**
* @see {@link ListInsightsCommand}
*/
listInsights(args: ListInsightsCommandInput, options?: __HttpHandlerOptions): Promise<ListInsightsCommandOutput>;
listInsights(args: ListInsightsCommandInput, cb: (err: any, data?: ListInsightsCommandOutput) => void): void;
listInsights(
args: ListInsightsCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: ListInsightsCommandOutput) => void
): void;

/**
* @see {@link ListNodegroupsCommand}
*/
Expand Down
6 changes: 6 additions & 0 deletions clients/client-eks/src/EKSClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ import {
DescribeIdentityProviderConfigCommandInput,
DescribeIdentityProviderConfigCommandOutput,
} from "./commands/DescribeIdentityProviderConfigCommand";
import { DescribeInsightCommandInput, DescribeInsightCommandOutput } from "./commands/DescribeInsightCommand";
import { DescribeNodegroupCommandInput, DescribeNodegroupCommandOutput } from "./commands/DescribeNodegroupCommand";
import {
DescribePodIdentityAssociationCommandInput,
Expand Down Expand Up @@ -153,6 +154,7 @@ import {
ListIdentityProviderConfigsCommandInput,
ListIdentityProviderConfigsCommandOutput,
} from "./commands/ListIdentityProviderConfigsCommand";
import { ListInsightsCommandInput, ListInsightsCommandOutput } from "./commands/ListInsightsCommand";
import { ListNodegroupsCommandInput, ListNodegroupsCommandOutput } from "./commands/ListNodegroupsCommand";
import {
ListPodIdentityAssociationsCommandInput,
Expand Down Expand Up @@ -233,6 +235,7 @@ export type ServiceInputTypes =
| DescribeEksAnywhereSubscriptionCommandInput
| DescribeFargateProfileCommandInput
| DescribeIdentityProviderConfigCommandInput
| DescribeInsightCommandInput
| DescribeNodegroupCommandInput
| DescribePodIdentityAssociationCommandInput
| DescribeUpdateCommandInput
Expand All @@ -246,6 +249,7 @@ export type ServiceInputTypes =
| ListEksAnywhereSubscriptionsCommandInput
| ListFargateProfilesCommandInput
| ListIdentityProviderConfigsCommandInput
| ListInsightsCommandInput
| ListNodegroupsCommandInput
| ListPodIdentityAssociationsCommandInput
| ListTagsForResourceCommandInput
Expand Down Expand Up @@ -292,6 +296,7 @@ export type ServiceOutputTypes =
| DescribeEksAnywhereSubscriptionCommandOutput
| DescribeFargateProfileCommandOutput
| DescribeIdentityProviderConfigCommandOutput
| DescribeInsightCommandOutput
| DescribeNodegroupCommandOutput
| DescribePodIdentityAssociationCommandOutput
| DescribeUpdateCommandOutput
Expand All @@ -305,6 +310,7 @@ export type ServiceOutputTypes =
| ListEksAnywhereSubscriptionsCommandOutput
| ListFargateProfilesCommandOutput
| ListIdentityProviderConfigsCommandOutput
| ListInsightsCommandOutput
| ListNodegroupsCommandOutput
| ListPodIdentityAssociationsCommandOutput
| ListTagsForResourceCommandOutput
Expand Down
199 changes: 199 additions & 0 deletions clients/client-eks/src/commands/DescribeInsightCommand.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
// smithy-typescript generated code
import { EndpointParameterInstructions, getEndpointPlugin } from "@smithy/middleware-endpoint";
import { getSerdePlugin } from "@smithy/middleware-serde";
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@smithy/protocol-http";
import { Command as $Command } from "@smithy/smithy-client";
import {
FinalizeHandlerArguments,
Handler,
HandlerExecutionContext,
HttpHandlerOptions as __HttpHandlerOptions,
MetadataBearer as __MetadataBearer,
MiddlewareStack,
SerdeContext as __SerdeContext,
SMITHY_CONTEXT_KEY,
} from "@smithy/types";

import { EKSClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../EKSClient";
import { DescribeInsightRequest, DescribeInsightResponse } from "../models/models_0";
import { de_DescribeInsightCommand, se_DescribeInsightCommand } from "../protocols/Aws_restJson1";

/**
* @public
*/
export { __MetadataBearer, $Command };
/**
* @public
*
* The input for {@link DescribeInsightCommand}.
*/
export interface DescribeInsightCommandInput extends DescribeInsightRequest {}
/**
* @public
*
* The output of {@link DescribeInsightCommand}.
*/
export interface DescribeInsightCommandOutput extends DescribeInsightResponse, __MetadataBearer {}

/**
* @public
* <p>Returns details about an insight that you specify using its ID.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { EKSClient, DescribeInsightCommand } from "@aws-sdk/client-eks"; // ES Modules import
* // const { EKSClient, DescribeInsightCommand } = require("@aws-sdk/client-eks"); // CommonJS import
* const client = new EKSClient(config);
* const input = { // DescribeInsightRequest
* clusterName: "STRING_VALUE", // required
* id: "STRING_VALUE", // required
* };
* const command = new DescribeInsightCommand(input);
* const response = await client.send(command);
* // { // DescribeInsightResponse
* // insight: { // Insight
* // id: "STRING_VALUE",
* // name: "STRING_VALUE",
* // category: "UPGRADE_READINESS",
* // kubernetesVersion: "STRING_VALUE",
* // lastRefreshTime: new Date("TIMESTAMP"),
* // lastTransitionTime: new Date("TIMESTAMP"),
* // description: "STRING_VALUE",
* // insightStatus: { // InsightStatus
* // status: "PASSING" || "WARNING" || "ERROR" || "UNKNOWN",
* // reason: "STRING_VALUE",
* // },
* // recommendation: "STRING_VALUE",
* // additionalInfo: { // AdditionalInfoMap
* // "<keys>": "STRING_VALUE",
* // },
* // resources: [ // InsightResourceDetails
* // { // InsightResourceDetail
* // insightStatus: {
* // status: "PASSING" || "WARNING" || "ERROR" || "UNKNOWN",
* // reason: "STRING_VALUE",
* // },
* // kubernetesResourceUri: "STRING_VALUE",
* // arn: "STRING_VALUE",
* // },
* // ],
* // categorySpecificSummary: { // InsightCategorySpecificSummary
* // deprecationDetails: [ // DeprecationDetails
* // { // DeprecationDetail
* // usage: "STRING_VALUE",
* // replacedWith: "STRING_VALUE",
* // stopServingVersion: "STRING_VALUE",
* // startServingReplacementVersion: "STRING_VALUE",
* // clientStats: [ // ClientStats
* // { // ClientStat
* // userAgent: "STRING_VALUE",
* // numberOfRequestsLast30Days: Number("int"),
* // lastRequestTime: new Date("TIMESTAMP"),
* // },
* // ],
* // },
* // ],
* // },
* // },
* // };
*
* ```
*
* @param DescribeInsightCommandInput - {@link DescribeInsightCommandInput}
* @returns {@link DescribeInsightCommandOutput}
* @see {@link DescribeInsightCommandInput} for command's `input` shape.
* @see {@link DescribeInsightCommandOutput} for command's `response` shape.
* @see {@link EKSClientResolvedConfig | config} for EKSClient's `config` shape.
*
* @throws {@link InvalidParameterException} (client fault)
* <p>The specified parameter is invalid. Review the available parameters for the API
* request.</p>
*
* @throws {@link InvalidRequestException} (client fault)
* <p>The request is invalid given the state of the cluster. Check the state of the cluster
* and the associated operations.</p>
*
* @throws {@link ResourceNotFoundException} (client fault)
* <p>The specified resource could not be found. You can view your available clusters with
* <code>ListClusters</code>. You can view your available managed node groups with
* <code>ListNodegroups</code>. Amazon EKS clusters and node groups are Amazon Web Services Region specific.</p>
*
* @throws {@link ServerException} (server fault)
* <p>These errors are usually caused by a server-side issue.</p>
*
* @throws {@link EKSServiceException}
* <p>Base exception class for all service exceptions from EKS service.</p>
*
*/
export class DescribeInsightCommand extends $Command<
DescribeInsightCommandInput,
DescribeInsightCommandOutput,
EKSClientResolvedConfig
> {
public static getEndpointParameterInstructions(): EndpointParameterInstructions {
return {
UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" },
Endpoint: { type: "builtInParams", name: "endpoint" },
Region: { type: "builtInParams", name: "region" },
UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" },
};
}

/**
* @public
*/
constructor(readonly input: DescribeInsightCommandInput) {
super();
}

/**
* @internal
*/
resolveMiddleware(
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
configuration: EKSClientResolvedConfig,
options?: __HttpHandlerOptions
): Handler<DescribeInsightCommandInput, DescribeInsightCommandOutput> {
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
this.middlewareStack.use(
getEndpointPlugin(configuration, DescribeInsightCommand.getEndpointParameterInstructions())
);

const stack = clientStack.concat(this.middlewareStack);

const { logger } = configuration;
const clientName = "EKSClient";
const commandName = "DescribeInsightCommand";
const handlerExecutionContext: HandlerExecutionContext = {
logger,
clientName,
commandName,
inputFilterSensitiveLog: (_: any) => _,
outputFilterSensitiveLog: (_: any) => _,
[SMITHY_CONTEXT_KEY]: {
service: "AWSWesleyFrontend",
operation: "DescribeInsight",
},
};
const { requestHandler } = configuration;
return stack.resolve(
(request: FinalizeHandlerArguments<any>) =>
requestHandler.handle(request.request as __HttpRequest, options || {}),
handlerExecutionContext
);
}

/**
* @internal
*/
private serialize(input: DescribeInsightCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
return se_DescribeInsightCommand(input, context);
}

/**
* @internal
*/
private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<DescribeInsightCommandOutput> {
return de_DescribeInsightCommand(output, context);
}
}
Loading

0 comments on commit 864e50e

Please sign in to comment.