From 7409b2eb93243a8e58927d2c29cc2bb0b47bfb60 Mon Sep 17 00:00:00 2001 From: Tadayuki Onishi Date: Tue, 24 Dec 2024 17:30:57 +0900 Subject: [PATCH] Fix to edit call queue policy Signed-off-by: Tadayuki Onishi --- .../phone/callqueuepolicy/call_queue_policy_crud.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/internal/services/phone/callqueuepolicy/call_queue_policy_crud.go b/internal/services/phone/callqueuepolicy/call_queue_policy_crud.go index 5997d72..b732cc1 100644 --- a/internal/services/phone/callqueuepolicy/call_queue_policy_crud.go +++ b/internal/services/phone/callqueuepolicy/call_queue_policy_crud.go @@ -4,6 +4,7 @@ import ( "context" "errors" "fmt" + "github.com/folio-sec/terraform-provider-zoom/generated/api/zoomphone" "github.com/folio-sec/terraform-provider-zoom/internal/util" "github.com/hashicorp/terraform-plugin-framework/types" @@ -92,6 +93,12 @@ func (c *crud) update(ctx context.Context, dto *updateDto) error { } }) } + // Due to the patch API specifications, an error occurs as 'voicemail_access_members cannot be empty' with using emtpy list. + // Therefore, if the slice is empty, the function returns nil without performing any actions. + if len(voicemailAccessMembers) == 0 { + return nil + } + err := c.client.UpdateCQPolicySubSetting(ctx, zoomphone.OptUpdateCQPolicySubSettingReq{ Value: zoomphone.UpdateCQPolicySubSettingReq{ VoicemailAccessMembers: voicemailAccessMembers,