From 3471faecce3b21215713fda906f5b5291e8ec8ee Mon Sep 17 00:00:00 2001 From: Arjun Chauhan Date: Thu, 13 Feb 2025 19:26:14 +0530 Subject: [PATCH] fix(CIS): update response type of proxy read timeout setting --- go.mod | 2 +- go.sum | 6 ++-- .../cis/resource_ibm_cis_domain_settings.go | 36 +++++++++++++++++++ .../docs/r/cis_domain_settings.html.markdown | 5 +++ 4 files changed, 44 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index fa539f9a5e9..d44db61fc5c 100644 --- a/go.mod +++ b/go.mod @@ -32,7 +32,7 @@ require ( github.com/IBM/logs-go-sdk v0.4.0 github.com/IBM/logs-router-go-sdk v1.0.7 github.com/IBM/mqcloud-go-sdk v0.2.0 - github.com/IBM/networking-go-sdk v0.51.1 + github.com/IBM/networking-go-sdk v0.51.2 github.com/IBM/platform-services-go-sdk v0.73.0 github.com/IBM/project-go-sdk v0.3.5 github.com/IBM/push-notifications-go-sdk v0.0.0-20210310100607-5790b96c47f5 diff --git a/go.sum b/go.sum index 509116fb9dd..c275b47a61f 100644 --- a/go.sum +++ b/go.sum @@ -150,14 +150,12 @@ github.com/IBM/keyprotect-go-client v0.15.1 h1:m4qzqF5zOumRxKZ8s7vtK7A/UV/D278L8 github.com/IBM/keyprotect-go-client v0.15.1/go.mod h1:asXtHwL/4uCHA221Vd/7SkXEi2pcRHDzPyyksc1DthE= github.com/IBM/logs-go-sdk v0.4.0 h1:CyUjm19EUtcJjf4mxsj6Rc7gkZDT8JEY5rLUIz8Eoag= github.com/IBM/logs-go-sdk v0.4.0/go.mod h1:yv/GCXC4/p+MZEeXl4xjZAOMvDAVRwu61WyHZFKFXQM= -github.com/IBM/logs-router-go-sdk v1.0.5 h1:r0kC1+HfmSeQCD6zQTUp4PDI/zp4Ueo1Zo19ipHuNlw= -github.com/IBM/logs-router-go-sdk v1.0.5/go.mod h1:tCN2vFgu5xG0ob9iJcxi5M4bJ6mWmu3nhmRPnvlwev0= github.com/IBM/logs-router-go-sdk v1.0.7 h1:uQjQAAcQdo3XvhY6MC7HakhZaXIUsGfUmKj2d5vkjnY= github.com/IBM/logs-router-go-sdk v1.0.7/go.mod h1:tCN2vFgu5xG0ob9iJcxi5M4bJ6mWmu3nhmRPnvlwev0= github.com/IBM/mqcloud-go-sdk v0.2.0 h1:QOWk8ZGk0QfIL0MOGTKzNdM3Qe0Hk+ifAFtNSFQo5HU= github.com/IBM/mqcloud-go-sdk v0.2.0/go.mod h1:VZQKMtqmcdXKhmLhLiPuS/UHMs/5yo2tA/nD83cQt9E= -github.com/IBM/networking-go-sdk v0.51.1 h1:xRlDFxSMejMmJ7JPFZ9cflL86uJpbqUzuL/1D/pP7/g= -github.com/IBM/networking-go-sdk v0.51.1/go.mod h1:5aBaPKkm47LHECEOOZ4ltbwypOhapVo5aSCP3MTxmgQ= +github.com/IBM/networking-go-sdk v0.51.2 h1:aDa33IvvxMMWEB0sf+qNDWr8xE1XYoZYatG57SVsQAk= +github.com/IBM/networking-go-sdk v0.51.2/go.mod h1:5aBaPKkm47LHECEOOZ4ltbwypOhapVo5aSCP3MTxmgQ= github.com/IBM/platform-services-go-sdk v0.73.0 h1:CKs6qCM2U549gMn4ULfJB76DaDQpit/+0VmbKDqSpFU= github.com/IBM/platform-services-go-sdk v0.73.0/go.mod h1:LSaXGGJUGGPMCCtG1/24r9LJEbF0hmpXtQOhABRk0PY= github.com/IBM/project-go-sdk v0.3.5 h1:L+YClFUa14foS0B/hOOY9n7sIdsT5/XQicnXOyJSpyM= diff --git a/ibm/service/cis/resource_ibm_cis_domain_settings.go b/ibm/service/cis/resource_ibm_cis_domain_settings.go index 2d3100b7277..c7c2438a1cc 100644 --- a/ibm/service/cis/resource_ibm_cis_domain_settings.go +++ b/ibm/service/cis/resource_ibm_cis_domain_settings.go @@ -71,6 +71,7 @@ const ( cisDomainSettingsChallengeTTLValidatorID = "challenge_ttl" cisDomainSettingsMaxUploadValidatorID = "max_upload" cisDomainSettingsCipherValidatorID = "cipher" + cisDomainSettingsProxyReadTimeout = "proxy_read_timeout" ) func ResourceIBMCISSettings() *schema.Resource { @@ -369,6 +370,15 @@ func ResourceIBMCISSettings() *schema.Resource { ibmCISDomainSettings, cisDomainSettingsOriginPostQuantumEncryption), }, + cisDomainSettingsProxyReadTimeout: { + Type: schema.TypeInt, + Description: "Update proxy read timeout setting", + Optional: true, + Computed: true, + ValidateFunc: validate.InvokeValidator( + ibmCISDomainSettings, + cisDomainSettingsProxyReadTimeout), + }, cisDomainSettingsMinify: { Type: schema.TypeList, Description: "Minify setting", @@ -762,6 +772,14 @@ func ResourceIBMCISDomainSettingValidator() *validate.ResourceValidator { Type: validate.TypeString, Required: true, AllowedValues: quantumEncryption}) + validateSchema = append(validateSchema, + validate.ValidateSchema{ + Identifier: cisDomainSettingsProxyReadTimeout, + ValidateFunctionIdentifier: validate.IntBetween, + Type: validate.TypeInt, + Optional: true, + MinValue: "1", + MaxValue: "6000"}) ibmCISDomainSettingResourceValidator := validate.ResourceValidator{ ResourceName: ibmCISDomainSettings, Schema: validateSchema} @@ -802,6 +820,7 @@ var settingsList = []string{ cisDomainSettingsCipher, cisDomainSettingsOriginMaxHTTPVersion, cisDomainSettingsOriginPostQuantumEncryption, + cisDomainSettingsProxyReadTimeout, } func resourceCISSettingsUpdate(d *schema.ResourceData, meta interface{}) error { @@ -1068,6 +1087,14 @@ func resourceCISSettingsUpdate(d *schema.ResourceData, meta interface{}) error { _, resp, err = cisClient.UpdateOriginPostQuantumEncryption(opt) } } + case cisDomainSettingsProxyReadTimeout: + if d.HasChange(item) { + if v, ok := d.GetOk(item); ok { + opt := cisClient.NewUpdateProxyReadTimeoutOptions() + opt.SetValue(float64(v.(int))) + _, resp, err = cisClient.UpdateProxyReadTimeout(opt) + } + } case cisDomainSettingsMinify: if d.HasChange(item) { if v, ok := d.GetOk(item); ok { @@ -1421,6 +1448,7 @@ func resourceCISSettingsRead(d *schema.ResourceData, meta interface{}) error { } settingResponse = resp settingErr = err + case cisDomainSettingsOriginPostQuantumEncryption: opt := cisClient.NewGetOriginPostQuantumEncryptionOptions() result, resp, err := cisClient.GetOriginPostQuantumEncryption(opt) @@ -1430,6 +1458,14 @@ func resourceCISSettingsRead(d *schema.ResourceData, meta interface{}) error { settingResponse = resp settingErr = err + case cisDomainSettingsProxyReadTimeout: + opt := cisClient.NewGetProxyReadTimeoutOptions() + result, resp, err := cisClient.GetProxyReadTimeout(opt) + if err == nil { + d.Set(cisDomainSettingsProxyReadTimeout, result.Result.Value) + } + settingResponse = resp + settingErr = err case cisDomainSettingsMinify: opt := cisClient.NewGetMinifyOptions() result, resp, err := cisClient.GetMinify(opt) diff --git a/website/docs/r/cis_domain_settings.html.markdown b/website/docs/r/cis_domain_settings.html.markdown index 92cf6ad650a..88ea69974a2 100644 --- a/website/docs/r/cis_domain_settings.html.markdown +++ b/website/docs/r/cis_domain_settings.html.markdown @@ -48,6 +48,7 @@ resource "ibm_cis_domain_settings" "test_domain_settings" { cipher = ["AES128-SHA256"] origin_max_http_version = "1" origin_post_quantum_encryption = "off" + proxy_read_timeout = 5500 minify { css = "off" js = "off" @@ -75,6 +76,7 @@ resource "ibm_cis_domain_settings" "test" { min_tls_version = "1.2" origin_max_http_version = "2" origin_post_quantum_encryption = "supported" + proxy_read_timeout = 5500 } ``` @@ -118,6 +120,7 @@ resource "ibm_cis_domain_settings" "test_domain_settings" { cipher = [] origin_max_http_version = "1" origin_post_quantum_encryption = "off" + proxy_read_timeout = 5500 minify { css = "off" js = "off" @@ -145,6 +148,7 @@ resource "ibm_cis_domain_settings" "test" { min_tls_version = "1.3" origin_max_http_version = "2" origin_post_quantum_encryption = "supported" + proxy_read_timeout = 5500 } ``` @@ -204,6 +208,7 @@ Review the argument references that you can specify for your resource. - `websockets` - (Optional, String) Supported values are `off` and `on`. - `origin_max_http_version` - (Optional, String) Sets the highest HTTP version to use with origin. Supported values are `1` and `2`. - `origin_post_quantum_encryption` - (Optional, String) Wheather to use post-quantum key agreement algorithms when connecting to the origin. Supported values are `off`, `preferred` and `supported`. +- `proxy_read_timeout` - (Optional, Integer) Maximum time between two read operations from origin. Valid values are `1-6000`. ### Note