drivers/azure/azureutil/azureutil.go
func deleteResourceIfExists(resourceType, name string, getFunc func() error, deleteFunc func() (autorest.Response, error)) error {
	f := logutil.Fields{"name": name}
	log.Debug(fmt.Sprintf("Querying if %s exists.", resourceType), f)
	if exists, err := checkResourceExistsFromError(getFunc()); err != nil {
		return err
	} else if !exists {
		log.Info(fmt.Sprintf("%s does not exist. Skipping.", resourceType), f)
		return nil
	}
	log.Info(fmt.Sprintf("Removing %s resource.", resourceType), f)
	_, err := deleteFunc()
	return err
}
func deleteResourceIfExists(resourceType, name string, getFunc func() error, deleteFunc func() (autorest.Response, error)) error {
	f := logutil.Fields{"name": name}
	log.Debug(fmt.Sprintf("Querying if %s exists.", resourceType), f)
	if exists, err := checkResourceExistsFromError(getFunc()); err != nil {
		return err
	} else if !exists {
		log.Info(fmt.Sprintf("%s does not exist. Skipping.", resourceType), f)
		return nil
	}
	log.Info(fmt.Sprintf("Removing %s resource.", resourceType), f)
	_, err := deleteFunc()
	return err
}
func deleteResourceIfExists ( resourceType , name string , getFunc func ( ) error , deleteFunc func ( ) ( autorest . Response , error ) ) error { f := logutil . Fields { " " : name } log . Debug ( fmt . Sprintf ( " " , resourceType ) , f ) if exists , err := checkResourceExistsFromError ( getFunc ( ) ) ; err != nil { return err } else if ! exists { log . Info ( fmt . Sprintf ( " " , resourceType ) , f ) return nil } log . Info ( fmt . Sprintf ( " " , resourceType ) , f ) _ , err := deleteFunc ( ) return err }
// deleteResourceIfExists is an utility method to determine if a resource exists
// from the error returned from its Get response. If so, deletes it. name is
// used only for logging purposes.
deleteResourceIfExists is an utility method to determine if a resource exists from the error returned from its Get response . If so deletes it . name is used only for logging purposes .