Skip to content
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

Ensure correct parsing of GetBucketLocation XML response #237

Merged
merged 2 commits into from
Oct 8, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions amazonka-s3/gen/Network/AWS/S3/GetBucketLocation.hs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ module Network.AWS.S3.GetBucketLocation
, getBucketLocationResponse
, GetBucketLocationResponse
-- * Response Lenses
, grsLocationConstraint
, grsResponseStatus
, grsLocationConstraint
) where

import Network.AWS.Prelude
Expand Down Expand Up @@ -72,7 +72,7 @@ instance AWSRequest GetBucketLocation where
= receiveXML
(\ s h x ->
GetBucketLocationResponse' <$>
(x .@? "LocationConstraint") <*> (pure (fromEnum s)))
(pure (fromEnum s)) <*> (parseXML x))

instance ToHeaders GetBucketLocation where
toHeaders = const mempty
Expand All @@ -86,30 +86,31 @@ instance ToQuery GetBucketLocation where

-- | /See:/ 'getBucketLocationResponse' smart constructor.
data GetBucketLocationResponse = GetBucketLocationResponse'
{ _grsLocationConstraint :: !(Maybe Region)
, _grsResponseStatus :: !Int
{ _grsResponseStatus :: !Int
, _grsLocationConstraint :: !Region
} deriving (Eq,Read,Show,Data,Typeable,Generic)

-- | Creates a value of 'GetBucketLocationResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'grsLocationConstraint'
--
-- * 'grsResponseStatus'
--
-- * 'grsLocationConstraint'
getBucketLocationResponse
:: Int -- ^ 'grsResponseStatus'
-> Region -- ^ 'grsLocationConstraint'
-> GetBucketLocationResponse
getBucketLocationResponse pResponseStatus_ =
getBucketLocationResponse pResponseStatus_ pLocationConstraint_ =
GetBucketLocationResponse'
{ _grsLocationConstraint = Nothing
, _grsResponseStatus = pResponseStatus_
{ _grsResponseStatus = pResponseStatus_
, _grsLocationConstraint = pLocationConstraint_
}

-- | Undocumented member.
grsLocationConstraint :: Lens' GetBucketLocationResponse (Maybe Region)
grsLocationConstraint = lens _grsLocationConstraint (\ s a -> s{_grsLocationConstraint = a});

-- | The response status code.
grsResponseStatus :: Lens' GetBucketLocationResponse Int
grsResponseStatus = lens _grsResponseStatus (\ s a -> s{_grsResponseStatus = a});

-- | Undocumented member.
grsLocationConstraint :: Lens' GetBucketLocationResponse Region
grsLocationConstraint = lens _grsLocationConstraint (\ s a -> s{_grsLocationConstraint = a});
7 changes: 7 additions & 0 deletions gen/annex/s3.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@
"REDUCED_REDUNDANCY",
"GLACIER"
]
},
"GetBucketLocationOutput": {
"required": [
"LocationConstraint"
],
"payload": "LocationConstraint"
}
}
}