From 864e50e8f634bb9d994b85204a403071c4163505 Mon Sep 17 00:00:00 2001 From: awstools Date: Wed, 20 Dec 2023 19:31:06 +0000 Subject: [PATCH] feat(client-eks): Add support for cluster insights, new EKS capability that surfaces potentially upgrade impacting issues. --- clients/client-eks/README.md | 16 + clients/client-eks/src/EKS.ts | 37 ++ clients/client-eks/src/EKSClient.ts | 6 + .../src/commands/DescribeInsightCommand.ts | 199 +++++++++ .../src/commands/ListInsightsCommand.ts | 181 ++++++++ clients/client-eks/src/commands/index.ts | 2 + clients/client-eks/src/models/models_0.ts | 414 +++++++++++++++++- .../src/pagination/ListInsightsPaginator.ts | 24 + clients/client-eks/src/pagination/index.ts | 1 + .../client-eks/src/protocols/Aws_restJson1.ts | 284 ++++++++++++ 10 files changed, 1159 insertions(+), 5 deletions(-) create mode 100644 clients/client-eks/src/commands/DescribeInsightCommand.ts create mode 100644 clients/client-eks/src/commands/ListInsightsCommand.ts create mode 100644 clients/client-eks/src/pagination/ListInsightsPaginator.ts diff --git a/clients/client-eks/README.md b/clients/client-eks/README.md index 11b4fbb2729b..e26602a21c0d 100644 --- a/clients/client-eks/README.md +++ b/clients/client-eks/README.md @@ -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/) + +
+ +DescribeInsight + + +[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/) +
@@ -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/) +
+
+ +ListInsights + + +[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/) +
diff --git a/clients/client-eks/src/EKS.ts b/clients/client-eks/src/EKS.ts index b1de2c990e06..278bbffa7735 100644 --- a/clients/client-eks/src/EKS.ts +++ b/clients/client-eks/src/EKS.ts @@ -124,6 +124,11 @@ import { DescribeIdentityProviderConfigCommandInput, DescribeIdentityProviderConfigCommandOutput, } from "./commands/DescribeIdentityProviderConfigCommand"; +import { + DescribeInsightCommand, + DescribeInsightCommandInput, + DescribeInsightCommandOutput, +} from "./commands/DescribeInsightCommand"; import { DescribeNodegroupCommand, DescribeNodegroupCommandInput, @@ -185,6 +190,11 @@ import { ListIdentityProviderConfigsCommandInput, ListIdentityProviderConfigsCommandOutput, } from "./commands/ListIdentityProviderConfigsCommand"; +import { + ListInsightsCommand, + ListInsightsCommandInput, + ListInsightsCommandOutput, +} from "./commands/ListInsightsCommand"; import { ListNodegroupsCommand, ListNodegroupsCommandInput, @@ -277,6 +287,7 @@ const commands = { DescribeEksAnywhereSubscriptionCommand, DescribeFargateProfileCommand, DescribeIdentityProviderConfigCommand, + DescribeInsightCommand, DescribeNodegroupCommand, DescribePodIdentityAssociationCommand, DescribeUpdateCommand, @@ -290,6 +301,7 @@ const commands = { ListEksAnywhereSubscriptionsCommand, ListFargateProfilesCommand, ListIdentityProviderConfigsCommand, + ListInsightsCommand, ListNodegroupsCommand, ListPodIdentityAssociationsCommand, ListTagsForResourceCommand, @@ -711,6 +723,20 @@ export interface EKS { cb: (err: any, data?: DescribeIdentityProviderConfigCommandOutput) => void ): void; + /** + * @see {@link DescribeInsightCommand} + */ + describeInsight( + args: DescribeInsightCommandInput, + options?: __HttpHandlerOptions + ): Promise; + 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} */ @@ -917,6 +943,17 @@ export interface EKS { cb: (err: any, data?: ListIdentityProviderConfigsCommandOutput) => void ): void; + /** + * @see {@link ListInsightsCommand} + */ + listInsights(args: ListInsightsCommandInput, options?: __HttpHandlerOptions): Promise; + 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} */ diff --git a/clients/client-eks/src/EKSClient.ts b/clients/client-eks/src/EKSClient.ts index 6e25ea65e86e..d8e638ef1e9c 100644 --- a/clients/client-eks/src/EKSClient.ts +++ b/clients/client-eks/src/EKSClient.ts @@ -119,6 +119,7 @@ import { DescribeIdentityProviderConfigCommandInput, DescribeIdentityProviderConfigCommandOutput, } from "./commands/DescribeIdentityProviderConfigCommand"; +import { DescribeInsightCommandInput, DescribeInsightCommandOutput } from "./commands/DescribeInsightCommand"; import { DescribeNodegroupCommandInput, DescribeNodegroupCommandOutput } from "./commands/DescribeNodegroupCommand"; import { DescribePodIdentityAssociationCommandInput, @@ -153,6 +154,7 @@ import { ListIdentityProviderConfigsCommandInput, ListIdentityProviderConfigsCommandOutput, } from "./commands/ListIdentityProviderConfigsCommand"; +import { ListInsightsCommandInput, ListInsightsCommandOutput } from "./commands/ListInsightsCommand"; import { ListNodegroupsCommandInput, ListNodegroupsCommandOutput } from "./commands/ListNodegroupsCommand"; import { ListPodIdentityAssociationsCommandInput, @@ -233,6 +235,7 @@ export type ServiceInputTypes = | DescribeEksAnywhereSubscriptionCommandInput | DescribeFargateProfileCommandInput | DescribeIdentityProviderConfigCommandInput + | DescribeInsightCommandInput | DescribeNodegroupCommandInput | DescribePodIdentityAssociationCommandInput | DescribeUpdateCommandInput @@ -246,6 +249,7 @@ export type ServiceInputTypes = | ListEksAnywhereSubscriptionsCommandInput | ListFargateProfilesCommandInput | ListIdentityProviderConfigsCommandInput + | ListInsightsCommandInput | ListNodegroupsCommandInput | ListPodIdentityAssociationsCommandInput | ListTagsForResourceCommandInput @@ -292,6 +296,7 @@ export type ServiceOutputTypes = | DescribeEksAnywhereSubscriptionCommandOutput | DescribeFargateProfileCommandOutput | DescribeIdentityProviderConfigCommandOutput + | DescribeInsightCommandOutput | DescribeNodegroupCommandOutput | DescribePodIdentityAssociationCommandOutput | DescribeUpdateCommandOutput @@ -305,6 +310,7 @@ export type ServiceOutputTypes = | ListEksAnywhereSubscriptionsCommandOutput | ListFargateProfilesCommandOutput | ListIdentityProviderConfigsCommandOutput + | ListInsightsCommandOutput | ListNodegroupsCommandOutput | ListPodIdentityAssociationsCommandOutput | ListTagsForResourceCommandOutput diff --git a/clients/client-eks/src/commands/DescribeInsightCommand.ts b/clients/client-eks/src/commands/DescribeInsightCommand.ts new file mode 100644 index 000000000000..2f80520fcc69 --- /dev/null +++ b/clients/client-eks/src/commands/DescribeInsightCommand.ts @@ -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 + *

Returns details about an insight that you specify using its ID.

+ * @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 + * // "": "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) + *

The specified parameter is invalid. Review the available parameters for the API + * request.

+ * + * @throws {@link InvalidRequestException} (client fault) + *

The request is invalid given the state of the cluster. Check the state of the cluster + * and the associated operations.

+ * + * @throws {@link ResourceNotFoundException} (client fault) + *

The specified resource could not be found. You can view your available clusters with + * ListClusters. You can view your available managed node groups with + * ListNodegroups. Amazon EKS clusters and node groups are Amazon Web Services Region specific.

+ * + * @throws {@link ServerException} (server fault) + *

These errors are usually caused by a server-side issue.

+ * + * @throws {@link EKSServiceException} + *

Base exception class for all service exceptions from EKS service.

+ * + */ +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, + configuration: EKSClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + 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) => + 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 { + return de_DescribeInsightCommand(output, context); + } +} diff --git a/clients/client-eks/src/commands/ListInsightsCommand.ts b/clients/client-eks/src/commands/ListInsightsCommand.ts new file mode 100644 index 000000000000..4c3a60a23dfa --- /dev/null +++ b/clients/client-eks/src/commands/ListInsightsCommand.ts @@ -0,0 +1,181 @@ +// 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 { ListInsightsRequest, ListInsightsResponse } from "../models/models_0"; +import { de_ListInsightsCommand, se_ListInsightsCommand } from "../protocols/Aws_restJson1"; + +/** + * @public + */ +export { __MetadataBearer, $Command }; +/** + * @public + * + * The input for {@link ListInsightsCommand}. + */ +export interface ListInsightsCommandInput extends ListInsightsRequest {} +/** + * @public + * + * The output of {@link ListInsightsCommand}. + */ +export interface ListInsightsCommandOutput extends ListInsightsResponse, __MetadataBearer {} + +/** + * @public + *

Returns a list of all insights checked for against the specified cluster. You can filter which insights are returned by category, associated Kubernetes version, and status.

+ * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { EKSClient, ListInsightsCommand } from "@aws-sdk/client-eks"; // ES Modules import + * // const { EKSClient, ListInsightsCommand } = require("@aws-sdk/client-eks"); // CommonJS import + * const client = new EKSClient(config); + * const input = { // ListInsightsRequest + * clusterName: "STRING_VALUE", // required + * filter: { // InsightsFilter + * categories: [ // CategoryList + * "UPGRADE_READINESS", + * ], + * kubernetesVersions: [ // StringList + * "STRING_VALUE", + * ], + * statuses: [ // InsightStatusValueList + * "PASSING" || "WARNING" || "ERROR" || "UNKNOWN", + * ], + * }, + * maxResults: Number("int"), + * nextToken: "STRING_VALUE", + * }; + * const command = new ListInsightsCommand(input); + * const response = await client.send(command); + * // { // ListInsightsResponse + * // insights: [ // InsightSummaries + * // { // InsightSummary + * // 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", + * // }, + * // }, + * // ], + * // nextToken: "STRING_VALUE", + * // }; + * + * ``` + * + * @param ListInsightsCommandInput - {@link ListInsightsCommandInput} + * @returns {@link ListInsightsCommandOutput} + * @see {@link ListInsightsCommandInput} for command's `input` shape. + * @see {@link ListInsightsCommandOutput} for command's `response` shape. + * @see {@link EKSClientResolvedConfig | config} for EKSClient's `config` shape. + * + * @throws {@link InvalidParameterException} (client fault) + *

The specified parameter is invalid. Review the available parameters for the API + * request.

+ * + * @throws {@link InvalidRequestException} (client fault) + *

The request is invalid given the state of the cluster. Check the state of the cluster + * and the associated operations.

+ * + * @throws {@link ResourceNotFoundException} (client fault) + *

The specified resource could not be found. You can view your available clusters with + * ListClusters. You can view your available managed node groups with + * ListNodegroups. Amazon EKS clusters and node groups are Amazon Web Services Region specific.

+ * + * @throws {@link ServerException} (server fault) + *

These errors are usually caused by a server-side issue.

+ * + * @throws {@link EKSServiceException} + *

Base exception class for all service exceptions from EKS service.

+ * + */ +export class ListInsightsCommand extends $Command< + ListInsightsCommandInput, + ListInsightsCommandOutput, + 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: ListInsightsCommandInput) { + super(); + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: EKSClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + this.middlewareStack.use(getEndpointPlugin(configuration, ListInsightsCommand.getEndpointParameterInstructions())); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "EKSClient"; + const commandName = "ListInsightsCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: (_: any) => _, + outputFilterSensitiveLog: (_: any) => _, + [SMITHY_CONTEXT_KEY]: { + service: "AWSWesleyFrontend", + operation: "ListInsights", + }, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + /** + * @internal + */ + private serialize(input: ListInsightsCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return se_ListInsightsCommand(input, context); + } + + /** + * @internal + */ + private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + return de_ListInsightsCommand(output, context); + } +} diff --git a/clients/client-eks/src/commands/index.ts b/clients/client-eks/src/commands/index.ts index d87c7913ca53..fb49c37ed552 100644 --- a/clients/client-eks/src/commands/index.ts +++ b/clients/client-eks/src/commands/index.ts @@ -25,6 +25,7 @@ export * from "./DescribeClusterCommand"; export * from "./DescribeEksAnywhereSubscriptionCommand"; export * from "./DescribeFargateProfileCommand"; export * from "./DescribeIdentityProviderConfigCommand"; +export * from "./DescribeInsightCommand"; export * from "./DescribeNodegroupCommand"; export * from "./DescribePodIdentityAssociationCommand"; export * from "./DescribeUpdateCommand"; @@ -38,6 +39,7 @@ export * from "./ListClustersCommand"; export * from "./ListEksAnywhereSubscriptionsCommand"; export * from "./ListFargateProfilesCommand"; export * from "./ListIdentityProviderConfigsCommand"; +export * from "./ListInsightsCommand"; export * from "./ListNodegroupsCommand"; export * from "./ListPodIdentityAssociationsCommand"; export * from "./ListTagsForResourceCommand"; diff --git a/clients/client-eks/src/models/models_0.ts b/clients/client-eks/src/models/models_0.ts index 49bb9dd1ee12..257160444815 100644 --- a/clients/client-eks/src/models/models_0.ts +++ b/clients/client-eks/src/models/models_0.ts @@ -1355,6 +1355,11 @@ export interface CreateAccessEntryRequest { *

The ARN of the IAM principal for the AccessEntry. You can specify one ARN for each access entry. You can't specify the * same ARN in more than one access entry. This value can't be changed after access entry * creation.

+ *

The valid principals differ depending on the type of the access entry in the type field. + * The only valid ARN is IAM roles for the types of access entries for nodes: + * . You can use every IAM principal type for STANDARD access entries. + * You can't use the STS session principal type with access entries because this is a temporary + * principal for each session and not a permanent identity that can be assigned permissions.

*

* IAM best practices recommend using IAM roles with * temporary credentials, rather than IAM users with long-term credentials. @@ -1413,7 +1418,9 @@ export interface CreateAccessEntryRequest { /** * @public - *

If the principalArn is for an IAM role that's used for + *

The type of the new access entry. Valid values are Standard, + * FARGATE_LINUX, EC2_LINUX, and EC2_WINDOWS.

+ *

If the principalArn is for an IAM role that's used for * self-managed Amazon EC2 nodes, specify EC2_LINUX or * EC2_WINDOWS. Amazon EKS grants the necessary permissions to the * node for you. If the principalArn is for any other purpose, specify @@ -1756,8 +1763,8 @@ export interface Logging { export interface ControlPlanePlacementRequest { /** * @public - *

The name of the placement group for the Kubernetes control plane instances. This setting - * can't be changed after cluster creation.

+ *

The name of the placement group for the Kubernetes control plane instances. This + * setting can't be changed after cluster creation.

*/ groupName?: string; } @@ -4493,6 +4500,259 @@ export interface DescribeIdentityProviderConfigResponse { identityProviderConfig?: IdentityProviderConfigResponse; } +/** + * @public + */ +export interface DescribeInsightRequest { + /** + * @public + *

The name of the cluster to describe the insight for.

+ */ + clusterName: string | undefined; + + /** + * @public + *

The identity of the insight to describe.

+ */ + id: string | undefined; +} + +/** + * @public + * @enum + */ +export const Category = { + UPGRADE_READINESS: "UPGRADE_READINESS", +} as const; + +/** + * @public + */ +export type Category = (typeof Category)[keyof typeof Category]; + +/** + * @public + *

Details about clients using the deprecated resources.

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

The user agent of the Kubernetes client using the deprecated resource.

+ */ + userAgent?: string; + + /** + * @public + *

The number of requests from the Kubernetes client seen over the last 30 days.

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

The timestamp of the last request seen from the Kubernetes client.

+ */ + lastRequestTime?: Date; +} + +/** + * @public + *

The summary information about deprecated resource usage for an insight check in the + * UPGRADE_READINESS category.

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

The deprecated version of the resource.

+ */ + usage?: string; + + /** + * @public + *

The newer version of the resource to migrate to if applicable.

+ */ + replacedWith?: string; + + /** + * @public + *

The version of the software where the deprecated resource version will stop being served.

+ */ + stopServingVersion?: string; + + /** + * @public + *

The version of the software where the newer resource version became available to migrate to if applicable.

+ */ + startServingReplacementVersion?: string; + + /** + * @public + *

Details about Kubernetes clients using the deprecated resources.

+ */ + clientStats?: ClientStat[]; +} + +/** + * @public + *

Summary information that relates to the category of the insight. Currently only + * returned with certain insights having category UPGRADE_READINESS.

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

The summary information about deprecated resource usage for an insight check in the + * UPGRADE_READINESS category.

+ */ + deprecationDetails?: DeprecationDetail[]; +} + +/** + * @public + * @enum + */ +export const InsightStatusValue = { + ERROR: "ERROR", + PASSING: "PASSING", + UNKNOWN: "UNKNOWN", + WARNING: "WARNING", +} as const; + +/** + * @public + */ +export type InsightStatusValue = (typeof InsightStatusValue)[keyof typeof InsightStatusValue]; + +/** + * @public + *

The status of the insight.

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

The status of the resource.

+ */ + status?: InsightStatusValue; + + /** + * @public + *

Explanation on the reasoning for the status of the resource.

+ */ + reason?: string; +} + +/** + * @public + *

Returns information about the resource being evaluated.

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

An object containing more detail on the status of the insight resource.

+ */ + insightStatus?: InsightStatus; + + /** + * @public + *

The Kubernetes resource URI if applicable.

+ */ + kubernetesResourceUri?: string; + + /** + * @public + *

The Amazon Resource Name (ARN) if applicable.

+ */ + arn?: string; +} + +/** + * @public + *

A check that provides recommendations to remedy potential upgrade-impacting issues.

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

The ID of the insight.

+ */ + id?: string; + + /** + * @public + *

The name of the insight.

+ */ + name?: string; + + /** + * @public + *

The category of the insight.

+ */ + category?: Category; + + /** + * @public + *

The Kubernetes minor version associated with an insight if applicable.

+ */ + kubernetesVersion?: string; + + /** + * @public + *

The time Amazon EKS last successfully completed a refresh of this insight check on the cluster.

+ */ + lastRefreshTime?: Date; + + /** + * @public + *

The time the status of the insight last changed.

+ */ + lastTransitionTime?: Date; + + /** + * @public + *

The description of the insight which includes alert criteria, remediation recommendation, and additional resources (contains Markdown).

+ */ + description?: string; + + /** + * @public + *

An object containing more detail on the status of the insight resource.

+ */ + insightStatus?: InsightStatus; + + /** + * @public + *

A summary of how to remediate the finding of this insight if applicable.

+ */ + recommendation?: string; + + /** + * @public + *

Links to sources that provide additional context on the insight.

+ */ + additionalInfo?: Record; + + /** + * @public + *

The details about each resource listed in the insight check result.

+ */ + resources?: InsightResourceDetail[]; + + /** + * @public + *

Summary information that relates to the category of the insight. Currently only + * returned with certain insights having category UPGRADE_READINESS.

+ */ + categorySpecificSummary?: InsightCategorySpecificSummary; +} + +/** + * @public + */ +export interface DescribeInsightResponse { + /** + * @public + *

The full description of the insight.

+ */ + insight?: Insight; +} + /** * @public */ @@ -5153,8 +5413,152 @@ export interface ListIdentityProviderConfigsResponse { /** * @public *

The nextToken value to include in a future - * ListIdentityProviderConfigsResponse request. When the results of a - * ListIdentityProviderConfigsResponse request exceed + * ListIdentityProviderConfigsResponse request. When the results of a + * ListIdentityProviderConfigsResponse request exceed + * maxResults, you can use this value to retrieve the next page of + * results. This value is null when there are no more results to + * return.

+ * + *

This token should be treated as an opaque identifier that is used only to + * retrieve the next items in a list and not for other programmatic purposes.

+ *
+ */ + nextToken?: string; +} + +/** + * @public + *

The criteria to use for the insights.

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

The categories to use to filter insights.

+ */ + categories?: Category[]; + + /** + * @public + *

The Kubernetes versions to use to filter the insights.

+ */ + kubernetesVersions?: string[]; + + /** + * @public + *

The statuses to use to filter the insights.

+ */ + statuses?: InsightStatusValue[]; +} + +/** + * @public + */ +export interface ListInsightsRequest { + /** + * @public + *

The name of the Amazon EKS cluster associated with the insights.

+ */ + clusterName: string | undefined; + + /** + * @public + *

The criteria to filter your list of insights for your cluster. You can filter which insights are returned by category, associated Kubernetes version, and status.

+ */ + filter?: InsightsFilter; + + /** + * @public + *

The maximum number of identity provider configurations returned by + * ListInsights in paginated output. When you use this parameter, + * ListInsights returns only maxResults results in a single + * page along with a nextToken response element. You can see the remaining + * results of the initial request by sending another ListInsights request with + * the returned nextToken value. This value can be between 1 + * and 100. If you don't use this parameter, ListInsights + * returns up to 100 results and a nextToken value, if + * applicable.

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

The nextToken value returned from a previous paginated ListInsights + * request. When the results of a ListInsights request exceed + * maxResults, you can use this value to retrieve the next page of + * results. This value is null when there are no more results to + * return.

+ */ + nextToken?: string; +} + +/** + * @public + *

The summarized description of the insight.

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

The ID of the insight.

+ */ + id?: string; + + /** + * @public + *

The name of the insight.

+ */ + name?: string; + + /** + * @public + *

The category of the insight.

+ */ + category?: Category; + + /** + * @public + *

The Kubernetes minor version associated with an insight if applicable.

+ */ + kubernetesVersion?: string; + + /** + * @public + *

The time Amazon EKS last successfully completed a refresh of this insight check on the cluster.

+ */ + lastRefreshTime?: Date; + + /** + * @public + *

The time the status of the insight last changed.

+ */ + lastTransitionTime?: Date; + + /** + * @public + *

The description of the insight which includes alert criteria, remediation recommendation, and additional resources (contains Markdown).

+ */ + description?: string; + + /** + * @public + *

An object containing more detail on the status of the insight.

+ */ + insightStatus?: InsightStatus; +} + +/** + * @public + */ +export interface ListInsightsResponse { + /** + * @public + *

The returned list of insights.

+ */ + insights?: InsightSummary[]; + + /** + * @public + *

The nextToken value to include in a future ListInsights + * request. When the results of a ListInsights request exceed * maxResults, you can use this value to retrieve the next page of * results. This value is null when there are no more results to * return.

diff --git a/clients/client-eks/src/pagination/ListInsightsPaginator.ts b/clients/client-eks/src/pagination/ListInsightsPaginator.ts new file mode 100644 index 000000000000..84909890d241 --- /dev/null +++ b/clients/client-eks/src/pagination/ListInsightsPaginator.ts @@ -0,0 +1,24 @@ +// smithy-typescript generated code +import { createPaginator } from "@smithy/core"; +import { Paginator } from "@smithy/types"; + +import { + ListInsightsCommand, + ListInsightsCommandInput, + ListInsightsCommandOutput, +} from "../commands/ListInsightsCommand"; +import { EKSClient } from "../EKSClient"; +import { EKSPaginationConfiguration } from "./Interfaces"; + +/** + * @public + */ +export const paginateListInsights: ( + config: EKSPaginationConfiguration, + input: ListInsightsCommandInput, + ...rest: any[] +) => Paginator = createPaginator< + EKSPaginationConfiguration, + ListInsightsCommandInput, + ListInsightsCommandOutput +>(EKSClient, ListInsightsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-eks/src/pagination/index.ts b/clients/client-eks/src/pagination/index.ts index 0dfa49718af3..fae7aaec5263 100644 --- a/clients/client-eks/src/pagination/index.ts +++ b/clients/client-eks/src/pagination/index.ts @@ -9,6 +9,7 @@ export * from "./ListClustersPaginator"; export * from "./ListEksAnywhereSubscriptionsPaginator"; export * from "./ListFargateProfilesPaginator"; export * from "./ListIdentityProviderConfigsPaginator"; +export * from "./ListInsightsPaginator"; export * from "./ListNodegroupsPaginator"; export * from "./ListPodIdentityAssociationsPaginator"; export * from "./ListUpdatesPaginator"; diff --git a/clients/client-eks/src/protocols/Aws_restJson1.ts b/clients/client-eks/src/protocols/Aws_restJson1.ts index 5f6d059b2841..9e031af828a5 100644 --- a/clients/client-eks/src/protocols/Aws_restJson1.ts +++ b/clients/client-eks/src/protocols/Aws_restJson1.ts @@ -96,6 +96,7 @@ import { DescribeIdentityProviderConfigCommandInput, DescribeIdentityProviderConfigCommandOutput, } from "../commands/DescribeIdentityProviderConfigCommand"; +import { DescribeInsightCommandInput, DescribeInsightCommandOutput } from "../commands/DescribeInsightCommand"; import { DescribeNodegroupCommandInput, DescribeNodegroupCommandOutput } from "../commands/DescribeNodegroupCommand"; import { DescribePodIdentityAssociationCommandInput, @@ -130,6 +131,7 @@ import { ListIdentityProviderConfigsCommandInput, ListIdentityProviderConfigsCommandOutput, } from "../commands/ListIdentityProviderConfigsCommand"; +import { ListInsightsCommandInput, ListInsightsCommandOutput } from "../commands/ListInsightsCommand"; import { ListNodegroupsCommandInput, ListNodegroupsCommandOutput } from "../commands/ListNodegroupsCommand"; import { ListPodIdentityAssociationsCommandInput, @@ -177,18 +179,26 @@ import { Addon, AssociatedAccessPolicy, BadRequestException, + Category, ClientException, + ClientStat, Cluster, ConnectorConfigRequest, ConnectorConfigResponse, ControlPlanePlacementRequest, CreateAccessConfigRequest, + DeprecationDetail, EksAnywhereSubscription, EksAnywhereSubscriptionTerm, EncryptionConfig, FargateProfile, FargateProfileSelector, IdentityProviderConfig, + Insight, + InsightCategorySpecificSummary, + InsightsFilter, + InsightStatusValue, + InsightSummary, InvalidParameterException, InvalidRequestException, KubernetesNetworkConfigRequest, @@ -790,6 +800,23 @@ export const se_DescribeIdentityProviderConfigCommand = async ( return b.build(); }; +/** + * serializeAws_restJson1DescribeInsightCommand + */ +export const se_DescribeInsightCommand = async ( + input: DescribeInsightCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const b = rb(input, context); + const headers: any = {}; + b.bp("/clusters/{clusterName}/insights/{id}"); + b.p("clusterName", () => input.clusterName!, "{clusterName}", false); + b.p("id", () => input.id!, "{id}", false); + let body: any; + b.m("GET").h(headers).b(body); + return b.build(); +}; + /** * serializeAws_restJson1DescribeNodegroupCommand */ @@ -1048,6 +1075,31 @@ export const se_ListIdentityProviderConfigsCommand = async ( return b.build(); }; +/** + * serializeAws_restJson1ListInsightsCommand + */ +export const se_ListInsightsCommand = async ( + input: ListInsightsCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const b = rb(input, context); + const headers: any = { + "content-type": "application/json", + }; + b.bp("/clusters/{clusterName}/insights"); + b.p("clusterName", () => input.clusterName!, "{clusterName}", false); + let body: any; + body = JSON.stringify( + take(input, { + filter: (_) => _json(_), + maxResults: [], + nextToken: [], + }) + ); + b.m("POST").h(headers).b(body); + return b.build(); +}; + /** * serializeAws_restJson1ListNodegroupsCommand */ @@ -2934,6 +2986,62 @@ const de_DescribeIdentityProviderConfigCommandError = async ( } }; +/** + * deserializeAws_restJson1DescribeInsightCommand + */ +export const de_DescribeInsightCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return de_DescribeInsightCommandError(output, context); + } + const contents: any = map({ + $metadata: deserializeMetadata(output), + }); + const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); + const doc = take(data, { + insight: (_) => de_Insight(_, context), + }); + Object.assign(contents, doc); + return contents; +}; + +/** + * deserializeAws_restJson1DescribeInsightCommandError + */ +const de_DescribeInsightCommandError = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + const parsedOutput: any = { + ...output, + body: await parseErrorBody(output.body, context), + }; + const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); + switch (errorCode) { + case "InvalidParameterException": + case "com.amazonaws.eks#InvalidParameterException": + throw await de_InvalidParameterExceptionRes(parsedOutput, context); + case "InvalidRequestException": + case "com.amazonaws.eks#InvalidRequestException": + throw await de_InvalidRequestExceptionRes(parsedOutput, context); + case "ResourceNotFoundException": + case "com.amazonaws.eks#ResourceNotFoundException": + throw await de_ResourceNotFoundExceptionRes(parsedOutput, context); + case "ServerException": + case "com.amazonaws.eks#ServerException": + throw await de_ServerExceptionRes(parsedOutput, context); + default: + const parsedBody = parsedOutput.body; + return throwDefaultError({ + output, + parsedBody, + errorCode, + }); + } +}; + /** * deserializeAws_restJson1DescribeNodegroupCommand */ @@ -3668,6 +3776,63 @@ const de_ListIdentityProviderConfigsCommandError = async ( } }; +/** + * deserializeAws_restJson1ListInsightsCommand + */ +export const de_ListInsightsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return de_ListInsightsCommandError(output, context); + } + const contents: any = map({ + $metadata: deserializeMetadata(output), + }); + const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); + const doc = take(data, { + insights: (_) => de_InsightSummaries(_, context), + nextToken: __expectString, + }); + Object.assign(contents, doc); + return contents; +}; + +/** + * deserializeAws_restJson1ListInsightsCommandError + */ +const de_ListInsightsCommandError = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + const parsedOutput: any = { + ...output, + body: await parseErrorBody(output.body, context), + }; + const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); + switch (errorCode) { + case "InvalidParameterException": + case "com.amazonaws.eks#InvalidParameterException": + throw await de_InvalidParameterExceptionRes(parsedOutput, context); + case "InvalidRequestException": + case "com.amazonaws.eks#InvalidRequestException": + throw await de_InvalidRequestExceptionRes(parsedOutput, context); + case "ResourceNotFoundException": + case "com.amazonaws.eks#ResourceNotFoundException": + throw await de_ResourceNotFoundExceptionRes(parsedOutput, context); + case "ServerException": + case "com.amazonaws.eks#ServerException": + throw await de_ServerExceptionRes(parsedOutput, context); + default: + const parsedBody = parsedOutput.body; + return throwDefaultError({ + output, + parsedBody, + errorCode, + }); + } +}; + /** * deserializeAws_restJson1ListNodegroupsCommand */ @@ -4815,6 +4980,8 @@ const de_UnsupportedAvailabilityZoneExceptionRes = async ( // se_AccessScope omitted. +// se_CategoryList omitted. + // se_ConnectorConfigRequest omitted. // se_ControlPlanePlacementRequest omitted. @@ -4835,6 +5002,10 @@ const de_UnsupportedAvailabilityZoneExceptionRes = async ( // se_IdentityProviderConfig omitted. +// se_InsightsFilter omitted. + +// se_InsightStatusValueList omitted. + // se_KubernetesNetworkConfigRequest omitted. // se_labelsKeyList omitted. @@ -4906,6 +5077,8 @@ const de_AccessEntry = (output: any, context: __SerdeContext): AccessEntry => { // de_AccessScope omitted. +// de_AdditionalInfoMap omitted. + /** * deserializeAws_restJson1Addon */ @@ -4972,6 +5145,29 @@ const de_AssociatedAccessPolicy = (output: any, context: __SerdeContext): Associ // de_Certificate omitted. +/** + * deserializeAws_restJson1ClientStat + */ +const de_ClientStat = (output: any, context: __SerdeContext): ClientStat => { + return take(output, { + lastRequestTime: (_: any) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))), + numberOfRequestsLast30Days: __expectInt32, + userAgent: __expectString, + }) as any; +}; + +/** + * deserializeAws_restJson1ClientStats + */ +const de_ClientStats = (output: any, context: __SerdeContext): ClientStat[] => { + const retVal = (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + return de_ClientStat(entry, context); + }); + return retVal; +}; + /** * deserializeAws_restJson1Cluster */ @@ -5026,6 +5222,31 @@ const de_ConnectorConfigResponse = (output: any, context: __SerdeContext): Conne // de_ControlPlanePlacementResponse omitted. +/** + * deserializeAws_restJson1DeprecationDetail + */ +const de_DeprecationDetail = (output: any, context: __SerdeContext): DeprecationDetail => { + return take(output, { + clientStats: (_: any) => de_ClientStats(_, context), + replacedWith: __expectString, + startServingReplacementVersion: __expectString, + stopServingVersion: __expectString, + usage: __expectString, + }) as any; +}; + +/** + * deserializeAws_restJson1DeprecationDetails + */ +const de_DeprecationDetails = (output: any, context: __SerdeContext): DeprecationDetail[] => { + const retVal = (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + return de_DeprecationDetail(entry, context); + }); + return retVal; +}; + /** * deserializeAws_restJson1EksAnywhereSubscription */ @@ -5099,6 +5320,69 @@ const de_FargateProfile = (output: any, context: __SerdeContext): FargateProfile // de_IdentityProviderConfigs omitted. +/** + * deserializeAws_restJson1Insight + */ +const de_Insight = (output: any, context: __SerdeContext): Insight => { + return take(output, { + additionalInfo: _json, + category: __expectString, + categorySpecificSummary: (_: any) => de_InsightCategorySpecificSummary(_, context), + description: __expectString, + id: __expectString, + insightStatus: _json, + kubernetesVersion: __expectString, + lastRefreshTime: (_: any) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))), + lastTransitionTime: (_: any) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))), + name: __expectString, + recommendation: __expectString, + resources: _json, + }) as any; +}; + +/** + * deserializeAws_restJson1InsightCategorySpecificSummary + */ +const de_InsightCategorySpecificSummary = (output: any, context: __SerdeContext): InsightCategorySpecificSummary => { + return take(output, { + deprecationDetails: (_: any) => de_DeprecationDetails(_, context), + }) as any; +}; + +// de_InsightResourceDetail omitted. + +// de_InsightResourceDetails omitted. + +// de_InsightStatus omitted. + +/** + * deserializeAws_restJson1InsightSummaries + */ +const de_InsightSummaries = (output: any, context: __SerdeContext): InsightSummary[] => { + const retVal = (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + return de_InsightSummary(entry, context); + }); + return retVal; +}; + +/** + * deserializeAws_restJson1InsightSummary + */ +const de_InsightSummary = (output: any, context: __SerdeContext): InsightSummary => { + return take(output, { + category: __expectString, + description: __expectString, + id: __expectString, + insightStatus: _json, + kubernetesVersion: __expectString, + lastRefreshTime: (_: any) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))), + lastTransitionTime: (_: any) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))), + name: __expectString, + }) as any; +}; + // de_Issue omitted. // de_IssueList omitted.