Skip to content

Commit

Permalink
revert un-needed phone number unassignAll diff
Browse files Browse the repository at this point in the history
  • Loading branch information
krrrr38 committed Aug 25, 2024
1 parent 68b051e commit 997a0cd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,19 @@ func (c *crud) unassign(ctx context.Context, dto *unassignDto) error {
}
return nil
}

func (c *crud) unassignAll(ctx context.Context, callQueueID types.String) error {
err := c.client.UnassignAPhoneNumCallQueue(ctx, zoomphone.UnassignAPhoneNumCallQueueParams{
CallQueueId: callQueueID.ValueString(),
})
if err != nil {
var status *zoomphone.ErrorResponseStatusCode
if errors.As(err, &status) {
if status.StatusCode == 404 {
return nil
}
}
return fmt.Errorf("error unassigning all phone call queue phone numbers: %v", err)
}
return nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -292,13 +292,7 @@ func (r *tfResource) Delete(ctx context.Context, req resource.DeleteRequest, res
return
}

err = r.crud.unassign(ctx, &unassignDto{
callQueueID: state.CallQueueID,
phoneNumberIDs: lo.Map(asis.phoneNumbers, func(p *readDtoPhoneNumber, _index int) types.String {
return p.id
}),
})
if err != nil {
if err := r.crud.unassignAll(ctx, state.CallQueueID); err != nil {
resp.Diagnostics.AddError(
"Error deleting phone call queue phone numbers",
fmt.Sprintf(
Expand Down

0 comments on commit 997a0cd

Please sign in to comment.