scylla-aws-keyspaces-authenticator

Crates.ioscylla-aws-keyspaces-authenticator
lib.rsscylla-aws-keyspaces-authenticator
version0.1.0
sourcesrc
created_at2022-12-17 18:02:17.451286
updated_at2022-12-17 18:02:17.451286
descriptionThis crate provides a simple to use AuthenticatorProvider implementation for scylla crate that works with AWS KeySpaces for Cassandra service.
homepagehttps://github.com/infr-dev/scylla-aws-keyspaces-authenticator
repositoryhttps://github.com/infr-dev/scylla-aws-keyspaces-authenticator
max_upload_size
id739979
size65,719
(infr-dev-bot)

documentation

README

scylla-aws-keyspaces-authenticator

This crate provides a simple to use AuthenticatorProvider implementation for scylla crate that works with AWS KeySpaces for Cassandra service.

Usage:

use scylla::SessionBuilder;
use scylla_aws_keyspaces_authenticator::AwsKeyspacesAuthenticator;
use openssl::ssl::*;

let config = aws_config::from_env().region("us-east-1").load().await;

// One-liner to enable AWS Sigv4 authentication for Scylla driver for Rust:
let authenticator = AwsKeyspacesAuthenticator::new(config);

// Some SSL setup
let mut ssl_context = SslContextBuilder::new(SslMethod::tls()).unwrap();
ssl_context.set_certificate_file("./examples/aws-keyspaces-cert.pem", SslFiletype::PEM).unwrap();
ssl_context.set_verify(SslVerifyMode::NONE);

// Create session
let session = SessionBuilder::new()
    .known_node("cassandra.us-east-1.amazonaws.com:9142")
    .authenticator_provider(authenticator)
    .ssl_context(Some(ssl_context.build()))
    .build()
    .await
    .unwrap();

// Run query
let results = session.query("SELECT * from example.example_table;", &[]).await.unwrap();
println!("{:?}", results);
Commit count: 1

cargo fmt