Unverified Commit a7bba453 authored by Marc Bowes's avatar Marc Bowes Committed by GitHub
Browse files

Add qldb, qldbsession and small examples (#324)

* Add qldb, qldbsession and small examples

'Qldb' is an AWS database service. There are two webservices: qldb and
qldbsession. The former has APIs like Create, List and DeleteLedger. The
later is the dataplane API (like connecting to MySQL or Postgres).

QldbSession really has only 1 API, called "send command". A command is
something like "start a session", or "here is some sql".

The 'QldbSession' example isn't very useful, as customers would never
actually use the underlying API. Rather, they would use something like
the driver: https://github.com/awslabs/amazon-qldb-driver-rust

.

The 'Qldb' is a simple list-ledgers example, similar to what's found for
other services.

* Update aws/sdk/examples/qldb-list-ledgers/src/main.rs

Co-authored-by: default avatarMarc Bowes <bowes@amazon.com>
Co-authored-by: default avatarRussell Cohen <rcoh@amazon.com>
parent aaaf97e9
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
[package]
name = "qldb-helloworld"
version = "0.1.0"
authors = ["Russell Cohen <rcoh@amazon.com>"]
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
qldb = { package = "aws-sdk-qldb", path = "../../build/aws-sdk/qldb" }
### To use native TLS:
# dynamodb = { package = "aws-sdk-qldb", path = "../../build/aws-sdk/qldb", default-features = false, features = ["native-tls"] }

tokio = { version = "1", features = ["full"] }

# used only for static endpoint configuration:
http = "0.2.3"

# used only to enable basic logging:
env_logger = "0.8.2"
+2 −0
Original line number Diff line number Diff line
# Qldb List Ledgers World Example
This example show how to use the SDK to list existing ledgers.
+22 −0
Original line number Diff line number Diff line
/*
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * SPDX-License-Identifier: Apache-2.0.
 */

#[tokio::main]
async fn main() -> Result<(), qldb::Error> {
    let client = qldb::Client::from_env();
    let result = client.list_ledgers().send().await?;

    if let Some(ledgers) = result.ledgers {
        for ledger in ledgers {
            println!("* {:?}", ledger);
        }

        if result.next_token.is_some() {
            todo!("pagination is not yet demonstrated")
        }
    }

    Ok(())
}
+20 −0
Original line number Diff line number Diff line
[package]
name = "qldbsession-helloworld"
version = "0.1.0"
authors = ["Russell Cohen <rcoh@amazon.com>"]
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
qldbsession = { package = "aws-sdk-qldbsession", path = "../../build/aws-sdk/qldbsession" }
### To use native TLS:
# dynamodb = { package = "aws-sdk-qldbsession", path = "../../build/aws-sdk/qldbsession", default-features = false, features = ["native-tls"] }

tokio = { version = "1", features = ["full"] }

# used only for static endpoint configuration:
http = "0.2.3"

# used only to enable basic logging:
env_logger = "0.8.2"
+4 −0
Original line number Diff line number Diff line
# QldbSession Hello World Example
This repo has a simple hello-world example for QldbSession that will start a session. 

The QldbSession API is not intended for raw usage. Rather, a higher-level "driver" such as the Amazon QLDB Driver for Rust should be used.
Loading