terraform-provider-google/google/compute_shared_operation.go
Joe Selman 2765290724 Add label support to google_compute_snapshot (#570)
* Add label support to google_compute_snapshot
* Refactor operation polling code to use client directly
2017-10-13 15:36:03 -07:00

26 lines
868 B
Go

package google
import (
computeBeta "google.golang.org/api/compute/v0.beta"
"google.golang.org/api/compute/v1"
)
func computeSharedOperationWait(client *compute.Service, op interface{}, project string, activity string) error {
return computeSharedOperationWaitTime(client, op, project, 4, activity)
}
func computeSharedOperationWaitTime(client *compute.Service, op interface{}, project string, minutes int, activity string) error {
if op == nil {
panic("Attempted to wait on an Operation that was nil.")
}
switch op.(type) {
case *compute.Operation:
return computeOperationWaitTime(client, op.(*compute.Operation), project, activity, minutes)
case *computeBeta.Operation:
return computeBetaOperationWaitTime(client, op.(*computeBeta.Operation), project, activity, minutes)
default:
panic("Attempted to wait on an Operation of unknown type.")
}
}