-
Notifications
You must be signed in to change notification settings - Fork 822
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consistently use GCP XML API #4207
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
9dc1299
Consistently use GCP XML API
tustvold f64c35a
Use updated fake-gcs-server
tustvold f91e0df
Merge remote-tracking branch 'upstream/master' into gcp-xml-api
tustvold 46e5baf
Merge remote-tracking branch 'upstream/master' into gcp-xml-api
tustvold b0ef4fd
Review feedback
tustvold File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
|
@@ -18,20 +18,20 @@ | |
use crate::aws::checksum::Checksum; | ||
use crate::aws::credential::{AwsCredential, CredentialExt, CredentialProvider}; | ||
use crate::aws::{STORE, STRICT_PATH_ENCODE_SET}; | ||
use crate::client::list::ListResponse; | ||
use crate::client::pagination::stream_paginated; | ||
use crate::client::retry::RetryExt; | ||
use crate::client::GetOptionsExt; | ||
use crate::multipart::UploadPart; | ||
use crate::path::DELIMITER; | ||
use crate::util::format_prefix; | ||
use crate::{ | ||
BoxStream, ClientOptions, GetOptions, ListResult, MultipartId, ObjectMeta, Path, | ||
Result, RetryConfig, StreamExt, | ||
BoxStream, ClientOptions, GetOptions, ListResult, MultipartId, Path, Result, | ||
RetryConfig, StreamExt, | ||
}; | ||
use base64::prelude::BASE64_STANDARD; | ||
use base64::Engine; | ||
use bytes::{Buf, Bytes}; | ||
use chrono::{DateTime, Utc}; | ||
use percent_encoding::{utf8_percent_encode, PercentEncode}; | ||
use reqwest::{header::CONTENT_TYPE, Client as ReqwestClient, Method, Response}; | ||
use serde::{Deserialize, Serialize}; | ||
|
@@ -109,69 +109,6 @@ impl From<Error> for crate::Error { | |
} | ||
} | ||
|
||
#[derive(Debug, Deserialize)] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is just moved into list.rs so it can be shared with the gcs implementation |
||
#[serde(rename_all = "PascalCase")] | ||
pub struct ListResponse { | ||
#[serde(default)] | ||
pub contents: Vec<ListContents>, | ||
#[serde(default)] | ||
pub common_prefixes: Vec<ListPrefix>, | ||
#[serde(default)] | ||
pub next_continuation_token: Option<String>, | ||
} | ||
|
||
impl TryFrom<ListResponse> for ListResult { | ||
type Error = crate::Error; | ||
|
||
fn try_from(value: ListResponse) -> Result<Self> { | ||
let common_prefixes = value | ||
.common_prefixes | ||
.into_iter() | ||
.map(|x| Ok(Path::parse(x.prefix)?)) | ||
.collect::<Result<_>>()?; | ||
|
||
let objects = value | ||
.contents | ||
.into_iter() | ||
.map(TryFrom::try_from) | ||
.collect::<Result<_>>()?; | ||
|
||
Ok(Self { | ||
common_prefixes, | ||
objects, | ||
}) | ||
} | ||
} | ||
|
||
#[derive(Debug, Deserialize)] | ||
#[serde(rename_all = "PascalCase")] | ||
pub struct ListPrefix { | ||
pub prefix: String, | ||
} | ||
|
||
#[derive(Debug, Deserialize)] | ||
#[serde(rename_all = "PascalCase")] | ||
pub struct ListContents { | ||
pub key: String, | ||
pub size: usize, | ||
pub last_modified: DateTime<Utc>, | ||
#[serde(rename = "ETag")] | ||
pub e_tag: Option<String>, | ||
} | ||
|
||
impl TryFrom<ListContents> for ObjectMeta { | ||
type Error = crate::Error; | ||
|
||
fn try_from(value: ListContents) -> Result<Self> { | ||
Ok(Self { | ||
location: Path::parse(value.key)?, | ||
last_modified: value.last_modified, | ||
size: value.size, | ||
e_tag: value.e_tag, | ||
}) | ||
} | ||
} | ||
|
||
#[derive(Debug, Deserialize)] | ||
#[serde(rename_all = "PascalCase")] | ||
struct InitiateMultipart { | ||
|
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fsouza/fake-gcs-server#1164
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we please leave a link to that PR as a comment (so we now we can update it back when it is accepted upstream)?