eks-blueprints-rust-sdk

Crates.ioeks-blueprints-rust-sdk
lib.rseks-blueprints-rust-sdk
version0.1.2
sourcesrc
created_at2023-08-02 21:45:15.726097
updated_at2023-08-09 21:36:44.443779
descriptionRust client for EKS Blueprints gRPC API
homepagehttps://aws-quickstart.github.io/cdk-eks-blueprints/
repositoryhttps://github.com/zjaco13/multi-lang-eks-blueprints-cdk
max_upload_size
id933149
size65,505
Bhavye Sharma (Howlla)

documentation

https://aws-quickstart.github.io/cdk-eks-blueprints/

README

Rust Client for Multi Language EKS Blueprints for cdk

Run the example

To run the example, first start the server from https://github.com/aws-quickstart/cdk-eks-blueprints/tree/blueprints-api-support

git clone https://github.com/aws-quickstart/cdk-eks-blueprints.git
cd cdk-eks-blueprints
git checkout blueprints-api-support
make run-server

Then run the rust example by cloning this repository and running with make, cargo is required

git clone https://github.com/zjaco13/multi-lang-eks-blueprints-cdk.git
cd multi-lang-eks-blueprints-cdk
make rust-example

How to use as a package

Create a new rust project

cargo new example
cd example

Import the sdk and other dependencies

cargo add eks-blueprints-rust-sdk
cargo add tonic
cargo add tokio

Add this to a main.rs file

use multi_lang_eks_blueprints_rust_sdk::{
    builder::{self},
    codegen::{self, cluster_service_client::ClusterServiceClient},
};
use tonic::transport::Channel;

#[tokio::main]
async fn main() {
    builder::run(build).await.expect("Error in build");
}

async fn build(client: &mut ClusterServiceClient<Channel>) -> Result<(), tonic::Status> {
    ...
    Ok(())
}

Add function calls to the gRPC server in the build function to build your EKS Blueprint

Run the server

git clone https://github.com/aws-quickstart/cdk-eks-blueprints.git
cd cdk-eks-blueprints
git checkout blueprints-api-support
make run-server

Run your code

cargo run

From the server, deploy your EKS Blueprint

make deploy-server

Contributing

Publishing

Whenever changes are made to the protobufs, a new package will need to be released

To publish the package, first make an account on crates.io, and you must be added to the eks-blueprints-rust-sdk project

You will need an API Token. Once you have this token, use it to login locally with this command.

cargo login

Run this command to build and publish the rust sdk crate (NOTE: It is recommended to run cargo package first to ensure the .crate file isn’t over 10MB)

cargo publish

Changes to packaging and publishing can be made by editing the Cargo.toml file

Commit count: 40

cargo fmt