Skip to content

Commit

Permalink
Remove unnecessary calls of loadPlanNameAndVersion
Browse files Browse the repository at this point in the history
  • Loading branch information
Henrique Santos committed Sep 21, 2023
1 parent 562d0e1 commit df889d4
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 84 deletions.
14 changes: 0 additions & 14 deletions stackit/services/logme/instance/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,13 +279,6 @@ func (r *instanceResource) Create(ctx context.Context, req resource.CreateReques
return
}

// Compute and store values not present in the API response
err = loadPlanNameAndVersion(ctx, r.client, &model)
if err != nil {
core.LogAndAddError(ctx, &resp.Diagnostics, "Error reading instance", fmt.Sprintf("Loading service plan details: %v", err))
return
}

// Set state to fully populated data
diags = resp.State.Set(ctx, model)
resp.Diagnostics.Append(diags...)
Expand Down Expand Up @@ -395,13 +388,6 @@ func (r *instanceResource) Update(ctx context.Context, req resource.UpdateReques
return
}

// Compute and store values not present in the API response
err = loadPlanNameAndVersion(ctx, r.client, &model)
if err != nil {
core.LogAndAddError(ctx, &resp.Diagnostics, "Error reading instance", fmt.Sprintf("Loading service plan details: %v", err))
return
}

diags = resp.State.Set(ctx, model)
resp.Diagnostics.Append(diags...)
if resp.Diagnostics.HasError() {
Expand Down
14 changes: 0 additions & 14 deletions stackit/services/mariadb/instance/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,13 +279,6 @@ func (r *instanceResource) Create(ctx context.Context, req resource.CreateReques
return
}

// Compute and store values not present in the API response
err = loadPlanNameAndVersion(ctx, r.client, &model)
if err != nil {
core.LogAndAddError(ctx, &resp.Diagnostics, "Error reading instance", fmt.Sprintf("Loading service plan details: %v", err))
return
}

// Set state to fully populated data
diags = resp.State.Set(ctx, model)
resp.Diagnostics.Append(diags...)
Expand Down Expand Up @@ -395,13 +388,6 @@ func (r *instanceResource) Update(ctx context.Context, req resource.UpdateReques
return
}

// Compute and store values not present in the API response
err = loadPlanNameAndVersion(ctx, r.client, &model)
if err != nil {
core.LogAndAddError(ctx, &resp.Diagnostics, "Error reading instance", fmt.Sprintf("Loading service plan details: %v", err))
return
}

diags = resp.State.Set(ctx, model)
resp.Diagnostics.Append(diags...)
if resp.Diagnostics.HasError() {
Expand Down
14 changes: 0 additions & 14 deletions stackit/services/opensearch/instance/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,13 +279,6 @@ func (r *instanceResource) Create(ctx context.Context, req resource.CreateReques
return
}

// Compute and store values not present in the API response
err = loadPlanNameAndVersion(ctx, r.client, &model)
if err != nil {
core.LogAndAddError(ctx, &resp.Diagnostics, "Error reading instance", fmt.Sprintf("Loading service plan details: %v", err))
return
}

// Set state to fully populated data
diags = resp.State.Set(ctx, model)
resp.Diagnostics.Append(diags...)
Expand Down Expand Up @@ -395,13 +388,6 @@ func (r *instanceResource) Update(ctx context.Context, req resource.UpdateReques
return
}

// Compute and store values not present in the API response
err = loadPlanNameAndVersion(ctx, r.client, &model)
if err != nil {
core.LogAndAddError(ctx, &resp.Diagnostics, "Error reading instance", fmt.Sprintf("Loading service plan details: %v", err))
return
}

diags = resp.State.Set(ctx, model)
resp.Diagnostics.Append(diags...)
if resp.Diagnostics.HasError() {
Expand Down
14 changes: 0 additions & 14 deletions stackit/services/postgresql/instance/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,13 +320,6 @@ func (r *instanceResource) Create(ctx context.Context, req resource.CreateReques
return
}

// Compute and store values not present in the API response
err = loadPlanNameAndVersion(ctx, r.client, &model)
if err != nil {
core.LogAndAddError(ctx, &resp.Diagnostics, "Error reading instance", fmt.Sprintf("Loading service plan details: %v", err))
return
}

// Set state to fully populated data
diags = resp.State.Set(ctx, model)
resp.Diagnostics.Append(diags...)
Expand Down Expand Up @@ -472,13 +465,6 @@ func (r *instanceResource) Update(ctx context.Context, req resource.UpdateReques
return
}

// Compute and store values not present in the API response
err = loadPlanNameAndVersion(ctx, r.client, &model)
if err != nil {
core.LogAndAddError(ctx, &resp.Diagnostics, "Error reading instance", fmt.Sprintf("Loading service plan details: %v", err))
return
}

diags = resp.State.Set(ctx, model)
resp.Diagnostics.Append(diags...)
if resp.Diagnostics.HasError() {
Expand Down
14 changes: 0 additions & 14 deletions stackit/services/rabbitmq/instance/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,13 +279,6 @@ func (r *instanceResource) Create(ctx context.Context, req resource.CreateReques
return
}

// Compute and store values not present in the API response
err = loadPlanNameAndVersion(ctx, r.client, &model)
if err != nil {
core.LogAndAddError(ctx, &resp.Diagnostics, "Error reading instance", fmt.Sprintf("Loading service plan details: %v", err))
return
}

// Set state to fully populated data
diags = resp.State.Set(ctx, model)
resp.Diagnostics.Append(diags...)
Expand Down Expand Up @@ -395,13 +388,6 @@ func (r *instanceResource) Update(ctx context.Context, req resource.UpdateReques
return
}

// Compute and store values not present in the API response
err = loadPlanNameAndVersion(ctx, r.client, &model)
if err != nil {
core.LogAndAddError(ctx, &resp.Diagnostics, "Error reading instance", fmt.Sprintf("Loading service plan details: %v", err))
return
}

diags = resp.State.Set(ctx, model)
resp.Diagnostics.Append(diags...)
if resp.Diagnostics.HasError() {
Expand Down
14 changes: 0 additions & 14 deletions stackit/services/redis/instance/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,13 +279,6 @@ func (r *instanceResource) Create(ctx context.Context, req resource.CreateReques
return
}

// Compute and store values not present in the API response
err = loadPlanNameAndVersion(ctx, r.client, &model)
if err != nil {
core.LogAndAddError(ctx, &resp.Diagnostics, "Error reading instance", fmt.Sprintf("Loading service plan details: %v", err))
return
}

// Set state to fully populated data
diags = resp.State.Set(ctx, model)
resp.Diagnostics.Append(diags...)
Expand Down Expand Up @@ -395,13 +388,6 @@ func (r *instanceResource) Update(ctx context.Context, req resource.UpdateReques
return
}

// Compute and store values not present in the API response
err = loadPlanNameAndVersion(ctx, r.client, &model)
if err != nil {
core.LogAndAddError(ctx, &resp.Diagnostics, "Error reading instance", fmt.Sprintf("Loading service plan details: %v", err))
return
}

diags = resp.State.Set(ctx, model)
resp.Diagnostics.Append(diags...)
if resp.Diagnostics.HasError() {
Expand Down

0 comments on commit df889d4

Please sign in to comment.