terraform-provider-google/google/spanner_instance_operation.go
The Magician 738bdb9aac Initial autogeneration of Spanner instance in Terraform. (#2892)
Signed-off-by: Modular Magician <magic-modules@google.com>
2019-01-22 12:35:59 -08:00

29 lines
714 B
Go

package google
import (
"google.golang.org/api/spanner/v1"
)
type SpannerInstanceOperationWaiter struct {
Service *spanner.Service
CommonOperationWaiter
}
func (w *SpannerInstanceOperationWaiter) QueryOp() (interface{}, error) {
return w.Service.Projects.Instances.Operations.Get(w.Op.Name).Do()
}
func spannerOperationWaitTime(spanner *spanner.Service, op *spanner.Operation, _ string, activity string, timeoutMinutes int) error {
if op.Name == "" {
// This was a synchronous call - there is no operation to wait for.
return nil
}
w := &SpannerInstanceOperationWaiter{
Service: spanner,
}
if err := w.SetOp(op); err != nil {
return err
}
return OperationWait(w, activity, timeoutMinutes)
}