-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle GCP restore URI destination path correctly (#979)
Co-authored-by: Ian Stanton <ian@tembo.io>
- Loading branch information
1 parent
4ea4227
commit 3741105
Showing
6 changed files
with
209 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// Add this enum at the top of your file or in a separate module | ||
pub struct CloudProviderBuilder { | ||
gcp: bool, | ||
aws: bool, | ||
} | ||
|
||
impl CloudProviderBuilder { | ||
fn new() -> Self { | ||
CloudProviderBuilder { | ||
gcp: false, | ||
aws: false, | ||
} | ||
} | ||
|
||
pub fn gcp(mut self, value: bool) -> Self { | ||
self.gcp = value; | ||
self | ||
} | ||
|
||
pub fn aws(mut self, value: bool) -> Self { | ||
self.aws = value; | ||
self | ||
} | ||
|
||
pub fn build(self) -> CloudProvider { | ||
if self.gcp { | ||
CloudProvider::GCP | ||
} else if self.aws { | ||
CloudProvider::AWS | ||
} else { | ||
CloudProvider::Unknown | ||
} | ||
} | ||
} | ||
|
||
pub enum CloudProvider { | ||
AWS, | ||
GCP, | ||
Unknown, | ||
} | ||
|
||
impl CloudProvider { | ||
pub fn as_str(&self) -> &'static str { | ||
match self { | ||
CloudProvider::AWS => "aws", | ||
CloudProvider::GCP => "gcp", | ||
CloudProvider::Unknown => "unknown", | ||
} | ||
} | ||
|
||
pub fn prefix(&self) -> &'static str { | ||
match self { | ||
CloudProvider::AWS => "s3://", | ||
CloudProvider::GCP => "gs://", | ||
CloudProvider::Unknown => "", | ||
} | ||
} | ||
|
||
pub fn builder() -> CloudProviderBuilder { | ||
CloudProviderBuilder::new() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.