From ed9911e1dc11fd66808aed05dbb8b1b97f83b799 Mon Sep 17 00:00:00 2001 From: Uzair Ali <72073401+uzaxirr@users.noreply.github.com> Date: Thu, 28 Nov 2024 15:26:40 +0530 Subject: [PATCH] max_concurrent_requests --- civo/loadbalancer/resource_loadbalancer.go | 7 +++++-- internal/utils/utils.go | 7 ++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/civo/loadbalancer/resource_loadbalancer.go b/civo/loadbalancer/resource_loadbalancer.go index 6203d75e..4b7c6bbf 100644 --- a/civo/loadbalancer/resource_loadbalancer.go +++ b/civo/loadbalancer/resource_loadbalancer.go @@ -275,8 +275,7 @@ func resourceLoadBalancerCreate(ctx context.Context, d *schema.ResourceData, m i } if v, ok := d.GetOk("max_concurrent_requests"); ok { - num := v.(int) - conf.MaxConcurrentRequests = &num + conf.MaxConcurrentRequests = utils.IntPtr(v.(int)) } // Set backend configurations if provided @@ -403,6 +402,10 @@ func resourceLoadBalancerUpdate(ctx context.Context, d *schema.ResourceData, m i updateRequest.SessionAffinityConfigTimeout = int32(d.Get("session_affinity_config_timeout").(int)) } + if d.HasChange("max_concurrent_requests") { + updateRequest.MaxConcurrentRequests = utils.IntPtr(d.Get("max_concurrent_requests").(int)) + } + if d.HasChange("enable_proxy_protocol") { updateRequest.EnableProxyProtocol = d.Get("enable_proxy_protocol").(string) } diff --git a/internal/utils/utils.go b/internal/utils/utils.go index 07ff6440..a8a75a4e 100644 --- a/internal/utils/utils.go +++ b/internal/utils/utils.go @@ -326,7 +326,7 @@ func ValidateUUID(v interface{}, k string) (ws []string, errors []error) { return } -// CheckFileSize function checks if the file the file size is less than the allowed limit(current: 20MB) +// CheckFileSize function checks if the file size is less than the allowed limit(current: 20MB) func CheckFileSize(path string) error { fileInfo, err := os.Stat(path) if err != nil { @@ -340,3 +340,8 @@ func CheckFileSize(path string) error { } return nil } + +// IntPtr returns a pointer to an int +func IntPtr(i int) *int { + return &i +}