-
Notifications
You must be signed in to change notification settings - Fork 80
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
bucket notifications - adapt to xml conversion #8745
Conversation
00e30b7
to
049f4fc
Compare
049f4fc
to
a0cfb98
Compare
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.
just a suggestion of how we typically build these xml results from js objects with a more functional style.
we use _.map(arr, fn) just because it won't fail if the array is undefined, while for arr.map(fn) will fail, but if you prefer you can also just do (arr || []).map(fn).
const topics = await req.object_sdk.get_bucket_notification({
bucket_name: req.params.bucket,
});
return {
NotificationConfiguration: _.map(topics, t => ({
TopicConfiguration: [
{
Id: t.id,
Topic: t.topic,
},
_.map(t.event, e => ({
Event: e
}))
]
}))
};
a0cfb98
to
4e7f954
Compare
//adapt to structure that xml_utils.encode_xml() will then | ||
//encode into aws compliant reply | ||
return { | ||
NotificationConfiguration: [_.map(result, t => ({ |
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.
no need to wrap the map with [] because it always returns an array
NotificationConfiguration: [_.map(result, t => ({ | |
NotificationConfiguration: _.map(result, t => ({ |
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.
approved, just one minor comment
Signed-off-by: Amit Prinz Setter <[email protected]>
4e7f954
to
8503196
Compare
Signed-off-by: Amit Prinz Setter <[email protected]>
Explain the changes
Issues: Fixed #xxx / Gap #xxx
Testing Instructions: