Skip to content

Commit

Permalink
feat(acme): implement account deletion
Browse files Browse the repository at this point in the history
Signed-off-by: Björn Brauer <zaubernerd@zaubernerd.de>
  • Loading branch information
ZauberNerd committed Jul 26, 2024
1 parent ece854f commit bb484f1
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions fwprovider/acme/resource_acme_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,23 @@ func (r *acmeAccountResource) Update(ctx context.Context, req resource.UpdateReq

// Delete removes an existing ACME account from the Proxmox cluster.
func (r *acmeAccountResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) {
var state acmeAccountModel

resp.Diagnostics.Append(req.State.Get(ctx, &state)...)

if resp.Diagnostics.HasError() {
return
}

err := r.client.Delete(ctx, state.Name.ValueString())
if err != nil {
resp.Diagnostics.AddError(
fmt.Sprintf("Unable to delete ACME account '%s'", state.Name),
err.Error(),
)

return
}
}

// ImportState retrieves the current state of an existing ACME account from the Proxmox cluster.
Expand Down

0 comments on commit bb484f1

Please sign in to comment.