3 个版本
0.1.2 | 2023 年 8 月 9 日 |
---|---|
0.1.1 | 2023 年 8 月 2 日 |
0.1.0 | 2023 年 8 月 2 日 |
#844 在 开发工具 中
36KB
738 行
Rust 客户端,用于多语言 EKS Blueprints for cdk
运行示例
要运行示例,首先从 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
然后通过克隆此仓库并使用 make 运行 rust 示例,需要 cargo
git clone https://github.com/zjaco13/multi-lang-eks-blueprints-cdk.git
cd multi-lang-eks-blueprints-cdk
make rust-example
作为包使用
创建一个新的 rust 项目
cargo new example
cd example
导入 sdk 和其他依赖项
cargo add eks-blueprints-rust-sdk
cargo add tonic
cargo add tokio
将以下内容添加到 main.rs
文件中
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(())
}
在构建函数中添加对 gRPC 服务器的函数调用以构建您的 EKS Blueprint
运行服务器
git clone https://github.com/aws-quickstart/cdk-eks-blueprints.git
cd cdk-eks-blueprints
git checkout blueprints-api-support
make run-server
运行您的代码
cargo run
从服务器部署您的 EKS Blueprint
make deploy-server
贡献
发布
每当对 protobuf 进行更改时,都需要发布新的包
要发布包,请首先在 crates.io 上创建账户,并且您必须被添加到 eks-blueprints-rust-sdk 项目
您需要一个 API 令牌。一旦您有了这个令牌,请使用以下命令在本地上传登录。
cargo login
运行此命令来构建和发布 rust sdk 包(注意:建议首先运行 .crate
确保文件不超过 10MB)
cargo publish
可以通过编辑 Cargo.toml
文件来更改打包和发布
依赖项
~5–7MB
~124K SLoC