Skip to content

Commit

Permalink
Changes per review
Browse files Browse the repository at this point in the history
  • Loading branch information
adamspd authored and gmllt committed Jun 18, 2024
1 parent 39012da commit 4773f2d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
10 changes: 1 addition & 9 deletions fetcher/fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ func (c *Fetcher) workInit() {
c.worker.PushIf("service_bindings", c.fetchServiceBindings, filters.ServiceBindings)
c.worker.PushIf("users", c.fetchUsers, filters.Events)
c.worker.PushIf("events", c.fetchEvents, filters.Events)
c.worker.PushIf("droplets", c.fetchDroplets, filters.Droplets)
}

func (c *Fetcher) fetch() *models.CFObjects {
Expand All @@ -95,15 +96,6 @@ func (c *Fetcher) fetch() *models.CFObjects {

c.workInit()

// Fetch and filter droplets
appDropletMap, err := c.fetchAndFilterDroplets(session)
if err != nil {
log.WithError(err).Error("unable to fetch and filter droplets")
result.Error = err
return result
}
result.AppDroplets = appDropletMap

result.Error = c.worker.Do(session, result)
return result
}
10 changes: 10 additions & 0 deletions fetcher/fetcher_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,16 @@ func (c *Fetcher) fetchAndFilterDroplets(session *SessionExt) (map[string]models
return appDropletMap, nil
}

func (c *Fetcher) fetchDroplets(session *SessionExt, result *models.CFObjects) error {
appDropletMap, err := c.fetchAndFilterDroplets(session)
if err != nil {
log.WithError(err).Error("unable to fetch and filter droplets")
return err
}
result.AppDroplets = appDropletMap
return nil
}

func (c *Fetcher) fetchProcesses(session *SessionExt, entry *models.CFObjects) error {
processes, _, err := session.V3().GetProcesses(LargeQuery)
if err != nil {
Expand Down
4 changes: 4 additions & 0 deletions filters/filters.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const (
Applications = "applications"
Buildpacks = "buildpacks"
Domains = "domains"
Droplets = "droplets"
Events = "events"
IsolationSegments = "isolationsegments"
Organizations = "organizations"
Expand All @@ -28,6 +29,7 @@ var (
Applications,
Buildpacks,
Domains,
Droplets,
Events,
IsolationSegments,
Organizations,
Expand All @@ -53,6 +55,7 @@ func NewFilter(active ...string) (*Filter, error) {
Applications: true,
Buildpacks: true,
Domains: true,
Droplets: true,
IsolationSegments: true,
Organizations: true,
Routes: true,
Expand Down Expand Up @@ -83,6 +86,7 @@ func (f *Filter) setActive(active []string) error {
Applications: false,
Buildpacks: false,
Domains: false,
Droplets: false,
IsolationSegments: false,
Organizations: false,
Routes: false,
Expand Down

0 comments on commit 4773f2d

Please sign in to comment.