-
Notifications
You must be signed in to change notification settings - Fork 31
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
Infer XML namespace using connectHost #96
Conversation
src/Network/Minio/Data.hs
Outdated
, connectAccessKey = "" | ||
, connectSecretKey = "" | ||
, connectIsSecure = True | ||
, connectSvcNamespace = "http://doc.s3.amazonaws.com/2006-03-01" |
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.
This looks like a bug in GCS, why do you need to enforce namespace? @krisis can we not unmarshal/marshal without it?
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.
Even if we have no way to avoid it, I would prefer to avoid providing this as part of connectInfo since this is clearly a bug in GCS and they should fix it. So for such a reason we could simply handle this internally based on the connectHost variable pointing to GCS.
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.
@donatello @harshavardhana so, should I check if `connectHost == "storage.googleapis.com" and use a different xml namespace?
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.
Yes, this seems to be a good way.
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.
Done
src/Network/Minio/Data.hs
Outdated
, connectAccessKey = "" | ||
, connectSecretKey = "" | ||
, connectIsSecure = True | ||
, connectSvcNamespace = "http://doc.s3.amazonaws.com/2006-03-01" |
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.
Yes, this seems to be a good way.
While GCS is S3 v4 compatible, it uses a different xml namespace url than AWS (and Minio).
There are some buidl warnings:
|
That would be my mistake data AdminErrJSON = AdminErrJSON { aeCode :: Text
, aeMessage :: Text
} deriving (Eq, Show)
instance FromJSON AdminErrJSON where
parseJSON = withObject "AdminErrJSON" $ \v -> AdminErrJSON
<$> v .: "Code"
<*> v .: "Message"
parseErrResponseJSON :: (MonadIO m) => LByteString -> m ServiceErr
parseErrResponseJSON jsondata =
case eitherDecode jsondata of
Right (AdminErrJSON code message) -> return $ toServiceErr code message
Left err -> throwIO $ MErrVJsonParse $ T.pack err Since we didn't use the aeCode it complains, is there a way to turn this off? |
While GCS is S3 v4 compatible, it uses a different xml namespace url
than AWS (and Minio).