client: VolumeListResult: define local type

The `VolumeListResult.Items` field was a `volume.ListResponse`, which
in itself also had two slices (for volumes, and warnings). The Volumes
field contained a slice of pointers to Volumes.

This patch:

- Re-defines `ImageRemoveResult` as a distinct type, containing the
  content of the `volume.ListResponse.Volumes` and `.Warnings`.
- The `VolumeListResult` doesn't use a pointer for the volumes to make
  it slightly easier to deal with (possibly the API type could be
  changed as well, which could allow us to simplify the client code.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2025-10-24 11:55:05 +02:00
parent c246639baa
commit c6a45784f9
6 changed files with 55 additions and 16 deletions

View File

@@ -130,7 +130,7 @@ func deleteAllVolumes(ctx context.Context, t testing.TB, c client.VolumeAPIClien
res, err := c.VolumeList(ctx, client.VolumeListOptions{})
assert.Check(t, err, "failed to list volumes")
for _, v := range res.Items.Volumes {
for _, v := range res.Items {
if _, ok := protectedVolumes[v.Name]; ok {
continue
}

View File

@@ -231,7 +231,7 @@ func getExistingVolumes(ctx context.Context, t testing.TB, testEnv *Execution) [
assert.NilError(t, err, "failed to list volumes")
var volumes []string
for _, vol := range res.Items.Volumes {
for _, vol := range res.Items {
volumes = append(volumes, vol.Name)
}
return volumes