added new s3 params

This commit is contained in:
veeso
2022-03-05 11:06:14 +01:00
committed by Christian Visintin
parent c5eba4b56a
commit f28dba7660
13 changed files with 101 additions and 42 deletions
+2 -1
View File
@@ -227,11 +227,12 @@ impl AuthActivity {
fn load_bookmark_s3_into_gui(&mut self, params: AwsS3Params) {
self.mount_s3_bucket(params.bucket_name.as_str());
self.mount_s3_region(params.region.as_str());
self.mount_s3_region(params.region.as_deref().unwrap_or(""));
self.mount_s3_profile(params.profile.as_deref().unwrap_or(""));
self.mount_s3_access_key(params.access_key.as_deref().unwrap_or(""));
self.mount_s3_secret_access_key(params.secret_access_key.as_deref().unwrap_or(""));
self.mount_s3_security_token(params.security_token.as_deref().unwrap_or(""));
self.mount_s3_session_token(params.session_token.as_deref().unwrap_or(""));
// TODO: add mount
}
}
-3
View File
@@ -88,9 +88,6 @@ impl AuthActivity {
if params.bucket_name.is_empty() {
return Err("Invalid bucket");
}
if params.region.is_empty() {
return Err("Invalid region");
}
Ok(FileTransferParams {
protocol: FileTransferProtocol::AwsS3,
params: ProtocolParams::AwsS3(params),
+11 -6
View File
@@ -726,12 +726,13 @@ impl AuthActivity {
/// Collect s3 input values from view
pub(super) fn get_s3_params_input(&self) -> AwsS3Params {
let bucket: String = self.get_input_s3_bucket();
let region: String = self.get_input_s3_region();
let region: Option<String> = self.get_input_s3_region();
let profile: Option<String> = self.get_input_s3_profile();
let access_key = self.get_input_s3_access_key();
let secret_access_key = self.get_input_s3_secret_access_key();
let security_token = self.get_input_s3_security_token();
let session_token = self.get_input_s3_session_token();
// TODO: collect
AwsS3Params::new(bucket, region, profile)
.access_key(access_key)
.secret_access_key(secret_access_key)
@@ -777,10 +778,10 @@ impl AuthActivity {
}
}
pub(super) fn get_input_s3_region(&self) -> String {
pub(super) fn get_input_s3_region(&self) -> Option<String> {
match self.app.state(&Id::S3Region) {
Ok(State::One(StateValue::String(x))) => x,
_ => String::new(),
Ok(State::One(StateValue::String(x))) if !x.is_empty() => Some(x),
_ => None,
}
}
@@ -863,8 +864,12 @@ impl AuthActivity {
None => String::default(),
};
format!(
"{}://{} ({}) {}",
protocol, s3.bucket_name, s3.region, profile
"{}://{}{} ({}) {}",
protocol,
s3.endpoint.unwrap_or_default(),
s3.bucket_name,
s3.region.as_deref().unwrap_or("custom"),
profile
)
}
ProtocolParams::Generic(params) => {