mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-10-06 10:41:07 +00:00
cf489d4909
<!-- This change is generated by MagicModules. --> /cc @chrisst
34 lines
811 B
Go
34 lines
811 B
Go
package google
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"google.golang.org/api/spanner/v1"
|
|
)
|
|
|
|
type SpannerInstanceOperationWaiter struct {
|
|
Service *spanner.Service
|
|
CommonOperationWaiter
|
|
}
|
|
|
|
func (w *SpannerInstanceOperationWaiter) QueryOp() (interface{}, error) {
|
|
if w == nil {
|
|
return nil, fmt.Errorf("Cannot query operation, it's unset or nil.")
|
|
}
|
|
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)
|
|
}
|