diff --git a/internal/cf/client.go b/internal/cf/client.go index 6ca06e7..0cdf175 100644 --- a/internal/cf/client.go +++ b/internal/cf/client.go @@ -408,8 +408,8 @@ func (c *organizationClient) populateSpaces(ctx context.Context) error { waitGroup.Add(1) go func(cfSpace *cfresource.Space) { defer waitGroup.Done() - if binding, err := InitSpace(cfSpace, ""); err == nil { - c.resourceCache.addSpaceInCache(*cfSpace.Metadata.Labels[labelOwner], binding) + if space, err := c.InitSpace(cfSpace, ""); err == nil { + c.resourceCache.addSpaceInCache(*cfSpace.Metadata.Labels[labelOwner], space) } else { log.Printf("Error initializing space: %s", err) } diff --git a/internal/cf/space.go b/internal/cf/space.go index 9859d0f..f8147a3 100644 --- a/internal/cf/space.go +++ b/internal/cf/space.go @@ -44,7 +44,7 @@ func (c *organizationClient) GetSpace(ctx context.Context, owner string) (*facad space := spaces[0] // TODO: add directly to cache - return InitSpace(space, owner) + return c.InitSpace(space, owner) } // Required parameters (may not be initial): name, owner, generation @@ -168,7 +168,7 @@ func (c *organizationClient) AddManager(ctx context.Context, guid string, userna } // InitSpace wraps cfclient.Space as a facade.Space -func InitSpace(space *cfresource.Space, owner string) (*facade.Space, error) { +func (c *organizationClient) InitSpace(space *cfresource.Space, owner string) (*facade.Space, error) { guid := space.GUID name := space.Name generation, err := strconv.ParseInt(*space.Metadata.Annotations[annotationGeneration], 10, 64)