Skip to content

Commit 2e2bac7

Browse files
authored
chore(resources): Add missing return statements (#26)
1 parent 2c1ce6a commit 2e2bac7

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

internal/provider/connection.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ func (r *ConnectionResource) Delete(ctx context.Context, req resource.DeleteRequ
192192
_, err = resource_model.WaitUntilConnectionStatus(waitForConnectionStatusCtx, r.client, state.ConnectionID.ValueString(), dfcloud.ConnectionStatusDeleted)
193193
if err != nil {
194194
resp.Diagnostics.AddError("failed to wait for connection", err.Error())
195+
return
195196
}
196197
}
197198

internal/provider/datastore.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,10 +278,12 @@ func (r *datastoreResource) Update(ctx context.Context, req resource.UpdateReque
278278
respDatastore, err := r.client.GetDatastore(ctx, state.ID.ValueString())
279279
if err != nil {
280280
resp.Diagnostics.AddError("Error Updating Datastore", err.Error())
281+
return
281282
}
282283

283284
if respDatastore.Status == dfcloud.DatastoreStatusUpdating || respDatastore.Status == dfcloud.DatastoreStatusPending || respDatastore.Status == dfcloud.DatastoreStatusDeleting {
284285
resp.Diagnostics.AddError("Error Reading Datastore", "Datastore is not active")
286+
return
285287
}
286288

287289
var plan resource_model.Datastore

internal/provider/network.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ func (r *NetworkResource) Configure(ctx context.Context, req resource.ConfigureR
100100
client, ok := req.ProviderData.(*dfcloud.Client)
101101
if !ok {
102102
resp.Diagnostics.AddError("failed to get provider", "failed to get provider")
103+
return
103104
}
104105

105106
r.client = client
@@ -110,6 +111,7 @@ func (r *NetworkResource) Create(ctx context.Context, req resource.CreateRequest
110111
resp.Diagnostics.Append(req.Plan.Get(ctx, &state)...)
111112
if resp.Diagnostics.HasError() {
112113
resp.Diagnostics.AddError("failed to get plan into state", "failed to get plan into state")
114+
return
113115
}
114116

115117
networkConfig := resource_model.IntoNetworkConfig(state)
@@ -190,6 +192,7 @@ func (r *NetworkResource) Delete(ctx context.Context, req resource.DeleteRequest
190192
_, err = resource_model.WaitUntilNetworkStatus(waitForNetworkStatusCtx, r.client, state.Id.ValueString(), dfcloud.NetworkStatusDeleted)
191193
if err != nil {
192194
resp.Diagnostics.AddError("failed to wait for network deletion", err.Error())
195+
return
193196
}
194197
}
195198

0 commit comments

Comments
 (0)