Skip to content

Commit

Permalink
feat(core): Update Resource Mapping delete to use get before delete f…
Browse files Browse the repository at this point in the history
…or cli output (#398)

Due to changes made in opentdf/platform#1422 to
only return an object with the ID for delete operations, we need to
update the otdfctl Resource Mapping delete operation to make a Get
request from the DB before deletion of the record. The object returned
from the Get is then used for the user-friendly CLI output of the whole
object.
  • Loading branch information
ryanulit authored Oct 2, 2024
1 parent c7eafb9 commit 79f2a42
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cmd/policy-resourceMappings.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,12 @@ func policy_deleteResourceMapping(cmd *cobra.Command, args []string) {
cli.ConfirmAction(cli.ActionDelete, "resource-mapping", id, false)
}

resourceMapping, err := h.DeleteResourceMapping(id)
resourceMapping, err := h.GetResourceMapping(id)
if err != nil {
cli.ExitWithError(fmt.Sprintf("Failed to get resource mapping for delete (%s)", id), err)
}

_, err = h.DeleteResourceMapping(id)
if err != nil {
cli.ExitWithError(fmt.Sprintf("Failed to delete resource mapping (%s)", id), err)
}
Expand Down

0 comments on commit 79f2a42

Please sign in to comment.