terraform-provider-google/google/composer_operation.go

30 lines
719 B
Go
Raw Normal View History

package google
import (
"fmt"
composer "google.golang.org/api/composer/v1beta1"
)
type ComposerOperationWaiter struct {
Service *composer.ProjectsLocationsService
2018-12-27 01:42:37 +00:00
CommonOperationWaiter
}
2018-12-27 01:42:37 +00:00
func (w *ComposerOperationWaiter) QueryOp() (interface{}, error) {
if w == nil {
return nil, fmt.Errorf("Cannot query operation, it's unset or nil.")
}
2018-12-27 01:42:37 +00:00
return w.Service.Operations.Get(w.Op.Name).Do()
}
2018-12-27 01:42:37 +00:00
func composerOperationWaitTime(service *composer.Service, op *composer.Operation, project, activity string, timeoutMinutes int) error {
w := &ComposerOperationWaiter{
Service: service.Projects.Locations,
}
2018-12-27 01:42:37 +00:00
if err := w.SetOp(op); err != nil {
return err
}
2018-12-27 01:42:37 +00:00
return OperationWait(w, activity, timeoutMinutes)
}