From 515ea4cc8023fddddd77eb1b2de6a8b89a91d459 Mon Sep 17 00:00:00 2001 From: Pieter Noordhuis Date: Mon, 3 Jun 2024 11:16:39 +0200 Subject: [PATCH] Don't generate shortcuts for list functions --- openapi/code/method.go | 5 +++++ service/compute/library_utilities.go | 10 +++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/openapi/code/method.go b/openapi/code/method.go index 02ef11c71..9b02ac326 100644 --- a/openapi/code/method.go +++ b/openapi/code/method.go @@ -128,6 +128,11 @@ func (m *Method) allowShortcut() bool { if m.shortcut { return true } + // We do not generate proper pagination (e.g. iterators) for shortcuts, + // so don't emit shortcuts if we have pagination. + if m.pagination != nil { + return false + } if m.PathStyle == openapi.PathStyleRpc { return true } diff --git a/service/compute/library_utilities.go b/service/compute/library_utilities.go index 9babc7537..edaeeee71 100644 --- a/service/compute/library_utilities.go +++ b/service/compute/library_utilities.go @@ -183,11 +183,19 @@ func (a *LibrariesAPI) Wait(ctx context.Context, wait Wait, o(&i) } result, err := retries.Poll(ctx, i.Timeout, func() (*ClusterLibraryStatuses, *retries.Err) { - status, err := a.ClusterStatusByClusterId(ctx, wait.ClusterID) + all, err := a.ClusterStatusAll(ctx, ClusterStatus{ClusterId: wait.ClusterID}) if apierr.IsMissing(err) { // eventual consistency error return nil, retries.Continue(err) } + // Synthesize object. This function was written when the waiters were + // still using the retries.* API. This approach has since been changed + // to return waiter objects directly, but this function hasn't been + // updated yet. This is a temporary workaround. + status := &ClusterLibraryStatuses{ + ClusterId: wait.ClusterID, + LibraryStatuses: all, + } for _, o := range options { o(&retries.Info[ClusterLibraryStatuses]{ Timeout: i.Timeout,