Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[discuss] Don't generate shortcuts for list functions #935

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions openapi/code/method.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
10 changes: 9 additions & 1 deletion service/compute/library_utilities.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the only place where we explicitly use shortcut?

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,
Expand Down