Skip to content

Commit

Permalink
Merge pull request #29 from kpn-dsh/fix/api-examples-refer-to-new
Browse files Browse the repository at this point in the history
Fix deprecated API doc
  • Loading branch information
toelo3 authored Mar 6, 2024
2 parents a9cbd71 + dc4246c commit ed028d6
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 28 deletions.
9 changes: 3 additions & 6 deletions src/dsh/bootstrap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,9 @@
//! ## Example
//! ```
//! use dsh_sdk::dsh::Properties;
//! #
//! # #[tokio::main]
//! # async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let dsh_properties = Properties::new().await?;
//! # Ok(())
//! # }
//!
//! let dsh_properties = Properties::get();
//! ```
use log::{debug, info, warn};
use reqwest::blocking::Client;
Expand Down
14 changes: 6 additions & 8 deletions src/dsh/certificates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@
//! ```no_run
//! use dsh_sdk::dsh::Properties;
//! use std::path::PathBuf;
//! #
//! # #[tokio::main]
//! # async fn main() -> Result<(), Box<dyn std::error::Error>>{
//! let dsh_properties = Properties::new().await?;
//!
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let dsh_properties = Properties::get();
//! let directory = PathBuf::from("dir");
//! dsh_properties.certificates()?.to_files(&directory)?;
//! # Ok(())
Expand Down Expand Up @@ -145,10 +144,9 @@ impl Cert {
/// ```no_run
/// use dsh_sdk::dsh::Properties;
/// use std::path::PathBuf;
/// #
/// # #[tokio::main]
/// # async fn main() -> Result<(), Box<dyn std::error::Error>>{
/// let dsh_properties = Properties::new().await?;
///
/// # fn main() -> Result<(), Box<dyn std::error::Error>> {
/// let dsh_properties = Properties::get();
/// let directory = PathBuf::from("dir");
/// dsh_properties.certificates()?.to_files(&directory)?;
/// # Ok(())
Expand Down
19 changes: 9 additions & 10 deletions src/dsh/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@
//! use dsh_sdk::dsh::Properties;
//! use dsh_sdk::rdkafka::consumer::{Consumer, StreamConsumer};
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let dsh_properties = Properties::get();
//!
//! let consumer_config = dsh_properties.consumer_rdkafka_config()?;
//! let consumer: StreamConsumer = consumer_config.create()?;
//! # #[tokio::main]
//! # async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let dsh_properties = Properties::get();
//! let consumer_config = dsh_properties.consumer_rdkafka_config()?;
//! let consumer: StreamConsumer = consumer_config.create()?;
//!
//! Ok(())
//! }
//! # Ok(())
//! # }
//! ```
use log::{info, warn};
use std::env;
Expand Down Expand Up @@ -482,8 +481,8 @@ mod tests {
assert!(topics.is_err());
}

#[tokio::test]
async fn test_get_or_init() {
#[test]
fn test_get_or_init() {
let properties = Properties::get();
assert_eq!(properties.client_id(), "local_client_id");
assert_eq!(properties.task_id(), "local_task_id");
Expand Down
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
//!
//! # #[tokio::main]
//! # async fn main() -> Result<(), Box<dyn std::error::Error>>{
//! let dsh_properties = Properties::new().await?;
//! let dsh_properties = Properties::get();
//! let consumer: StreamConsumer = dsh_properties.consumer_rdkafka_config()?.create()?;
//! # Ok(())
//! # }
Expand All @@ -30,9 +30,9 @@
//! ```no_run
//! # use dsh_sdk::dsh::Properties;
//! # use dsh_sdk::rdkafka::consumer::stream_consumer::StreamConsumer;
//! # #[tokio::main]
//! # async fn main() -> Result<(), Box<dyn std::error::Error>>{
//! # let dsh_properties = Properties::new().await?;
//! # fn main() -> Result<(), Box<dyn std::error::Error>>{
//! # let dsh_properties = Properties::get();
//! // check for write access to topic
//! let write_access = dsh_properties.datastream().get_stream("scratch.local.local-tenant").expect("Topic not found").write_access();
//! // get the certificates, for example DSH_KAFKA_CERTIFICATE
Expand Down

0 comments on commit ed028d6

Please sign in to comment.