Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #132 from alexeiakimov/111-expose-astra-authentica…
…tion 111 expose astra authentication
- Loading branch information
Showing
6 changed files
with
69 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
use cassandra_cpp::*; | ||
use std::env; | ||
|
||
fn main() { | ||
let args: Vec<String> = env::args().collect(); | ||
if args.len() < 4 { | ||
eprintln!( | ||
"Usage: {} <secure connect bundle zip> <username> <password>", | ||
args[0] | ||
); | ||
return; | ||
} | ||
|
||
let secure_connection_bundle = &args[1]; | ||
let username = &args[2]; | ||
let password = &args[3]; | ||
|
||
let mut cluster = Cluster::default(); | ||
cluster | ||
.set_cloud_secure_connection_bundle(secure_connection_bundle) | ||
.unwrap(); | ||
cluster.set_credentials(username, password).unwrap(); | ||
|
||
let session = cluster.connect().unwrap(); | ||
let statement = stmt!("SELECT release_version FROM system.local"); | ||
let result = session.execute(&statement).wait().unwrap(); | ||
let row = result.first_row().unwrap(); | ||
let version: String = row.get_by_name("release_version").unwrap(); | ||
println!("release_version: {}", version); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters