Crates.io | eks-blueprints-rust-sdk |
lib.rs | eks-blueprints-rust-sdk |
version | 0.1.2 |
source | src |
created_at | 2023-08-02 21:45:15.726097 |
updated_at | 2023-08-09 21:36:44.443779 |
description | Rust client for EKS Blueprints gRPC API |
homepage | https://aws-quickstart.github.io/cdk-eks-blueprints/ |
repository | https://github.com/zjaco13/multi-lang-eks-blueprints-cdk |
max_upload_size | |
id | 933149 |
size | 65,505 |
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
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
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