fixing sqlserver controller struct
@@ -48,6 +48,7 @@ type AzureSqlServerReconciler struct {
Recorder record.EventRecorder
Scheme *runtime.Scheme
ResourceClient sql.ResourceClient
+ AzureSqlServerManager sql.AzureSqlServerManager
}
// Constants
@@ -211,7 +212,7 @@ func (r *AzureSqlServerReconciler) reconcileExternal(instance *azurev1alpha1.Azu
// create the sql server
instance.Status.Provisioning = true
- if _, err := r.ResourceClient.CreateOrUpdateSQLServer(ctx, groupName, location, name, azureSqlServerProperties); err != nil {
+ if _, err := r.AzureSqlServerManager.CreateOrUpdateSQLServer(ctx, groupName, location, name, azureSqlServerProperties); err != nil {
if !strings.Contains(err.Error(), "not complete") {
msg := fmt.Sprintf("CreateOrUpdateSQLServer not complete: %v", err)
instance.Status.Message = msg
@@ -248,7 +249,7 @@ func (r *AzureSqlServerReconciler) verifyExternal(ctx context.Context, instance
name := instance.ObjectMeta.Name
groupName := instance.Spec.ResourceGroup
- serv, err := r.ResourceClient.GetServer(ctx, groupName, name)
+ serv, err := r.AzureSqlServerManager.GetServer(ctx, groupName, name)
if err != nil {
azerr := errhelp.NewAzureErrorAzureError(err)
if azerr.Type != errhelp.ResourceNotFound {
@@ -275,7 +276,7 @@ func (r *AzureSqlServerReconciler) deleteExternal(ctx context.Context, instance
name := instance.ObjectMeta.Name
groupName := instance.Spec.ResourceGroup
- _, err := r.ResourceClient.DeleteSQLServer(ctx, groupName, name)
+ _, err := r.AzureSqlServerManager.DeleteSQLServer(ctx, groupName, name)
if err != nil {
msg := fmt.Sprintf("Couldn't delete resource in Azure: %v", err)
instance.Status.Message = msg
