-
Notifications
You must be signed in to change notification settings - Fork 107
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
Ems event collection refresh #105
Changes from all commits
2fff138
4580c11
17865c7
3bf18a0
2d8ed9e
0dcfd49
8768acb
463b461
9c9273b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
class ManageIQ::Providers::Amazon::Inventory::EmsEventCollection | ||
attr_accessor :targets | ||
|
||
def initialize(targets) | ||
@targets = targets | ||
end | ||
|
||
def all_related_ems_events(ems) | ||
# We want all EmsEvents around the time of collected EmsEvents, and to the future since AWS send all related events | ||
# at once | ||
EmsEvent.where(:ems_id => ems.id).where(:timestamp => datetime_min..DateTime::Infinity.new).order("timestamp DESC") | ||
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. Is there any nicer way for checking 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. yes, using arel_table |
||
end | ||
|
||
def datetime_min | ||
targets.collect(&:timestamp).min - 3.minutes | ||
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. I suggest adding a comment why 3 mins are used here. 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. it's a first draft condition to find related events, usually the similar events should have a CloudTrail id, but it's not true for some reason, when deploying through stack. |
||
end | ||
|
||
def name | ||
"Collection of EmsEvent targets with name: #{targets.collect(&:name)}" | ||
end | ||
|
||
def id | ||
"Collection of EmsEvent targets with id: #{targets.collect(&:id)}" | ||
end | ||
end |
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.
Here is where we'll have to populate other refresh parsers as well?
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.
Events are going only through a cloud manager now, so no need.
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.
Ah, yeah, sorry, I answered to something else it seems. Yes. In here, it should parse all data, if this was an event based refresh.