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