From 81393ae58bbc695dddc72a53d3b9f73a5b94dd0c Mon Sep 17 00:00:00 2001 From: Spencer Hance Date: Tue, 4 Feb 2020 17:58:02 -0800 Subject: [PATCH] Implement retry logic for List() Operations List() calls will retry until successful or the context is done. PageToken() is used to avoid re-trying successful pages. --- pkg/cloud/gen.go | 1680 +++++++++++++++++++++++++++++++++++------ pkg/cloud/gen/main.go | 26 +- 2 files changed, 1492 insertions(+), 214 deletions(-) diff --git a/pkg/cloud/gen.go b/pkg/cloud/gen.go index 8d9e481c..d0d88385 100644 --- a/pkg/cloud/gen.go +++ b/pkg/cloud/gen.go @@ -2631,14 +2631,32 @@ func (g *GCEAddresses) List(ctx context.Context, region string, fl *filter.F) ([ call.Filter(fl.String()) } var all []*ga.Address + var nextPageToken string f := func(l *ga.AddressList) error { klog.V(5).Infof("GCEAddresses.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEAddresses.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEAddresses call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEAddresses.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -3051,14 +3069,32 @@ func (g *GCEAlphaAddresses) List(ctx context.Context, region string, fl *filter. call.Filter(fl.String()) } var all []*alpha.Address + var nextPageToken string f := func(l *alpha.AddressList) error { klog.V(5).Infof("GCEAlphaAddresses.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEAlphaAddresses.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEAlphaAddresses call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEAlphaAddresses.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -3471,14 +3507,32 @@ func (g *GCEBetaAddresses) List(ctx context.Context, region string, fl *filter.F call.Filter(fl.String()) } var all []*beta.Address + var nextPageToken string f := func(l *beta.AddressList) error { klog.V(5).Infof("GCEBetaAddresses.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEBetaAddresses.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEBetaAddresses call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEBetaAddresses.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -3850,14 +3904,32 @@ func (g *GCEAlphaGlobalAddresses) List(ctx context.Context, fl *filter.F) ([]*al call.Filter(fl.String()) } var all []*alpha.Address + var nextPageToken string f := func(l *alpha.AddressList) error { klog.V(5).Infof("GCEAlphaGlobalAddresses.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEAlphaGlobalAddresses.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEAlphaGlobalAddresses call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEAlphaGlobalAddresses.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -4182,14 +4254,32 @@ func (g *GCEGlobalAddresses) List(ctx context.Context, fl *filter.F) ([]*ga.Addr call.Filter(fl.String()) } var all []*ga.Address + var nextPageToken string f := func(l *ga.AddressList) error { klog.V(5).Infof("GCEGlobalAddresses.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEGlobalAddresses.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEGlobalAddresses call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEGlobalAddresses.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -4544,14 +4634,32 @@ func (g *GCEBackendServices) List(ctx context.Context, fl *filter.F) ([]*ga.Back call.Filter(fl.String()) } var all []*ga.BackendService + var nextPageToken string f := func(l *ga.BackendServiceList) error { klog.V(5).Infof("GCEBackendServices.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEBackendServices.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEBackendServices call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEBackendServices.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -4990,14 +5098,32 @@ func (g *GCEBetaBackendServices) List(ctx context.Context, fl *filter.F) ([]*bet call.Filter(fl.String()) } var all []*beta.BackendService + var nextPageToken string f := func(l *beta.BackendServiceList) error { klog.V(5).Infof("GCEBetaBackendServices.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEBetaBackendServices.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEBetaBackendServices call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEBetaBackendServices.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -5408,14 +5534,32 @@ func (g *GCEAlphaBackendServices) List(ctx context.Context, fl *filter.F) ([]*al call.Filter(fl.String()) } var all []*alpha.BackendService + var nextPageToken string f := func(l *alpha.BackendServiceList) error { klog.V(5).Infof("GCEAlphaBackendServices.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEAlphaBackendServices.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEAlphaBackendServices call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEAlphaBackendServices.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -5829,14 +5973,32 @@ func (g *GCERegionBackendServices) List(ctx context.Context, region string, fl * call.Filter(fl.String()) } var all []*ga.BackendService + var nextPageToken string f := func(l *ga.BackendServiceList) error { klog.V(5).Infof("GCERegionBackendServices.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCERegionBackendServices.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCERegionBackendServices call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCERegionBackendServices.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -6244,14 +6406,32 @@ func (g *GCEAlphaRegionBackendServices) List(ctx context.Context, region string, call.Filter(fl.String()) } var all []*alpha.BackendService + var nextPageToken string f := func(l *alpha.BackendServiceList) error { klog.V(5).Infof("GCEAlphaRegionBackendServices.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEAlphaRegionBackendServices.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEAlphaRegionBackendServices call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEAlphaRegionBackendServices.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -6659,14 +6839,32 @@ func (g *GCEBetaRegionBackendServices) List(ctx context.Context, region string, call.Filter(fl.String()) } var all []*beta.BackendService + var nextPageToken string f := func(l *beta.BackendServiceList) error { klog.V(5).Infof("GCEBetaRegionBackendServices.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEBetaRegionBackendServices.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEBetaRegionBackendServices call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEBetaRegionBackendServices.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -7064,14 +7262,32 @@ func (g *GCEDisks) List(ctx context.Context, zone string, fl *filter.F) ([]*ga.D call.Filter(fl.String()) } var all []*ga.Disk + var nextPageToken string f := func(l *ga.DiskList) error { klog.V(5).Infof("GCEDisks.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEDisks.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEDisks call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEDisks.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -7441,14 +7657,32 @@ func (g *GCERegionDisks) List(ctx context.Context, region string, fl *filter.F) call.Filter(fl.String()) } var all []*ga.Disk + var nextPageToken string f := func(l *ga.DiskList) error { klog.V(5).Infof("GCERegionDisks.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCERegionDisks.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCERegionDisks call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCERegionDisks.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -7815,14 +8049,32 @@ func (g *GCEFirewalls) List(ctx context.Context, fl *filter.F) ([]*ga.Firewall, call.Filter(fl.String()) } var all []*ga.Firewall + var nextPageToken string f := func(l *ga.FirewallList) error { klog.V(5).Infof("GCEFirewalls.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEFirewalls.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEFirewalls call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEFirewalls.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -8193,14 +8445,32 @@ func (g *GCEForwardingRules) List(ctx context.Context, region string, fl *filter call.Filter(fl.String()) } var all []*ga.ForwardingRule + var nextPageToken string f := func(l *ga.ForwardingRuleList) error { klog.V(5).Infof("GCEForwardingRules.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEForwardingRules.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEForwardingRules call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEForwardingRules.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -8570,14 +8840,32 @@ func (g *GCEAlphaForwardingRules) List(ctx context.Context, region string, fl *f call.Filter(fl.String()) } var all []*alpha.ForwardingRule + var nextPageToken string f := func(l *alpha.ForwardingRuleList) error { klog.V(5).Infof("GCEAlphaForwardingRules.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEAlphaForwardingRules.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEAlphaForwardingRules call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEAlphaForwardingRules.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -8947,14 +9235,32 @@ func (g *GCEBetaForwardingRules) List(ctx context.Context, region string, fl *fi call.Filter(fl.String()) } var all []*beta.ForwardingRule + var nextPageToken string f := func(l *beta.ForwardingRuleList) error { klog.V(5).Infof("GCEBetaForwardingRules.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEBetaForwardingRules.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEBetaForwardingRules call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEBetaForwardingRules.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -9321,14 +9627,32 @@ func (g *GCEAlphaGlobalForwardingRules) List(ctx context.Context, fl *filter.F) call.Filter(fl.String()) } var all []*alpha.ForwardingRule + var nextPageToken string f := func(l *alpha.ForwardingRuleList) error { klog.V(5).Infof("GCEAlphaGlobalForwardingRules.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEAlphaGlobalForwardingRules.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEAlphaGlobalForwardingRules call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEAlphaGlobalForwardingRules.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -9696,14 +10020,32 @@ func (g *GCEBetaGlobalForwardingRules) List(ctx context.Context, fl *filter.F) ( call.Filter(fl.String()) } var all []*beta.ForwardingRule + var nextPageToken string f := func(l *beta.ForwardingRuleList) error { klog.V(5).Infof("GCEBetaGlobalForwardingRules.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEBetaGlobalForwardingRules.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEBetaGlobalForwardingRules call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEBetaGlobalForwardingRules.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -10071,14 +10413,32 @@ func (g *GCEGlobalForwardingRules) List(ctx context.Context, fl *filter.F) ([]*g call.Filter(fl.String()) } var all []*ga.ForwardingRule + var nextPageToken string f := func(l *ga.ForwardingRuleList) error { klog.V(5).Infof("GCEGlobalForwardingRules.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEGlobalForwardingRules.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEGlobalForwardingRules call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEGlobalForwardingRules.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -10446,14 +10806,32 @@ func (g *GCEHealthChecks) List(ctx context.Context, fl *filter.F) ([]*ga.HealthC call.Filter(fl.String()) } var all []*ga.HealthCheck + var nextPageToken string f := func(l *ga.HealthCheckList) error { klog.V(5).Infof("GCEHealthChecks.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEHealthChecks.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEHealthChecks call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEHealthChecks.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -10821,14 +11199,32 @@ func (g *GCEAlphaHealthChecks) List(ctx context.Context, fl *filter.F) ([]*alpha call.Filter(fl.String()) } var all []*alpha.HealthCheck + var nextPageToken string f := func(l *alpha.HealthCheckList) error { klog.V(5).Infof("GCEAlphaHealthChecks.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEAlphaHealthChecks.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEAlphaHealthChecks call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEAlphaHealthChecks.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -11196,14 +11592,32 @@ func (g *GCEBetaHealthChecks) List(ctx context.Context, fl *filter.F) ([]*beta.H call.Filter(fl.String()) } var all []*beta.HealthCheck + var nextPageToken string f := func(l *beta.HealthCheckList) error { klog.V(5).Infof("GCEBetaHealthChecks.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEBetaHealthChecks.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEBetaHealthChecks call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEBetaHealthChecks.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -11574,14 +11988,32 @@ func (g *GCEAlphaRegionHealthChecks) List(ctx context.Context, region string, fl call.Filter(fl.String()) } var all []*alpha.HealthCheck + var nextPageToken string f := func(l *alpha.HealthCheckList) error { klog.V(5).Infof("GCEAlphaRegionHealthChecks.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEAlphaRegionHealthChecks.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEAlphaRegionHealthChecks call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEAlphaRegionHealthChecks.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -11951,14 +12383,32 @@ func (g *GCEBetaRegionHealthChecks) List(ctx context.Context, region string, fl call.Filter(fl.String()) } var all []*beta.HealthCheck + var nextPageToken string f := func(l *beta.HealthCheckList) error { klog.V(5).Infof("GCEBetaRegionHealthChecks.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEBetaRegionHealthChecks.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEBetaRegionHealthChecks call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEBetaRegionHealthChecks.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -12328,14 +12778,32 @@ func (g *GCERegionHealthChecks) List(ctx context.Context, region string, fl *fil call.Filter(fl.String()) } var all []*ga.HealthCheck + var nextPageToken string f := func(l *ga.HealthCheckList) error { klog.V(5).Infof("GCERegionHealthChecks.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCERegionHealthChecks.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCERegionHealthChecks call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCERegionHealthChecks.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -12702,14 +13170,32 @@ func (g *GCEHttpHealthChecks) List(ctx context.Context, fl *filter.F) ([]*ga.Htt call.Filter(fl.String()) } var all []*ga.HttpHealthCheck + var nextPageToken string f := func(l *ga.HttpHealthCheckList) error { klog.V(5).Infof("GCEHttpHealthChecks.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEHttpHealthChecks.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEHttpHealthChecks call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEHttpHealthChecks.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -13077,14 +13563,32 @@ func (g *GCEHttpsHealthChecks) List(ctx context.Context, fl *filter.F) ([]*ga.Ht call.Filter(fl.String()) } var all []*ga.HttpsHealthCheck + var nextPageToken string f := func(l *ga.HttpsHealthCheckList) error { klog.V(5).Infof("GCEHttpsHealthChecks.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEHttpsHealthChecks.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEHttpsHealthChecks call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEHttpsHealthChecks.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -13485,14 +13989,32 @@ func (g *GCEInstanceGroups) List(ctx context.Context, zone string, fl *filter.F) call.Filter(fl.String()) } var all []*ga.InstanceGroup + var nextPageToken string f := func(l *ga.InstanceGroupList) error { klog.V(5).Infof("GCEInstanceGroups.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEInstanceGroups.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEInstanceGroups call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEInstanceGroups.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -13982,14 +14504,32 @@ func (g *GCEInstances) List(ctx context.Context, zone string, fl *filter.F) ([]* call.Filter(fl.String()) } var all []*ga.Instance + var nextPageToken string f := func(l *ga.InstanceList) error { klog.V(5).Infof("GCEInstances.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEInstances.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEInstances call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEInstances.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -14412,14 +14952,32 @@ func (g *GCEBetaInstances) List(ctx context.Context, zone string, fl *filter.F) call.Filter(fl.String()) } var all []*beta.Instance + var nextPageToken string f := func(l *beta.InstanceList) error { klog.V(5).Infof("GCEBetaInstances.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEBetaInstances.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEBetaInstances call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEBetaInstances.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -14875,14 +15433,32 @@ func (g *GCEAlphaInstances) List(ctx context.Context, zone string, fl *filter.F) call.Filter(fl.String()) } var all []*alpha.Instance + var nextPageToken string f := func(l *alpha.InstanceList) error { klog.V(5).Infof("GCEAlphaInstances.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEAlphaInstances.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEAlphaInstances call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEAlphaInstances.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -15305,14 +15881,32 @@ func (g *GCEAlphaNetworks) List(ctx context.Context, fl *filter.F) ([]*alpha.Net call.Filter(fl.String()) } var all []*alpha.Network + var nextPageToken string f := func(l *alpha.NetworkList) error { klog.V(5).Infof("GCEAlphaNetworks.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEAlphaNetworks.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEAlphaNetworks call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEAlphaNetworks.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -15637,14 +16231,32 @@ func (g *GCEBetaNetworks) List(ctx context.Context, fl *filter.F) ([]*beta.Netwo call.Filter(fl.String()) } var all []*beta.Network + var nextPageToken string f := func(l *beta.NetworkList) error { klog.V(5).Infof("GCEBetaNetworks.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEBetaNetworks.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEBetaNetworks call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEBetaNetworks.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -15969,14 +16581,32 @@ func (g *GCENetworks) List(ctx context.Context, fl *filter.F) ([]*ga.Network, er call.Filter(fl.String()) } var all []*ga.Network + var nextPageToken string f := func(l *ga.NetworkList) error { klog.V(5).Infof("GCENetworks.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCENetworks.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCENetworks call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCENetworks.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -16372,14 +17002,32 @@ func (g *GCEAlphaNetworkEndpointGroups) List(ctx context.Context, zone string, f call.Filter(fl.String()) } var all []*alpha.NetworkEndpointGroup + var nextPageToken string f := func(l *alpha.NetworkEndpointGroupList) error { klog.V(5).Infof("GCEAlphaNetworkEndpointGroups.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEAlphaNetworkEndpointGroups.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEAlphaNetworkEndpointGroups call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEAlphaNetworkEndpointGroups.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -16932,14 +17580,32 @@ func (g *GCEBetaNetworkEndpointGroups) List(ctx context.Context, zone string, fl call.Filter(fl.String()) } var all []*beta.NetworkEndpointGroup + var nextPageToken string f := func(l *beta.NetworkEndpointGroupList) error { klog.V(5).Infof("GCEBetaNetworkEndpointGroups.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEBetaNetworkEndpointGroups.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEBetaNetworkEndpointGroups call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEBetaNetworkEndpointGroups.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -17492,14 +18158,32 @@ func (g *GCENetworkEndpointGroups) List(ctx context.Context, zone string, fl *fi call.Filter(fl.String()) } var all []*ga.NetworkEndpointGroup + var nextPageToken string f := func(l *ga.NetworkEndpointGroupList) error { klog.V(5).Infof("GCENetworkEndpointGroups.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCENetworkEndpointGroups.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCENetworkEndpointGroups call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCENetworkEndpointGroups.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -17952,14 +18636,32 @@ func (g *GCERegions) List(ctx context.Context, fl *filter.F) ([]*ga.Region, erro call.Filter(fl.String()) } var all []*ga.Region + var nextPageToken string f := func(l *ga.RegionList) error { klog.V(5).Infof("GCERegions.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCERegions.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCERegions call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCERegions.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -18216,14 +18918,32 @@ func (g *GCERoutes) List(ctx context.Context, fl *filter.F) ([]*ga.Route, error) call.Filter(fl.String()) } var all []*ga.Route + var nextPageToken string f := func(l *ga.RouteList) error { klog.V(5).Infof("GCERoutes.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCERoutes.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCERoutes call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCERoutes.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -18598,14 +19318,32 @@ func (g *GCEBetaSecurityPolicies) List(ctx context.Context, fl *filter.F) ([]*be call.Filter(fl.String()) } var all []*beta.SecurityPolicy + var nextPageToken string f := func(l *beta.SecurityPolicyList) error { klog.V(5).Infof("GCEBetaSecurityPolicies.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEBetaSecurityPolicies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEBetaSecurityPolicies call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEBetaSecurityPolicies.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -19090,14 +19828,32 @@ func (g *GCESslCertificates) List(ctx context.Context, fl *filter.F) ([]*ga.SslC call.Filter(fl.String()) } var all []*ga.SslCertificate + var nextPageToken string f := func(l *ga.SslCertificateList) error { klog.V(5).Infof("GCESslCertificates.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCESslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCESslCertificates call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCESslCertificates.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -19422,14 +20178,32 @@ func (g *GCEBetaSslCertificates) List(ctx context.Context, fl *filter.F) ([]*bet call.Filter(fl.String()) } var all []*beta.SslCertificate + var nextPageToken string f := func(l *beta.SslCertificateList) error { klog.V(5).Infof("GCEBetaSslCertificates.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEBetaSslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEBetaSslCertificates call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEBetaSslCertificates.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -19754,14 +20528,32 @@ func (g *GCEAlphaSslCertificates) List(ctx context.Context, fl *filter.F) ([]*al call.Filter(fl.String()) } var all []*alpha.SslCertificate + var nextPageToken string f := func(l *alpha.SslCertificateList) error { klog.V(5).Infof("GCEAlphaSslCertificates.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEAlphaSslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEAlphaSslCertificates call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEAlphaSslCertificates.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -20089,14 +20881,32 @@ func (g *GCEAlphaRegionSslCertificates) List(ctx context.Context, region string, call.Filter(fl.String()) } var all []*alpha.SslCertificate + var nextPageToken string f := func(l *alpha.SslCertificateList) error { klog.V(5).Infof("GCEAlphaRegionSslCertificates.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEAlphaRegionSslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEAlphaRegionSslCertificates call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEAlphaRegionSslCertificates.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -20423,14 +21233,32 @@ func (g *GCEBetaRegionSslCertificates) List(ctx context.Context, region string, call.Filter(fl.String()) } var all []*beta.SslCertificate + var nextPageToken string f := func(l *beta.SslCertificateList) error { klog.V(5).Infof("GCEBetaRegionSslCertificates.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEBetaRegionSslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEBetaRegionSslCertificates call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEBetaRegionSslCertificates.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -20757,14 +21585,32 @@ func (g *GCERegionSslCertificates) List(ctx context.Context, region string, fl * call.Filter(fl.String()) } var all []*ga.SslCertificate + var nextPageToken string f := func(l *ga.SslCertificateList) error { klog.V(5).Infof("GCERegionSslCertificates.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCERegionSslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCERegionSslCertificates call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCERegionSslCertificates.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -21347,14 +22193,32 @@ func (g *GCEAlphaSubnetworks) List(ctx context.Context, region string, fl *filte call.Filter(fl.String()) } var all []*alpha.Subnetwork + var nextPageToken string f := func(l *alpha.SubnetworkList) error { klog.V(5).Infof("GCEAlphaSubnetworks.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEAlphaSubnetworks.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEAlphaSubnetworks call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEAlphaSubnetworks.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -21681,14 +22545,32 @@ func (g *GCEBetaSubnetworks) List(ctx context.Context, region string, fl *filter call.Filter(fl.String()) } var all []*beta.Subnetwork + var nextPageToken string f := func(l *beta.SubnetworkList) error { klog.V(5).Infof("GCEBetaSubnetworks.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEBetaSubnetworks.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEBetaSubnetworks call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEBetaSubnetworks.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -22015,14 +22897,32 @@ func (g *GCESubnetworks) List(ctx context.Context, region string, fl *filter.F) call.Filter(fl.String()) } var all []*ga.Subnetwork + var nextPageToken string f := func(l *ga.SubnetworkList) error { klog.V(5).Infof("GCESubnetworks.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCESubnetworks.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCESubnetworks call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCESubnetworks.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -22356,14 +23256,32 @@ func (g *GCEAlphaTargetHttpProxies) List(ctx context.Context, fl *filter.F) ([]* call.Filter(fl.String()) } var all []*alpha.TargetHttpProxy + var nextPageToken string f := func(l *alpha.TargetHttpProxyList) error { klog.V(5).Infof("GCEAlphaTargetHttpProxies.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEAlphaTargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEAlphaTargetHttpProxies call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEAlphaTargetHttpProxies.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -22731,14 +23649,32 @@ func (g *GCEBetaTargetHttpProxies) List(ctx context.Context, fl *filter.F) ([]*b call.Filter(fl.String()) } var all []*beta.TargetHttpProxy + var nextPageToken string f := func(l *beta.TargetHttpProxyList) error { klog.V(5).Infof("GCEBetaTargetHttpProxies.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEBetaTargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEBetaTargetHttpProxies call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEBetaTargetHttpProxies.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -23106,14 +24042,32 @@ func (g *GCETargetHttpProxies) List(ctx context.Context, fl *filter.F) ([]*ga.Ta call.Filter(fl.String()) } var all []*ga.TargetHttpProxy + var nextPageToken string f := func(l *ga.TargetHttpProxyList) error { klog.V(5).Infof("GCETargetHttpProxies.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCETargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCETargetHttpProxies call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCETargetHttpProxies.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -23484,14 +24438,32 @@ func (g *GCEAlphaRegionTargetHttpProxies) List(ctx context.Context, region strin call.Filter(fl.String()) } var all []*alpha.TargetHttpProxy + var nextPageToken string f := func(l *alpha.TargetHttpProxyList) error { klog.V(5).Infof("GCEAlphaRegionTargetHttpProxies.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEAlphaRegionTargetHttpProxies call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -23861,14 +24833,32 @@ func (g *GCEBetaRegionTargetHttpProxies) List(ctx context.Context, region string call.Filter(fl.String()) } var all []*beta.TargetHttpProxy + var nextPageToken string f := func(l *beta.TargetHttpProxyList) error { klog.V(5).Infof("GCEBetaRegionTargetHttpProxies.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEBetaRegionTargetHttpProxies call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -24238,14 +25228,32 @@ func (g *GCERegionTargetHttpProxies) List(ctx context.Context, region string, fl call.Filter(fl.String()) } var all []*ga.TargetHttpProxy + var nextPageToken string f := func(l *ga.TargetHttpProxyList) error { klog.V(5).Infof("GCERegionTargetHttpProxies.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCERegionTargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCERegionTargetHttpProxies call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCERegionTargetHttpProxies.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -24632,14 +25640,32 @@ func (g *GCETargetHttpsProxies) List(ctx context.Context, fl *filter.F) ([]*ga.T call.Filter(fl.String()) } var all []*ga.TargetHttpsProxy + var nextPageToken string f := func(l *ga.TargetHttpsProxyList) error { klog.V(5).Infof("GCETargetHttpsProxies.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCETargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCETargetHttpsProxies call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCETargetHttpsProxies.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -25093,14 +26119,32 @@ func (g *GCEAlphaTargetHttpsProxies) List(ctx context.Context, fl *filter.F) ([] call.Filter(fl.String()) } var all []*alpha.TargetHttpsProxy + var nextPageToken string f := func(l *alpha.TargetHttpsProxyList) error { klog.V(5).Infof("GCEAlphaTargetHttpsProxies.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEAlphaTargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEAlphaTargetHttpsProxies call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEAlphaTargetHttpsProxies.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -25554,14 +26598,32 @@ func (g *GCEBetaTargetHttpsProxies) List(ctx context.Context, fl *filter.F) ([]* call.Filter(fl.String()) } var all []*beta.TargetHttpsProxy + var nextPageToken string f := func(l *beta.TargetHttpsProxyList) error { klog.V(5).Infof("GCEBetaTargetHttpsProxies.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEBetaTargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEBetaTargetHttpsProxies call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEBetaTargetHttpsProxies.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -26008,14 +27070,32 @@ func (g *GCEAlphaRegionTargetHttpsProxies) List(ctx context.Context, region stri call.Filter(fl.String()) } var all []*alpha.TargetHttpsProxy + var nextPageToken string f := func(l *alpha.TargetHttpsProxyList) error { klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -26428,14 +27508,32 @@ func (g *GCEBetaRegionTargetHttpsProxies) List(ctx context.Context, region strin call.Filter(fl.String()) } var all []*beta.TargetHttpsProxy + var nextPageToken string f := func(l *beta.TargetHttpsProxyList) error { klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -26848,14 +27946,32 @@ func (g *GCERegionTargetHttpsProxies) List(ctx context.Context, region string, f call.Filter(fl.String()) } var all []*ga.TargetHttpsProxy + var nextPageToken string f := func(l *ga.TargetHttpsProxyList) error { klog.V(5).Infof("GCERegionTargetHttpsProxies.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCERegionTargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCERegionTargetHttpsProxies call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCERegionTargetHttpsProxies.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -27268,14 +28384,32 @@ func (g *GCETargetPools) List(ctx context.Context, region string, fl *filter.F) call.Filter(fl.String()) } var all []*ga.TargetPool + var nextPageToken string f := func(l *ga.TargetPoolList) error { klog.V(5).Infof("GCETargetPools.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCETargetPools.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCETargetPools call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCETargetPools.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -27675,14 +28809,32 @@ func (g *GCEAlphaUrlMaps) List(ctx context.Context, fl *filter.F) ([]*alpha.UrlM call.Filter(fl.String()) } var all []*alpha.UrlMap + var nextPageToken string f := func(l *alpha.UrlMapList) error { klog.V(5).Infof("GCEAlphaUrlMaps.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEAlphaUrlMaps.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEAlphaUrlMaps call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEAlphaUrlMaps.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -28050,14 +29202,32 @@ func (g *GCEBetaUrlMaps) List(ctx context.Context, fl *filter.F) ([]*beta.UrlMap call.Filter(fl.String()) } var all []*beta.UrlMap + var nextPageToken string f := func(l *beta.UrlMapList) error { klog.V(5).Infof("GCEBetaUrlMaps.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEBetaUrlMaps.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEBetaUrlMaps call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEBetaUrlMaps.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -28425,14 +29595,32 @@ func (g *GCEUrlMaps) List(ctx context.Context, fl *filter.F) ([]*ga.UrlMap, erro call.Filter(fl.String()) } var all []*ga.UrlMap + var nextPageToken string f := func(l *ga.UrlMapList) error { klog.V(5).Infof("GCEUrlMaps.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEUrlMaps.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEUrlMaps call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEUrlMaps.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -28803,14 +29991,32 @@ func (g *GCEAlphaRegionUrlMaps) List(ctx context.Context, region string, fl *fil call.Filter(fl.String()) } var all []*alpha.UrlMap + var nextPageToken string f := func(l *alpha.UrlMapList) error { klog.V(5).Infof("GCEAlphaRegionUrlMaps.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEAlphaRegionUrlMaps.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEAlphaRegionUrlMaps call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEAlphaRegionUrlMaps.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -29180,14 +30386,32 @@ func (g *GCEBetaRegionUrlMaps) List(ctx context.Context, region string, fl *filt call.Filter(fl.String()) } var all []*beta.UrlMap + var nextPageToken string f := func(l *beta.UrlMapList) error { klog.V(5).Infof("GCEBetaRegionUrlMaps.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEBetaRegionUrlMaps.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEBetaRegionUrlMaps call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEBetaRegionUrlMaps.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -29557,14 +30781,32 @@ func (g *GCERegionUrlMaps) List(ctx context.Context, region string, fl *filter.F call.Filter(fl.String()) } var all []*ga.UrlMap + var nextPageToken string f := func(l *ga.UrlMapList) error { klog.V(5).Infof("GCERegionUrlMaps.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCERegionUrlMaps.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCERegionUrlMaps call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCERegionUrlMaps.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { @@ -29843,14 +31085,32 @@ func (g *GCEZones) List(ctx context.Context, fl *filter.F) ([]*ga.Zone, error) { call.Filter(fl.String()) } var all []*ga.Zone + var nextPageToken string f := func(l *ga.ZoneList) error { klog.V(5).Infof("GCEZones.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("GCEZones.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("GCEZones call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("GCEZones.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ } if klog.V(4) { diff --git a/pkg/cloud/gen/main.go b/pkg/cloud/gen/main.go index 5c1fd6e4..7e172f81 100644 --- a/pkg/cloud/gen/main.go +++ b/pkg/cloud/gen/main.go @@ -728,15 +728,33 @@ func (g *{{.GCEWrapType}}) List(ctx context.Context, zone string, fl *filter.F) call.Filter(fl.String()) } var all []*{{.FQObjectType}} + var nextPageToken string f := func(l *{{.ObjectListType}}) error { klog.V(5).Infof("{{.GCEWrapType}}.List(%v, ..., %v): page %+v", ctx, fl, l) + nextPageToken = l.NextPageToken all = append(all, l.Items...) return nil } - if err := call.Pages(ctx, f); err != nil { - klog.V(4).Infof("{{.GCEWrapType}}.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err - } + + var retryCount int + for { + select { + case <-ctx.Done(): + klog.V(5).Infof("{{.GCEWrapType}} call.Pages(%v, _) not completed, poll count = %d, ctx.Err = %v", ctx, retryCount, ctx.Err()) + return nil, ctx.Err() + default: + // ctx is not canceled, continue immediately + } + if nextPageToken != "" { + call.PageToken(nextPageToken) + } + if err := call.Pages(ctx, f); err != nil { + klog.V(4).Infof("{{.GCEWrapType}}.List(%v, ..., %v) = %v, %v, retrying...", ctx, fl, nil, err) + } else { + break + } + retryCount++ + } if klog.V(4) { klog.V(4).Infof("{{.GCEWrapType}}.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil)