Modify resourcemanager API to be more consistent with compute API. (#1454)

This commit is contained in:
Nathan McKinley 2018-05-08 15:49:57 -07:00 committed by GitHub
parent a4079aec8a
commit 11c8a52d35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 11 deletions

View File

@ -63,7 +63,7 @@ func resourceGoogleFolderCreate(d *schema.ResourceData, meta interface{}) error
return fmt.Errorf("Error creating folder '%s' in '%s': %s", displayName, parent, err)
}
err = resourceManagerV2Beta1OperationWait(config, op, "creating folder")
err = resourceManagerV2Beta1OperationWait(config.clientResourceManager, op, "creating folder")
if err != nil {
return fmt.Errorf("Error creating folder '%s' in '%s': %s", displayName, parent, err)
@ -132,7 +132,7 @@ func resourceGoogleFolderUpdate(d *schema.ResourceData, meta interface{}) error
return fmt.Errorf("Error moving folder '%s' to '%s': %s", displayName, newParent, err)
}
err = resourceManagerV2Beta1OperationWait(config, op, "move folder")
err = resourceManagerV2Beta1OperationWait(config.clientResourceManager, op, "move folder")
if err != nil {
return fmt.Errorf("Error moving folder '%s' to '%s': %s", displayName, newParent, err)
}

View File

@ -119,7 +119,7 @@ func resourceGoogleProjectCreate(d *schema.ResourceData, meta interface{}) error
d.SetId(pid)
// Wait for the operation to complete
waitErr := resourceManagerOperationWait(config, op, "project to create")
waitErr := resourceManagerOperationWait(config.clientResourceManager, op, "project to create")
if waitErr != nil {
// The resource wasn't actually created
d.SetId("")

View File

@ -37,13 +37,13 @@ func (w *ResourceManagerOperationWaiter) Conf() *resource.StateChangeConf {
}
}
func resourceManagerOperationWait(config *Config, op *cloudresourcemanager.Operation, activity string) error {
return resourceManagerOperationWaitTime(config, op, activity, 4)
func resourceManagerOperationWait(service *cloudresourcemanager.Service, op *cloudresourcemanager.Operation, activity string) error {
return resourceManagerOperationWaitTime(service, op, activity, 4)
}
func resourceManagerOperationWaitTime(config *Config, op *cloudresourcemanager.Operation, activity string, timeoutMin int) error {
func resourceManagerOperationWaitTime(service *cloudresourcemanager.Service, op *cloudresourcemanager.Operation, activity string, timeoutMin int) error {
w := &ResourceManagerOperationWaiter{
Service: config.clientResourceManager,
Service: service,
Op: op,
}
@ -64,16 +64,16 @@ func resourceManagerOperationWaitTime(config *Config, op *cloudresourcemanager.O
return nil
}
func resourceManagerV2Beta1OperationWait(config *Config, op *resourceManagerV2Beta1.Operation, activity string) error {
return resourceManagerV2Beta1OperationWaitTime(config, op, activity, 4)
func resourceManagerV2Beta1OperationWait(service *cloudresourcemanager.Service, op *resourceManagerV2Beta1.Operation, activity string) error {
return resourceManagerV2Beta1OperationWaitTime(service, op, activity, 4)
}
func resourceManagerV2Beta1OperationWaitTime(config *Config, op *resourceManagerV2Beta1.Operation, activity string, timeoutMin int) error {
func resourceManagerV2Beta1OperationWaitTime(service *cloudresourcemanager.Service, op *resourceManagerV2Beta1.Operation, activity string, timeoutMin int) error {
opV1 := &cloudresourcemanager.Operation{}
err := Convert(op, opV1)
if err != nil {
return err
}
return resourceManagerOperationWaitTime(config, opV1, activity, timeoutMin)
return resourceManagerOperationWaitTime(service, opV1, activity, timeoutMin)
}