@@ -46,15 +46,16 @@ func CreateLoadBalancerWaitHandler(ctx context.Context, a loadbalancer.DefaultAP
4646}
4747
4848// DeleteLoadBalancerWaitHandler will wait for load balancer deletion
49- func DeleteLoadBalancerWaitHandler (ctx context.Context , a loadbalancer.DefaultAPI , projectId , region , instanceId string ) * wait.AsyncActionHandler [struct {} ] {
50- waitConfig := wait.WaiterHelper [struct {} , string ]{
51- FetchInstance : func () ( * struct {}, error ) {
52- _ , err := a . GetLoadBalancer ( ctx , projectId , region , instanceId ). Execute ()
53- return & struct {}{}, err
54- },
55- GetState : func ( _ * struct {}) ( string , error ) {
56- return "" , nil
49+ func DeleteLoadBalancerWaitHandler (ctx context.Context , a loadbalancer.DefaultAPI , projectId , region , instanceId string ) * wait.AsyncActionHandler [loadbalancer. LoadBalancer ] {
50+ waitConfig := wait.WaiterHelper [loadbalancer. LoadBalancer , string ]{
51+ FetchInstance : a . GetLoadBalancer ( ctx , projectId , region , instanceId ). Execute ,
52+ GetState : func ( l * loadbalancer. LoadBalancer ) ( string , error ) {
53+ if l == nil || l . Status == nil {
54+ return "" , errors . New ( "response or status is nil" )
55+ }
56+ return * l . Status , nil
5757 },
58+ ErrorState : []string {LOADBALANCERSTATUS_ERROR },
5859 }
5960 handler := wait .New (waitConfig .Wait ())
6061 handler .SetTimeout (15 * time .Minute )
0 commit comments