Skip to content

Commit

Permalink
Update desktop endpoint list functions (#4876)
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Quandt <[email protected]>
  • Loading branch information
thquad authored and richard-cox committed Apr 16, 2021
1 parent ac80cfa commit b1ab2e7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
10 changes: 8 additions & 2 deletions src/jetstream/plugins/desktop/endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,17 @@ func (d *DesktopEndpointStore) FindByAPIEndpoint(endpoint string, encryptionKey
}

func (d *DesktopEndpointStore) ListByAPIEndpoint(endpoint string, encryptionKey []byte) ([]*interfaces.CNSIRecord, error) {
return d.store.ListByAPIEndpoint(endpoint, encryptionKey)
local, err := ListCloudFoundry()
db, err := d.store.ListByAPIEndpoint(endpoint, encryptionKey)
merged := mergeEndpoints(db, local)
return merged, err
}

func (d *DesktopEndpointStore) ListByCreator(userGUID string, encryptionKey []byte) ([]*interfaces.CNSIRecord, error) {
return d.store.ListByCreator(userGUID, encryptionKey)
local, err := ListCloudFoundry()
db, err := d.store.ListByCreator(userGUID, encryptionKey)
merged := mergeEndpoints(db, local)
return merged, err
}

func (d *DesktopEndpointStore) Delete(guid string) error {
Expand Down
10 changes: 8 additions & 2 deletions src/jetstream/plugins/desktop/kubernetes/endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,17 @@ func (d *EndpointStore) FindByAPIEndpoint(endpoint string, encryptionKey []byte)
}

func (d *EndpointStore) ListByAPIEndpoint(endpoint string, encryptionKey []byte) ([]*interfaces.CNSIRecord, error) {
return d.store.ListByAPIEndpoint(endpoint, encryptionKey)
local, _, err := ListKubernetes()
db, err := d.store.ListByAPIEndpoint(endpoint, encryptionKey)
merged := mergeEndpoints(db, local)
return merged, err
}

func (d *EndpointStore) ListByCreator(userGUID string, encryptionKey []byte) ([]*interfaces.CNSIRecord, error) {
return d.store.ListByCreator(userGUID, encryptionKey)
local, _, err := ListKubernetes()
db, err := d.store.ListByCreator(userGUID, encryptionKey)
merged := mergeEndpoints(db, local)
return merged, err
}

func (d *EndpointStore) Delete(guid string) error {
Expand Down

0 comments on commit b1ab2e7

Please sign in to comment.