Skip to main content

aws_lite_rs/api/
eks.rs

1//! Amazon Elastic Kubernetes Service API client.
2//!
3//! Thin wrapper over generated ops. All URL construction and HTTP methods
4//! are in `ops::eks::EksOps`. This layer adds:
5//! - Ergonomic method signatures
6
7use crate::{
8    AwsHttpClient, Result,
9    ops::eks::EksOps,
10    types::eks::{
11        DescribeClusterResponse, DescribeNodegroupResponse, ListNodegroupsResponse,
12        UpdateNodegroupConfigRequest, UpdateNodegroupConfigResponse,
13    },
14};
15
16/// Client for the Amazon Elastic Kubernetes Service API
17pub struct EksClient<'a> {
18    ops: EksOps<'a>,
19}
20
21impl<'a> EksClient<'a> {
22    /// Create a new Amazon Elastic Kubernetes Service API client
23    pub(crate) fn new(client: &'a AwsHttpClient) -> Self {
24        Self {
25            ops: EksOps::new(client),
26        }
27    }
28
29    /// Returns descriptive information about an Amazon EKS cluster.
30    pub async fn describe_cluster(&self, name: &str) -> Result<DescribeClusterResponse> {
31        self.ops.describe_cluster(name).await
32    }
33
34    /// Lists the managed node groups associated with the specified cluster.
35    pub async fn list_nodegroups(
36        &self,
37        name: &str,
38        max_results: &str,
39        next_token: &str,
40    ) -> Result<ListNodegroupsResponse> {
41        self.ops
42            .list_nodegroups(name, max_results, next_token)
43            .await
44    }
45
46    /// Returns descriptive information about an Amazon EKS node group.
47    pub async fn describe_nodegroup(
48        &self,
49        name: &str,
50        nodegroup_name: &str,
51    ) -> Result<DescribeNodegroupResponse> {
52        self.ops.describe_nodegroup(name, nodegroup_name).await
53    }
54
55    /// Updates an Amazon EKS managed node group configuration.
56    pub async fn update_nodegroup_config(
57        &self,
58        name: &str,
59        nodegroup_name: &str,
60        body: &UpdateNodegroupConfigRequest,
61    ) -> Result<UpdateNodegroupConfigResponse> {
62        self.ops
63            .update_nodegroup_config(name, nodegroup_name, body)
64            .await
65    }
66}