1use crate::{ImageThumbs, ThumbsResult, model::Params};
2use object_store::gcp::{GoogleCloudStorage, GoogleCloudStorageBuilder};
3use std::sync::Arc;
4use tokio::sync::RwLock;
5
6impl ImageThumbs<GoogleCloudStorage> {
7 #[doc = include_str!("../examples/image_thumbs.yaml")]
16 pub fn new(config: &str) -> ThumbsResult<Self> {
21 let client = GoogleCloudStorageBuilder::from_env()
22 .with_client_options(Self::client_options())
23 .build()?;
24
25 Ok(Self {
26 client: Arc::new(RwLock::new(client)),
27 settings: Arc::new(Self::settings(config)?),
28 })
29 }
30
31 pub fn new_with_settings(settings: Vec<Params>) -> ThumbsResult<Self> {
32 let client = GoogleCloudStorageBuilder::from_env()
33 .with_client_options(Self::client_options())
34 .build()?;
35
36 Ok(Self {
37 client: Arc::new(RwLock::new(client)),
38 settings: Arc::new(settings),
39 })
40 }
41}