2024-02-05 13:02:45 +00:00
|
|
|
use aws_sdk_s3::config::BehaviorVersion;
|
2023-05-05 20:18:29 +00:00
|
|
|
use aws_sdk_s3::config::Credentials;
|
|
|
|
use aws_sdk_s3::{Client, Config};
|
2022-02-02 14:35:52 +00:00
|
|
|
|
2023-05-05 20:18:29 +00:00
|
|
|
use super::garage::Key;
|
|
|
|
use crate::common::garage::DEFAULT_PORT;
|
2022-02-02 14:35:52 +00:00
|
|
|
|
2023-05-05 20:18:29 +00:00
|
|
|
pub fn build_client(key: &Key) -> Client {
|
2023-03-13 14:03:54 +00:00
|
|
|
let credentials = Credentials::new(&key.id, &key.secret, None, None, "garage-integ-test");
|
2022-02-02 14:35:52 +00:00
|
|
|
|
|
|
|
let config = Config::builder()
|
2023-05-05 20:18:29 +00:00
|
|
|
.endpoint_url(format!("http://127.0.0.1:{}", DEFAULT_PORT))
|
2022-02-02 14:35:52 +00:00
|
|
|
.region(super::REGION)
|
|
|
|
.credentials_provider(credentials)
|
2024-02-05 13:02:45 +00:00
|
|
|
.behavior_version(BehaviorVersion::v2023_11_09())
|
2022-02-02 14:35:52 +00:00
|
|
|
.build();
|
|
|
|
|
|
|
|
Client::from_conf(config)
|
|
|
|
}
|