Skip to content

Commit

Permalink
Add ToLibraryList() for ClusterStatusResponse (#906)
Browse files Browse the repository at this point in the history
## Changes
There are a few issues with the response types for libraries APIs today.
Recently, a breaking change was made in the return type of the
ClusterStatuses() API, changing from ClusterLibraryStatus to
ClusterStatusResponse. To unblock the release, I've implemented
ToLibraryList() on this new type.

As a follow-up, I will unify the ClusterLibraryStatuses and
ClusterStatusResponse structs into a single type and clean up any
duplication that is introduced by this PR.

## Tests
Using `replace` in the Terraform provider's `go.mod`, I made sure that
the TF provider's code still compiles after renaming
`ClusterLibraryStatus` to `ClusterStatusResponse`.

- [ ] `make test` passing
- [ ] `make fmt` applied
- [ ] relevant integration tests applied
  • Loading branch information
mgyucht authored May 2, 2024
1 parent c6516aa commit dae1642
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions service/compute/library_utilities.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,16 @@ func (cls ClusterLibraryStatuses) ToLibraryList() InstallLibraries {
return cll
}

// ToLibraryList convert to envity for convenient comparison
func (cls ClusterStatusResponse) ToLibraryList() InstallLibraries {
cll := InstallLibraries{ClusterId: cls.ClusterId}
for _, lib := range cls.LibraryStatuses {
cll.Libraries = append(cll.Libraries, *lib.Library)
}
cll.Sort()
return cll
}

func (w *Wait) IsNotInScope(lib *Library) bool {
// if we don't know concrete libraries
if len(w.Libraries) == 0 {
Expand Down

0 comments on commit dae1642

Please sign in to comment.