2017-07-26 20:37:59 +00:00
|
|
|
package google
|
|
|
|
|
|
|
|
import (
|
|
|
|
computeBeta "google.golang.org/api/compute/v0.beta"
|
|
|
|
"google.golang.org/api/compute/v1"
|
|
|
|
)
|
|
|
|
|
2017-10-13 22:36:03 +00:00
|
|
|
func computeSharedOperationWait(client *compute.Service, op interface{}, project string, activity string) error {
|
|
|
|
return computeSharedOperationWaitTime(client, op, project, 4, activity)
|
2017-08-04 17:15:51 +00:00
|
|
|
}
|
|
|
|
|
2017-10-13 22:36:03 +00:00
|
|
|
func computeSharedOperationWaitTime(client *compute.Service, op interface{}, project string, minutes int, activity string) error {
|
2017-08-04 17:15:51 +00:00
|
|
|
if op == nil {
|
|
|
|
panic("Attempted to wait on an Operation that was nil.")
|
|
|
|
}
|
|
|
|
|
|
|
|
switch op.(type) {
|
|
|
|
case *compute.Operation:
|
2017-10-13 22:36:03 +00:00
|
|
|
return computeOperationWaitTime(client, op.(*compute.Operation), project, activity, minutes)
|
2017-08-04 17:15:51 +00:00
|
|
|
case *computeBeta.Operation:
|
2017-10-13 22:36:03 +00:00
|
|
|
return computeBetaOperationWaitTime(client, op.(*computeBeta.Operation), project, activity, minutes)
|
2017-08-04 17:15:51 +00:00
|
|
|
default:
|
|
|
|
panic("Attempted to wait on an Operation of unknown type.")
|
|
|
|
}
|
|
|
|
}
|