From 88e2230306893c8b2ecd9b42cb3ea65ef9c85c46 Mon Sep 17 00:00:00 2001 From: Ruben Hoenle Date: Tue, 29 Apr 2025 15:03:54 +0200 Subject: [PATCH 1/2] fix(sdk): handle empty payload in body correctly --- CHANGELOG.md | 49 +++- services/authorization/CHANGELOG.md | 3 + services/authorization/client.go | 2 +- services/cdn/CHANGELOG.md | 3 + services/cdn/api_default_test.go | 32 +-- services/cdn/client.go | 2 +- services/certificates/CHANGELOG.md | 5 +- services/certificates/api_default_test.go | 20 +- services/certificates/client.go | 2 +- services/dns/CHANGELOG.md | 3 + services/dns/api_default_test.go | 102 +++---- services/dns/client.go | 2 +- services/git/CHANGELOG.md | 5 +- services/git/client.go | 2 +- services/iaas/CHANGELOG.md | 3 + services/iaas/api_default_test.go | 18 +- services/iaas/client.go | 2 +- services/iaasalpha/api_default_test.go | 18 +- services/iaasalpha/client.go | 2 +- services/loadbalancer/CHANGELOG.md | 3 + services/loadbalancer/api_default_test.go | 66 ++--- services/loadbalancer/client.go | 2 +- services/logme/CHANGELOG.md | 3 + services/logme/api_default_test.go | 74 ++--- services/logme/client.go | 2 +- services/mariadb/CHANGELOG.md | 3 + services/mariadb/api_default_test.go | 74 ++--- services/mariadb/client.go | 2 +- services/mongodbflex/CHANGELOG.md | 3 + services/mongodbflex/client.go | 2 +- services/objectstorage/CHANGELOG.md | 3 + services/objectstorage/api_default_test.go | 62 ++--- services/objectstorage/client.go | 2 +- services/observability/CHANGELOG.md | 3 + services/observability/api_default_test.go | 254 +++++++++--------- services/observability/client.go | 2 +- services/opensearch/CHANGELOG.md | 3 + services/opensearch/api_default_test.go | 74 ++--- services/opensearch/client.go | 2 +- services/postgresflex/CHANGELOG.md | 3 + services/postgresflex/api_default_test.go | 164 +++++------ services/postgresflex/client.go | 2 +- services/rabbitmq/CHANGELOG.md | 3 + services/rabbitmq/api_default_test.go | 74 ++--- services/rabbitmq/client.go | 2 +- services/redis/CHANGELOG.md | 3 + services/redis/api_default_test.go | 74 ++--- services/redis/client.go | 2 +- services/runcommand/CHANGELOG.md | 3 + services/runcommand/api_default_test.go | 28 +- services/runcommand/client.go | 2 +- services/secretsmanager/CHANGELOG.md | 3 + services/secretsmanager/client.go | 2 +- services/serverbackup/CHANGELOG.md | 3 + services/serverbackup/api_default_test.go | 112 ++++---- services/serverbackup/client.go | 2 +- services/serviceenablement/CHANGELOG.md | 3 + .../serviceenablement/api_default_test.go | 22 +- services/serviceenablement/client.go | 2 +- services/ske/CHANGELOG.md | 3 + services/ske/api_default_test.go | 42 +-- services/ske/client.go | 2 +- services/sqlserverflex/CHANGELOG.md | 3 + services/sqlserverflex/client.go | 2 +- 64 files changed, 793 insertions(+), 682 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 95a3b36f5..73d63411a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,14 +10,59 @@ - **Features**: Add new methods to manage the STACKIT Git: `CreateInstance`, `DeleteInstance`, `GetInstance` - [v0.3.0](services/git/CHANGELOG.md#v030-2025-04-22) - **Features**: Add waiters to manage the STACKIT Git -- `observability`: [v0.5.0](services/observability/CHANGELOG.md#v050-2025-04-16) - - **Feature:** Add new methods `ListLogsAlertgroups`, `CreateLogsAlertgroups`, `GetLogsAlertgroup`, `UpdateLogsAlertgroup`, `DeleteLogsAlertgroup` + - [v0.3.1](services/git/CHANGELOG.md#v031-2025-04-29) + - **Bugfix:** Correctly handle empty payload in body +- `observability`: + - [v0.5.0](services/observability/CHANGELOG.md#v050-2025-04-16) + - **Feature:** Add new methods `ListLogsAlertgroups`, `CreateLogsAlertgroups`, `GetLogsAlertgroup`, `UpdateLogsAlertgroup`, `DeleteLogsAlertgroup` + - [v0.5.1](services/observability/CHANGELOG.md#v051-2025-04-29) + - **Bugfix:** Correctly handle empty payload in body - `kms`: [v0.0.1](services/kms/CHANGELOG.md#v001-2025-04-28) - **New module:** Initial publication of Key Management Service API - `serviceaccount`: [v0.6.2](services/serviceaccount/CHANGELOG.md#v062-2025-04-29) - **Bugfix:** Correctly handle empty payload in body - `serverupdate`: [v1.0.2](services/serverupdate/CHANGELOG.md#v102-2025-04-29) - **Bugfix:** Correctly handle empty payload in body +- `sqlserverflex`: [v1.0.2](services/sqlserverflex/CHANGELOG.md#v102-2025-04-29) + - **Bugfix:** Correctly handle empty payload in body +- `sqlserverflex`: [v0.22.2](services/ske/CHANGELOG.md#v0222-2025-04-29) + - **Bugfix:** Correctly handle empty payload in body +- `serviceenablement`: [v1.0.2](services/serviceenablement/CHANGELOG.md#v102-2025-04-29) + - **Bugfix:** Correctly handle empty payload in body +- `serverbackup`: [v1.0.2](services/serverbackup/CHANGELOG.md#v102-2025-04-29) + - **Bugfix:** Correctly handle empty payload in body +- `secretsmanager`: [v0.11.3](services/secretsmanager/CHANGELOG.md#v0113-2025-04-29) + - **Bugfix:** Correctly handle empty payload in body +- `runcommand`: [v1.0.1](services/runcommand/CHANGELOG.md#v101-2025-04-29) + - **Bugfix:** Correctly handle empty payload in body +- `redis`: [v0.22.1](services/runcommand/CHANGELOG.md#v0221-2025-04-29) + - **Bugfix:** Correctly handle empty payload in body +- `rabbitmq`: [v0.22.1](services/rabbitmq/CHANGELOG.md#v0221-2025-04-29) + - **Bugfix:** Correctly handle empty payload in body +- `postgresflex`: [v1.0.3](services/postgresflex/CHANGELOG.md#v103-2025-04-29) + - **Bugfix:** Correctly handle empty payload in body +- `opensearch`: [v0.21.1](services/opensearch/CHANGELOG.md#v0211-2025-04-29) + - **Bugfix:** Correctly handle empty payload in body +- `objectstorage`: [v1.1.2](services/objectstorage/CHANGELOG.md#v112-2025-04-29) + - **Bugfix:** Correctly handle empty payload in body +- `mongodbflex`: [v0.18.2](services/objectstorage/CHANGELOG.md#v0182-2025-04-29) + - **Bugfix:** Correctly handle empty payload in body +- `mariadb`: [v0.22.1](services/objectstorage/CHANGELOG.md#v0221-2025-04-29) + - **Bugfix:** Correctly handle empty payload in body +- `logme`: [v0.22.1](services/logme/CHANGELOG.md#v0221-2025-04-29) + - **Bugfix:** Correctly handle empty payload in body +- `loadbalancer`: [v1.0.2](services/logme/CHANGELOG.md#v102-2025-04-29) + - **Bugfix:** Correctly handle empty payload in body +- `iaas`: [v0.22.1](services/iaas/CHANGELOG.md#v0221-2025-04-29) + - **Bugfix:** Correctly handle empty payload in body +- `dns`: [v0.13.2](services/dns/CHANGELOG.md#v0132-2025-04-29) + - **Bugfix:** Correctly handle empty payload in body +- `certificates`: [v1.0.2](services/certificates/CHANGELOG.md#v102-2025-04-29) + - **Bugfix:** Correctly handle empty payload in body +- `cdn`: [v0.3.1](services/cdn/CHANGELOG.md#v031-2025-04-29) + - **Bugfix:** Correctly handle empty payload in body +- `authorization`: [v0.6.2](services/cdn/CHANGELOG.md#v062-2025-04-29) + - **Bugfix:** Correctly handle empty payload in body ## Release (2025-04-09) - `cdn`: [v0.3.0](services/cdn/CHANGELOG.md#v030-2025-04-04) diff --git a/services/authorization/CHANGELOG.md b/services/authorization/CHANGELOG.md index eb0d90ef6..21604725e 100644 --- a/services/authorization/CHANGELOG.md +++ b/services/authorization/CHANGELOG.md @@ -1,3 +1,6 @@ +## v0.6.2 (2025-04-29) +- **Bugfix:** Correctly handle empty payload in body + ## v0.6.1 (2025-03-19) - **Internal:** Backwards compatible change to generated code diff --git a/services/authorization/client.go b/services/authorization/client.go index 194c10905..9c2709ddf 100644 --- a/services/authorization/client.go +++ b/services/authorization/client.go @@ -308,7 +308,7 @@ func (c *APIClient) prepareRequest( var body *bytes.Buffer // Detect postBody type and post. - if postBody != nil { + if !IsNil(postBody) { contentType := headerParams["Content-Type"] if contentType == "" { contentType = detectContentType(postBody) diff --git a/services/cdn/CHANGELOG.md b/services/cdn/CHANGELOG.md index b8e57e59f..7f7c68d97 100644 --- a/services/cdn/CHANGELOG.md +++ b/services/cdn/CHANGELOG.md @@ -1,3 +1,6 @@ +## v0.3.1 (2025-04-29) +- **Bugfix:** Correctly handle empty payload in body + ## v0.3.0 (2025-04-04) - **New:** Add waiter for creation of `CustomDomain` diff --git a/services/cdn/api_default_test.go b/services/cdn/api_default_test.go index f8874adfa..073861a64 100644 --- a/services/cdn/api_default_test.go +++ b/services/cdn/api_default_test.go @@ -27,7 +27,7 @@ func Test_cdn_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService CreateDistribution", func(t *testing.T) { _apiUrlPath := "/v1beta/projects/{projectId}/distributions" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -80,11 +80,11 @@ func Test_cdn_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService DeleteCustomDomain", func(t *testing.T) { _apiUrlPath := "/v1beta/projects/{projectId}/distributions/{distributionId}/customDomains/{domain}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) distributionIdValue := uuid.NewString() _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"distributionId"+"}", url.PathEscape(ParameterValueToString(distributionIdValue, "distributionId")), -1) - domainValue := "domain" + domainValue := "domain-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"domain"+"}", url.PathEscape(ParameterValueToString(domainValue, "domain")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -138,7 +138,7 @@ func Test_cdn_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService DeleteDistribution", func(t *testing.T) { _apiUrlPath := "/v1beta/projects/{projectId}/distributions/{distributionId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) distributionIdValue := uuid.NewString() _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"distributionId"+"}", url.PathEscape(ParameterValueToString(distributionIdValue, "distributionId")), -1) @@ -193,7 +193,7 @@ func Test_cdn_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService FindCachePaths", func(t *testing.T) { _apiUrlPath := "/v1beta/projects/{projectId}/distributions/{distributionId}/cache/paths" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) distributionIdValue := uuid.NewString() _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"distributionId"+"}", url.PathEscape(ParameterValueToString(distributionIdValue, "distributionId")), -1) @@ -249,7 +249,7 @@ func Test_cdn_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetCacheInfo", func(t *testing.T) { _apiUrlPath := "/v1beta/projects/{projectId}/distributions/{distributionId}/cache" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) distributionIdValue := uuid.NewString() _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"distributionId"+"}", url.PathEscape(ParameterValueToString(distributionIdValue, "distributionId")), -1) @@ -304,11 +304,11 @@ func Test_cdn_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetCustomDomain", func(t *testing.T) { _apiUrlPath := "/v1beta/projects/{projectId}/distributions/{distributionId}/customDomains/{domain}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) distributionIdValue := uuid.NewString() _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"distributionId"+"}", url.PathEscape(ParameterValueToString(distributionIdValue, "distributionId")), -1) - domainValue := "domain" + domainValue := "domain-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"domain"+"}", url.PathEscape(ParameterValueToString(domainValue, "domain")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -362,7 +362,7 @@ func Test_cdn_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetDistribution", func(t *testing.T) { _apiUrlPath := "/v1beta/projects/{projectId}/distributions/{distributionId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) distributionIdValue := uuid.NewString() _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"distributionId"+"}", url.PathEscape(ParameterValueToString(distributionIdValue, "distributionId")), -1) @@ -417,7 +417,7 @@ func Test_cdn_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetStatistics", func(t *testing.T) { _apiUrlPath := "/v1beta/projects/{projectId}/distributions/{distributionId}/statistics" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) distributionIdValue := uuid.NewString() _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"distributionId"+"}", url.PathEscape(ParameterValueToString(distributionIdValue, "distributionId")), -1) @@ -473,7 +473,7 @@ func Test_cdn_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListDistributions", func(t *testing.T) { _apiUrlPath := "/v1beta/projects/{projectId}/distributions" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -525,9 +525,9 @@ func Test_cdn_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService PatchDistribution", func(t *testing.T) { _apiUrlPath := "/v1beta/projects/{projectId}/distributions/{distributionId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - distributionIdValue := "distributionId" + distributionIdValue := "distributionId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"distributionId"+"}", url.PathEscape(ParameterValueToString(distributionIdValue, "distributionId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -580,7 +580,7 @@ func Test_cdn_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService PurgeCache", func(t *testing.T) { _apiUrlPath := "/v1beta/projects/{projectId}/distributions/{distributionId}/cache/purge" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) distributionIdValue := uuid.NewString() _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"distributionId"+"}", url.PathEscape(ParameterValueToString(distributionIdValue, "distributionId")), -1) @@ -635,11 +635,11 @@ func Test_cdn_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService PutCustomDomain", func(t *testing.T) { _apiUrlPath := "/v1beta/projects/{projectId}/distributions/{distributionId}/customDomains/{domain}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) distributionIdValue := uuid.NewString() _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"distributionId"+"}", url.PathEscape(ParameterValueToString(distributionIdValue, "distributionId")), -1) - domainValue := "domain" + domainValue := "domain-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"domain"+"}", url.PathEscape(ParameterValueToString(domainValue, "domain")), -1) testDefaultApiServeMux := http.NewServeMux() diff --git a/services/cdn/client.go b/services/cdn/client.go index 4617fdb68..f8a067f10 100644 --- a/services/cdn/client.go +++ b/services/cdn/client.go @@ -305,7 +305,7 @@ func (c *APIClient) prepareRequest( var body *bytes.Buffer // Detect postBody type and post. - if postBody != nil { + if !IsNil(postBody) { contentType := headerParams["Content-Type"] if contentType == "" { contentType = detectContentType(postBody) diff --git a/services/certificates/CHANGELOG.md b/services/certificates/CHANGELOG.md index dec3aa10c..8160c5b03 100644 --- a/services/certificates/CHANGELOG.md +++ b/services/certificates/CHANGELOG.md @@ -1,3 +1,6 @@ +## v1.0.2 (2025-04-29) +- **Bugfix:** Correctly handle empty payload in body + ## v1.0.1 (2025-03-27) - **Bugfix:** Removed ConfigureRegion() from API client @@ -9,4 +12,4 @@ ## v0.1.0 (2025-01-13) -- **New**: STACKIT Certificates module can be used to manage the STACKIT Load Balancer Certificates \ No newline at end of file +- **New**: STACKIT Certificates module can be used to manage the STACKIT Load Balancer Certificates diff --git a/services/certificates/api_default_test.go b/services/certificates/api_default_test.go index 1272927c4..fae3fdad6 100644 --- a/services/certificates/api_default_test.go +++ b/services/certificates/api_default_test.go @@ -25,9 +25,9 @@ func Test_certificates_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService CreateCertificate", func(t *testing.T) { _apiUrlPath := "/v2beta/projects/{projectId}/regions/{region}/certificates" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -81,11 +81,11 @@ func Test_certificates_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService DeleteCertificate", func(t *testing.T) { _apiUrlPath := "/v2beta/projects/{projectId}/regions/{region}/certificates/{id}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - idValue := "id" + idValue := "id-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"id"+"}", url.PathEscape(ParameterValueToString(idValue, "id")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -139,11 +139,11 @@ func Test_certificates_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetCertificate", func(t *testing.T) { _apiUrlPath := "/v2beta/projects/{projectId}/regions/{region}/certificates/{id}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - idValue := "id" + idValue := "id-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"id"+"}", url.PathEscape(ParameterValueToString(idValue, "id")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -197,9 +197,9 @@ func Test_certificates_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListCertificates", func(t *testing.T) { _apiUrlPath := "/v2beta/projects/{projectId}/regions/{region}/certificates" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) testDefaultApiServeMux := http.NewServeMux() diff --git a/services/certificates/client.go b/services/certificates/client.go index 4733a1264..bb3b21158 100644 --- a/services/certificates/client.go +++ b/services/certificates/client.go @@ -305,7 +305,7 @@ func (c *APIClient) prepareRequest( var body *bytes.Buffer // Detect postBody type and post. - if postBody != nil { + if !IsNil(postBody) { contentType := headerParams["Content-Type"] if contentType == "" { contentType = detectContentType(postBody) diff --git a/services/dns/CHANGELOG.md b/services/dns/CHANGELOG.md index 507f66059..870a653a8 100644 --- a/services/dns/CHANGELOG.md +++ b/services/dns/CHANGELOG.md @@ -1,3 +1,6 @@ +## v0.13.2 (2025-04-29) +- **Bugfix:** Correctly handle empty payload in body + ## v0.13.1 (2025-03-19) - **Internal:** Backwards compatible change to generated code diff --git a/services/dns/api_default_test.go b/services/dns/api_default_test.go index 16cf6b20a..255e69ae5 100644 --- a/services/dns/api_default_test.go +++ b/services/dns/api_default_test.go @@ -25,9 +25,9 @@ func Test_dns_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService CloneZone", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/zones/{zoneId}/clone" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - zoneIdValue := "zoneId" + zoneIdValue := "zoneId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"zoneId"+"}", url.PathEscape(ParameterValueToString(zoneIdValue, "zoneId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -81,9 +81,9 @@ func Test_dns_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService CreateLabel", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/zones/{zoneId}/labels" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - zoneIdValue := "zoneId" + zoneIdValue := "zoneId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"zoneId"+"}", url.PathEscape(ParameterValueToString(zoneIdValue, "zoneId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -137,9 +137,9 @@ func Test_dns_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService CreateMoveCode", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/zones/{zoneId}/move-code" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - zoneIdValue := "zoneId" + zoneIdValue := "zoneId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"zoneId"+"}", url.PathEscape(ParameterValueToString(zoneIdValue, "zoneId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -192,9 +192,9 @@ func Test_dns_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService CreateRecordSet", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/zones/{zoneId}/rrsets" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - zoneIdValue := "zoneId" + zoneIdValue := "zoneId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"zoneId"+"}", url.PathEscape(ParameterValueToString(zoneIdValue, "zoneId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -248,7 +248,7 @@ func Test_dns_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService CreateZone", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/zones" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -301,11 +301,11 @@ func Test_dns_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService DeleteLabel", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/zones/{zoneId}/labels/{key}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - zoneIdValue := "zoneId" + zoneIdValue := "zoneId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"zoneId"+"}", url.PathEscape(ParameterValueToString(zoneIdValue, "zoneId")), -1) - keyValue := "key" + keyValue := "key-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"key"+"}", url.PathEscape(ParameterValueToString(keyValue, "key")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -359,9 +359,9 @@ func Test_dns_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService DeleteMoveCode", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/zones/{zoneId}/move-code" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - zoneIdValue := "zoneId" + zoneIdValue := "zoneId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"zoneId"+"}", url.PathEscape(ParameterValueToString(zoneIdValue, "zoneId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -414,11 +414,11 @@ func Test_dns_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService DeleteRecordSet", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/zones/{zoneId}/rrsets/{rrSetId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - zoneIdValue := "zoneId" + zoneIdValue := "zoneId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"zoneId"+"}", url.PathEscape(ParameterValueToString(zoneIdValue, "zoneId")), -1) - rrSetIdValue := "rrSetId" + rrSetIdValue := "rrSetId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"rrSetId"+"}", url.PathEscape(ParameterValueToString(rrSetIdValue, "rrSetId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -472,9 +472,9 @@ func Test_dns_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService DeleteZone", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/zones/{zoneId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - zoneIdValue := "zoneId" + zoneIdValue := "zoneId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"zoneId"+"}", url.PathEscape(ParameterValueToString(zoneIdValue, "zoneId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -527,9 +527,9 @@ func Test_dns_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ExportRecordSets", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/zones/{zoneId}/export" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - zoneIdValue := "zoneId" + zoneIdValue := "zoneId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"zoneId"+"}", url.PathEscape(ParameterValueToString(zoneIdValue, "zoneId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -583,11 +583,11 @@ func Test_dns_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetRecordSet", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/zones/{zoneId}/rrsets/{rrSetId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - zoneIdValue := "zoneId" + zoneIdValue := "zoneId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"zoneId"+"}", url.PathEscape(ParameterValueToString(zoneIdValue, "zoneId")), -1) - rrSetIdValue := "rrSetId" + rrSetIdValue := "rrSetId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"rrSetId"+"}", url.PathEscape(ParameterValueToString(rrSetIdValue, "rrSetId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -641,9 +641,9 @@ func Test_dns_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetZone", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/zones/{zoneId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - zoneIdValue := "zoneId" + zoneIdValue := "zoneId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"zoneId"+"}", url.PathEscape(ParameterValueToString(zoneIdValue, "zoneId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -696,9 +696,9 @@ func Test_dns_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ImportRecordSets", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/zones/{zoneId}/import" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - zoneIdValue := "zoneId" + zoneIdValue := "zoneId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"zoneId"+"}", url.PathEscape(ParameterValueToString(zoneIdValue, "zoneId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -752,9 +752,9 @@ func Test_dns_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListLabels", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/zones/{zoneId}/labels" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - zoneIdValue := "zoneId" + zoneIdValue := "zoneId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"zoneId"+"}", url.PathEscape(ParameterValueToString(zoneIdValue, "zoneId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -807,9 +807,9 @@ func Test_dns_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListRecordSets", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/zones/{zoneId}/rrsets" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - zoneIdValue := "zoneId" + zoneIdValue := "zoneId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"zoneId"+"}", url.PathEscape(ParameterValueToString(zoneIdValue, "zoneId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -862,7 +862,7 @@ func Test_dns_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListZones", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/zones" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -914,7 +914,7 @@ func Test_dns_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService MoveZone", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/move-zone" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -967,11 +967,11 @@ func Test_dns_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService PartialUpdateRecord", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/zones/{zoneId}/rrsets/{rrSetId}/records" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - zoneIdValue := "zoneId" + zoneIdValue := "zoneId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"zoneId"+"}", url.PathEscape(ParameterValueToString(zoneIdValue, "zoneId")), -1) - rrSetIdValue := "rrSetId" + rrSetIdValue := "rrSetId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"rrSetId"+"}", url.PathEscape(ParameterValueToString(rrSetIdValue, "rrSetId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -1026,11 +1026,11 @@ func Test_dns_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService PartialUpdateRecordSet", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/zones/{zoneId}/rrsets/{rrSetId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - zoneIdValue := "zoneId" + zoneIdValue := "zoneId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"zoneId"+"}", url.PathEscape(ParameterValueToString(zoneIdValue, "zoneId")), -1) - rrSetIdValue := "rrSetId" + rrSetIdValue := "rrSetId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"rrSetId"+"}", url.PathEscape(ParameterValueToString(rrSetIdValue, "rrSetId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -1085,9 +1085,9 @@ func Test_dns_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService PartialUpdateZone", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/zones/{zoneId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - zoneIdValue := "zoneId" + zoneIdValue := "zoneId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"zoneId"+"}", url.PathEscape(ParameterValueToString(zoneIdValue, "zoneId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -1141,11 +1141,11 @@ func Test_dns_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService RestoreRecordSet", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/zones/{zoneId}/rrsets/{rrSetId}/restores" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - zoneIdValue := "zoneId" + zoneIdValue := "zoneId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"zoneId"+"}", url.PathEscape(ParameterValueToString(zoneIdValue, "zoneId")), -1) - rrSetIdValue := "rrSetId" + rrSetIdValue := "rrSetId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"rrSetId"+"}", url.PathEscape(ParameterValueToString(rrSetIdValue, "rrSetId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -1199,9 +1199,9 @@ func Test_dns_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService RestoreZone", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/zones/{zoneId}/restores" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - zoneIdValue := "zoneId" + zoneIdValue := "zoneId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"zoneId"+"}", url.PathEscape(ParameterValueToString(zoneIdValue, "zoneId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -1254,9 +1254,9 @@ func Test_dns_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService RetrieveZone", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/zones/{zoneId}/retrieve" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - zoneIdValue := "zoneId" + zoneIdValue := "zoneId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"zoneId"+"}", url.PathEscape(ParameterValueToString(zoneIdValue, "zoneId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -1309,9 +1309,9 @@ func Test_dns_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ValidateMoveCode", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/zones/{zoneId}/move-code-validation" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - zoneIdValue := "zoneId" + zoneIdValue := "zoneId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"zoneId"+"}", url.PathEscape(ParameterValueToString(zoneIdValue, "zoneId")), -1) testDefaultApiServeMux := http.NewServeMux() diff --git a/services/dns/client.go b/services/dns/client.go index 557e680af..0df35c911 100644 --- a/services/dns/client.go +++ b/services/dns/client.go @@ -308,7 +308,7 @@ func (c *APIClient) prepareRequest( var body *bytes.Buffer // Detect postBody type and post. - if postBody != nil { + if !IsNil(postBody) { contentType := headerParams["Content-Type"] if contentType == "" { contentType = detectContentType(postBody) diff --git a/services/git/CHANGELOG.md b/services/git/CHANGELOG.md index c1277c33a..2c370e282 100644 --- a/services/git/CHANGELOG.md +++ b/services/git/CHANGELOG.md @@ -1,3 +1,6 @@ +## v0.3.1 (2025-04-29) +- **Bugfix:** Correctly handle empty payload in body + ## v0.3.0 (2025-04-22) - **Features**: Add waiters to manage the STACKIT Git @@ -5,4 +8,4 @@ - **Features**: Add new methods to manage the STACKIT Git: `CreateInstance`, `DeleteInstance`, `GetInstance` ## v0.1.0 (2025-04-14) -- **New**: STACKIT Git module can be used to manage STACKIT Git \ No newline at end of file +- **New**: STACKIT Git module can be used to manage STACKIT Git diff --git a/services/git/client.go b/services/git/client.go index 4a603cb75..a215d6178 100644 --- a/services/git/client.go +++ b/services/git/client.go @@ -308,7 +308,7 @@ func (c *APIClient) prepareRequest( var body *bytes.Buffer // Detect postBody type and post. - if postBody != nil { + if !IsNil(postBody) { contentType := headerParams["Content-Type"] if contentType == "" { contentType = detectContentType(postBody) diff --git a/services/iaas/CHANGELOG.md b/services/iaas/CHANGELOG.md index 915fda513..e05fb40d9 100644 --- a/services/iaas/CHANGELOG.md +++ b/services/iaas/CHANGELOG.md @@ -1,3 +1,6 @@ +## v0.22.1 (2025-04-29) +- **Bugfix:** Correctly handle empty payload in body + ## v0.22.0 (2025-03-24) - **Improvement:** Upgrading from IaaS **beta** endpoints to **v1** - **Feature:** Add new method to filter `ListMachineTypes`: `Filter` diff --git a/services/iaas/api_default_test.go b/services/iaas/api_default_test.go index e764047bb..77be86721 100644 --- a/services/iaas/api_default_test.go +++ b/services/iaas/api_default_test.go @@ -238,7 +238,7 @@ func Test_iaas_DefaultApiService(t *testing.T) { _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) serverIdValue := uuid.NewString() _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) - serviceAccountMailValue := "serviceAccountMail" + serviceAccountMailValue := "serviceAccountMail-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serviceAccountMail"+"}", url.PathEscape(ParameterValueToString(serviceAccountMailValue, "serviceAccountMail")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -1451,7 +1451,7 @@ func Test_iaas_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService DeleteKeyPair", func(t *testing.T) { _apiUrlPath := "/v1/keypairs/{keypairName}" - keypairNameValue := "keypairName" + keypairNameValue := "keypairName-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"keypairName"+"}", url.PathEscape(ParameterValueToString(keypairNameValue, "keypairName")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -2384,7 +2384,7 @@ func Test_iaas_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetKeyPair", func(t *testing.T) { _apiUrlPath := "/v1/keypairs/{keypairName}" - keypairNameValue := "keypairName" + keypairNameValue := "keypairName-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"keypairName"+"}", url.PathEscape(ParameterValueToString(keypairNameValue, "keypairName")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -2438,7 +2438,7 @@ func Test_iaas_DefaultApiService(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/machine-types/{machineType}" projectIdValue := uuid.NewString() _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - machineTypeValue := "machineType" + machineTypeValue := "machineType-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"machineType"+"}", url.PathEscape(ParameterValueToString(machineTypeValue, "machineType")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -2777,7 +2777,7 @@ func Test_iaas_DefaultApiService(t *testing.T) { _apiUrlPath := "/v1/organizations/{organizationId}/requests/{requestId}" organizationIdValue := uuid.NewString() _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) - requestIdValue := "requestId" + requestIdValue := "requestId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"requestId"+"}", url.PathEscape(ParameterValueToString(requestIdValue, "requestId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -2887,7 +2887,7 @@ func Test_iaas_DefaultApiService(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/requests/{requestId}" projectIdValue := uuid.NewString() _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - requestIdValue := "requestId" + requestIdValue := "requestId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"requestId"+"}", url.PathEscape(ParameterValueToString(requestIdValue, "requestId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -3385,7 +3385,7 @@ func Test_iaas_DefaultApiService(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/volume-performance-classes/{volumePerformanceClass}" projectIdValue := uuid.NewString() _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - volumePerformanceClassValue := "volumePerformanceClass" + volumePerformanceClassValue := "volumePerformanceClass-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"volumePerformanceClass"+"}", url.PathEscape(ParameterValueToString(volumePerformanceClassValue, "volumePerformanceClass")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -5117,7 +5117,7 @@ func Test_iaas_DefaultApiService(t *testing.T) { _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) serverIdValue := uuid.NewString() _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) - serviceAccountMailValue := "serviceAccountMail" + serviceAccountMailValue := "serviceAccountMail-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serviceAccountMail"+"}", url.PathEscape(ParameterValueToString(serviceAccountMailValue, "serviceAccountMail")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -5961,7 +5961,7 @@ func Test_iaas_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService UpdateKeyPair", func(t *testing.T) { _apiUrlPath := "/v1/keypairs/{keypairName}" - keypairNameValue := "keypairName" + keypairNameValue := "keypairName-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"keypairName"+"}", url.PathEscape(ParameterValueToString(keypairNameValue, "keypairName")), -1) testDefaultApiServeMux := http.NewServeMux() diff --git a/services/iaas/client.go b/services/iaas/client.go index 888a2a99b..d14bd7069 100644 --- a/services/iaas/client.go +++ b/services/iaas/client.go @@ -308,7 +308,7 @@ func (c *APIClient) prepareRequest( var body *bytes.Buffer // Detect postBody type and post. - if postBody != nil { + if !IsNil(postBody) { contentType := headerParams["Content-Type"] if contentType == "" { contentType = detectContentType(postBody) diff --git a/services/iaasalpha/api_default_test.go b/services/iaasalpha/api_default_test.go index 678d48093..b0251b527 100644 --- a/services/iaasalpha/api_default_test.go +++ b/services/iaasalpha/api_default_test.go @@ -297,7 +297,7 @@ func Test_iaasalpha_DefaultApiService(t *testing.T) { _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) serverIdValue := uuid.NewString() _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) - serviceAccountMailValue := "serviceAccountMail" + serviceAccountMailValue := "serviceAccountMail-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serviceAccountMail"+"}", url.PathEscape(ParameterValueToString(serviceAccountMailValue, "serviceAccountMail")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -1566,7 +1566,7 @@ func Test_iaasalpha_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService DeleteKeyPair", func(t *testing.T) { _apiUrlPath := "/v1alpha1/keypairs/{keypairName}" - keypairNameValue := "keypairName" + keypairNameValue := "keypairName-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"keypairName"+"}", url.PathEscape(ParameterValueToString(keypairNameValue, "keypairName")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -2551,7 +2551,7 @@ func Test_iaasalpha_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetKeyPair", func(t *testing.T) { _apiUrlPath := "/v1alpha1/keypairs/{keypairName}" - keypairNameValue := "keypairName" + keypairNameValue := "keypairName-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"keypairName"+"}", url.PathEscape(ParameterValueToString(keypairNameValue, "keypairName")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -2605,7 +2605,7 @@ func Test_iaasalpha_DefaultApiService(t *testing.T) { _apiUrlPath := "/v1alpha1/projects/{projectId}/machine-types/{machineType}" projectIdValue := uuid.NewString() _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - machineTypeValue := "machineType" + machineTypeValue := "machineType-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"machineType"+"}", url.PathEscape(ParameterValueToString(machineTypeValue, "machineType")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -2944,7 +2944,7 @@ func Test_iaasalpha_DefaultApiService(t *testing.T) { _apiUrlPath := "/v1alpha1/organizations/{organizationId}/requests/{requestId}" organizationIdValue := uuid.NewString() _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) - requestIdValue := "requestId" + requestIdValue := "requestId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"requestId"+"}", url.PathEscape(ParameterValueToString(requestIdValue, "requestId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -3106,7 +3106,7 @@ func Test_iaasalpha_DefaultApiService(t *testing.T) { _apiUrlPath := "/v1alpha1/projects/{projectId}/requests/{requestId}" projectIdValue := uuid.NewString() _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - requestIdValue := "requestId" + requestIdValue := "requestId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"requestId"+"}", url.PathEscape(ParameterValueToString(requestIdValue, "requestId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -3662,7 +3662,7 @@ func Test_iaasalpha_DefaultApiService(t *testing.T) { _apiUrlPath := "/v1alpha1/projects/{projectId}/volume-performance-classes/{volumePerformanceClass}" projectIdValue := uuid.NewString() _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - volumePerformanceClassValue := "volumePerformanceClass" + volumePerformanceClassValue := "volumePerformanceClass-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"volumePerformanceClass"+"}", url.PathEscape(ParameterValueToString(volumePerformanceClassValue, "volumePerformanceClass")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -5508,7 +5508,7 @@ func Test_iaasalpha_DefaultApiService(t *testing.T) { _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) serverIdValue := uuid.NewString() _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) - serviceAccountMailValue := "serviceAccountMail" + serviceAccountMailValue := "serviceAccountMail-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serviceAccountMail"+"}", url.PathEscape(ParameterValueToString(serviceAccountMailValue, "serviceAccountMail")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -6352,7 +6352,7 @@ func Test_iaasalpha_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService UpdateKeyPair", func(t *testing.T) { _apiUrlPath := "/v1alpha1/keypairs/{keypairName}" - keypairNameValue := "keypairName" + keypairNameValue := "keypairName-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"keypairName"+"}", url.PathEscape(ParameterValueToString(keypairNameValue, "keypairName")), -1) testDefaultApiServeMux := http.NewServeMux() diff --git a/services/iaasalpha/client.go b/services/iaasalpha/client.go index de3841509..acb3cedda 100644 --- a/services/iaasalpha/client.go +++ b/services/iaasalpha/client.go @@ -308,7 +308,7 @@ func (c *APIClient) prepareRequest( var body *bytes.Buffer // Detect postBody type and post. - if postBody != nil { + if !IsNil(postBody) { contentType := headerParams["Content-Type"] if contentType == "" { contentType = detectContentType(postBody) diff --git a/services/loadbalancer/CHANGELOG.md b/services/loadbalancer/CHANGELOG.md index 71565a786..45bbfd403 100644 --- a/services/loadbalancer/CHANGELOG.md +++ b/services/loadbalancer/CHANGELOG.md @@ -1,3 +1,6 @@ +## v1.0.2 (2025-04-29) +- **Bugfix:** Correctly handle empty payload in body + ## v1.0.1 (2025-03-19) - **Bugfix:** Corrected regional setup of client diff --git a/services/loadbalancer/api_default_test.go b/services/loadbalancer/api_default_test.go index e7cf64e4e..7dd96dd67 100644 --- a/services/loadbalancer/api_default_test.go +++ b/services/loadbalancer/api_default_test.go @@ -25,9 +25,9 @@ func Test_loadbalancer_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService CreateCredentials", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/credentials" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -81,9 +81,9 @@ func Test_loadbalancer_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService CreateLoadBalancer", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/load-balancers" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -137,11 +137,11 @@ func Test_loadbalancer_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService DeleteCredentials", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/credentials/{credentialsRef}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - credentialsRefValue := "credentialsRef" + credentialsRefValue := "credentialsRef-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"credentialsRef"+"}", url.PathEscape(ParameterValueToString(credentialsRefValue, "credentialsRef")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -195,11 +195,11 @@ func Test_loadbalancer_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService DeleteLoadBalancer", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/load-balancers/{name}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - nameValue := "name" + nameValue := "name-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"name"+"}", url.PathEscape(ParameterValueToString(nameValue, "name")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -253,11 +253,11 @@ func Test_loadbalancer_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetCredentials", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/credentials/{credentialsRef}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - credentialsRefValue := "credentialsRef" + credentialsRefValue := "credentialsRef-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"credentialsRef"+"}", url.PathEscape(ParameterValueToString(credentialsRefValue, "credentialsRef")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -311,11 +311,11 @@ func Test_loadbalancer_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetLoadBalancer", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/load-balancers/{name}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - nameValue := "name" + nameValue := "name-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"name"+"}", url.PathEscape(ParameterValueToString(nameValue, "name")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -369,9 +369,9 @@ func Test_loadbalancer_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetQuota", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/quota" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -424,9 +424,9 @@ func Test_loadbalancer_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListCredentials", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/credentials" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -479,9 +479,9 @@ func Test_loadbalancer_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListLoadBalancers", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/load-balancers" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -534,7 +534,7 @@ func Test_loadbalancer_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListPlans", func(t *testing.T) { _apiUrlPath := "/v2/regions/{region}/plans" - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -586,11 +586,11 @@ func Test_loadbalancer_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService UpdateCredentials", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/credentials/{credentialsRef}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - credentialsRefValue := "credentialsRef" + credentialsRefValue := "credentialsRef-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"credentialsRef"+"}", url.PathEscape(ParameterValueToString(credentialsRefValue, "credentialsRef")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -645,11 +645,11 @@ func Test_loadbalancer_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService UpdateLoadBalancer", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/load-balancers/{name}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - nameValue := "name" + nameValue := "name-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"name"+"}", url.PathEscape(ParameterValueToString(nameValue, "name")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -704,13 +704,13 @@ func Test_loadbalancer_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService UpdateTargetPool", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/load-balancers/{name}/target-pools/{targetPoolName}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - nameValue := "name" + nameValue := "name-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"name"+"}", url.PathEscape(ParameterValueToString(nameValue, "name")), -1) - targetPoolNameValue := "targetPoolName" + targetPoolNameValue := "targetPoolName-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"targetPoolName"+"}", url.PathEscape(ParameterValueToString(targetPoolNameValue, "targetPoolName")), -1) testDefaultApiServeMux := http.NewServeMux() diff --git a/services/loadbalancer/client.go b/services/loadbalancer/client.go index 10777bb6b..9591a065a 100644 --- a/services/loadbalancer/client.go +++ b/services/loadbalancer/client.go @@ -305,7 +305,7 @@ func (c *APIClient) prepareRequest( var body *bytes.Buffer // Detect postBody type and post. - if postBody != nil { + if !IsNil(postBody) { contentType := headerParams["Content-Type"] if contentType == "" { contentType = detectContentType(postBody) diff --git a/services/logme/CHANGELOG.md b/services/logme/CHANGELOG.md index 510beb0f0..63f821c18 100644 --- a/services/logme/CHANGELOG.md +++ b/services/logme/CHANGELOG.md @@ -1,3 +1,6 @@ +## v0.22.1 (2025-04-29) +- **Bugfix:** Correctly handle empty payload in body + ## v0.22.0 (2025-04-03) - **Feature:** Adapt constants to evolved API. diff --git a/services/logme/api_default_test.go b/services/logme/api_default_test.go index 1d55d9b3e..96caced98 100644 --- a/services/logme/api_default_test.go +++ b/services/logme/api_default_test.go @@ -25,9 +25,9 @@ func Test_logme_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService CreateBackup", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/backups" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -80,9 +80,9 @@ func Test_logme_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService CreateCredentials", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/credentials" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -135,7 +135,7 @@ func Test_logme_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService CreateInstance", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -188,11 +188,11 @@ func Test_logme_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService DeleteCredentials", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/credentials/{credentialsId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - credentialsIdValue := "credentialsId" + credentialsIdValue := "credentialsId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"credentialsId"+"}", url.PathEscape(ParameterValueToString(credentialsIdValue, "credentialsId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -240,9 +240,9 @@ func Test_logme_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService DeleteInstance", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -291,9 +291,9 @@ func Test_logme_DefaultApiService(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/backups/{backupId}/download" backupIdValue := int32(123) _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(backupIdValue, "backupId")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -347,11 +347,11 @@ func Test_logme_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetCredentials", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/credentials/{credentialsId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - credentialsIdValue := "credentialsId" + credentialsIdValue := "credentialsId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"credentialsId"+"}", url.PathEscape(ParameterValueToString(credentialsIdValue, "credentialsId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -405,9 +405,9 @@ func Test_logme_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetInstance", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -460,9 +460,9 @@ func Test_logme_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetMetrics", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/metrics" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -515,9 +515,9 @@ func Test_logme_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListBackups", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/backups" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -570,9 +570,9 @@ func Test_logme_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListCredentials", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/credentials" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -625,7 +625,7 @@ func Test_logme_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListInstances", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -677,7 +677,7 @@ func Test_logme_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListOfferings", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/offerings" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -729,9 +729,9 @@ func Test_logme_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListRestores", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/restores" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -784,9 +784,9 @@ func Test_logme_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService PartialUpdateInstance", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -834,9 +834,9 @@ func Test_logme_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService TriggerRecreate", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/recreate" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -889,9 +889,9 @@ func Test_logme_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService TriggerRestart", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/restart" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -944,9 +944,9 @@ func Test_logme_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService TriggerRestore", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/backups/{backupId}/restore" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) backupIdValue := int32(123) _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(backupIdValue, "backupId")), -1) @@ -1002,9 +1002,9 @@ func Test_logme_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService UpdateBackupsConfig", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/backups-config" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() diff --git a/services/logme/client.go b/services/logme/client.go index b9b4fb9df..f6cc2130f 100644 --- a/services/logme/client.go +++ b/services/logme/client.go @@ -308,7 +308,7 @@ func (c *APIClient) prepareRequest( var body *bytes.Buffer // Detect postBody type and post. - if postBody != nil { + if !IsNil(postBody) { contentType := headerParams["Content-Type"] if contentType == "" { contentType = detectContentType(postBody) diff --git a/services/mariadb/CHANGELOG.md b/services/mariadb/CHANGELOG.md index a9874e9fd..1496d966f 100644 --- a/services/mariadb/CHANGELOG.md +++ b/services/mariadb/CHANGELOG.md @@ -1,3 +1,6 @@ +## v0.22.1 (2025-04-29) +- **Bugfix:** Correctly handle empty payload in body + ## v0.22.0 (2025-04-03) - **Feature:** Adapt constants to evolved API. diff --git a/services/mariadb/api_default_test.go b/services/mariadb/api_default_test.go index c1826dc45..1a9dc6bdc 100644 --- a/services/mariadb/api_default_test.go +++ b/services/mariadb/api_default_test.go @@ -25,9 +25,9 @@ func Test_mariadb_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService CreateBackup", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/backups" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -80,9 +80,9 @@ func Test_mariadb_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService CreateCredentials", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/credentials" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -135,7 +135,7 @@ func Test_mariadb_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService CreateInstance", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -188,11 +188,11 @@ func Test_mariadb_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService DeleteCredentials", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/credentials/{credentialsId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - credentialsIdValue := "credentialsId" + credentialsIdValue := "credentialsId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"credentialsId"+"}", url.PathEscape(ParameterValueToString(credentialsIdValue, "credentialsId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -240,9 +240,9 @@ func Test_mariadb_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService DeleteInstance", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -291,9 +291,9 @@ func Test_mariadb_DefaultApiService(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/backups/{backupId}/download" backupIdValue := int32(123) _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(backupIdValue, "backupId")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -347,11 +347,11 @@ func Test_mariadb_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetCredentials", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/credentials/{credentialsId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - credentialsIdValue := "credentialsId" + credentialsIdValue := "credentialsId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"credentialsId"+"}", url.PathEscape(ParameterValueToString(credentialsIdValue, "credentialsId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -405,9 +405,9 @@ func Test_mariadb_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetInstance", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -460,9 +460,9 @@ func Test_mariadb_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetMetrics", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/metrics" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -515,9 +515,9 @@ func Test_mariadb_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListBackups", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/backups" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -570,9 +570,9 @@ func Test_mariadb_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListCredentials", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/credentials" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -625,7 +625,7 @@ func Test_mariadb_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListInstances", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -677,7 +677,7 @@ func Test_mariadb_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListOfferings", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/offerings" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -729,9 +729,9 @@ func Test_mariadb_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListRestores", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/restores" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -784,9 +784,9 @@ func Test_mariadb_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService PartialUpdateInstance", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -834,9 +834,9 @@ func Test_mariadb_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService TriggerRecreate", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/recreate" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -889,9 +889,9 @@ func Test_mariadb_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService TriggerRestart", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/restart" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -944,9 +944,9 @@ func Test_mariadb_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService TriggerRestore", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/backups/{backupId}/restore" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) backupIdValue := int32(123) _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(backupIdValue, "backupId")), -1) @@ -1002,9 +1002,9 @@ func Test_mariadb_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService UpdateBackupsConfig", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/backups-config" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() diff --git a/services/mariadb/client.go b/services/mariadb/client.go index 5499ead36..f39ab60fa 100644 --- a/services/mariadb/client.go +++ b/services/mariadb/client.go @@ -308,7 +308,7 @@ func (c *APIClient) prepareRequest( var body *bytes.Buffer // Detect postBody type and post. - if postBody != nil { + if !IsNil(postBody) { contentType := headerParams["Content-Type"] if contentType == "" { contentType = detectContentType(postBody) diff --git a/services/mongodbflex/CHANGELOG.md b/services/mongodbflex/CHANGELOG.md index 8b83ee7cd..8ae7f5704 100644 --- a/services/mongodbflex/CHANGELOG.md +++ b/services/mongodbflex/CHANGELOG.md @@ -1,3 +1,6 @@ +## v0.18.2 (2025-04-29) +- **Bugfix:** Correctly handle empty payload in body + ## v0.18.1 (2025-03-19) - **Internal:** Backwards compatible change to generated code diff --git a/services/mongodbflex/client.go b/services/mongodbflex/client.go index 52fd62575..f3d429bf9 100644 --- a/services/mongodbflex/client.go +++ b/services/mongodbflex/client.go @@ -308,7 +308,7 @@ func (c *APIClient) prepareRequest( var body *bytes.Buffer // Detect postBody type and post. - if postBody != nil { + if !IsNil(postBody) { contentType := headerParams["Content-Type"] if contentType == "" { contentType = detectContentType(postBody) diff --git a/services/objectstorage/CHANGELOG.md b/services/objectstorage/CHANGELOG.md index eab69f43c..b3429642c 100644 --- a/services/objectstorage/CHANGELOG.md +++ b/services/objectstorage/CHANGELOG.md @@ -1,3 +1,6 @@ +## v1.1.2 (2025-04-29) +- **Bugfix:** Correctly handle empty payload in body + ## v1.1.1 (2025-03-19) - **Internal:** Backwards compatible change to generated code diff --git a/services/objectstorage/api_default_test.go b/services/objectstorage/api_default_test.go index b309399bf..78f5e34cd 100644 --- a/services/objectstorage/api_default_test.go +++ b/services/objectstorage/api_default_test.go @@ -25,9 +25,9 @@ func Test_objectstorage_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService CreateAccessKey", func(t *testing.T) { _apiUrlPath := "/v2/project/{projectId}/regions/{region}/access-key" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -81,11 +81,11 @@ func Test_objectstorage_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService CreateBucket", func(t *testing.T) { _apiUrlPath := "/v2/project/{projectId}/regions/{region}/bucket/{bucketName}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - bucketNameValue := "bucketName" + bucketNameValue := "bucketName-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"bucketName"+"}", url.PathEscape(ParameterValueToString(bucketNameValue, "bucketName")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -139,9 +139,9 @@ func Test_objectstorage_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService CreateCredentialsGroup", func(t *testing.T) { _apiUrlPath := "/v2/project/{projectId}/regions/{region}/credentials-group" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -195,11 +195,11 @@ func Test_objectstorage_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService DeleteAccessKey", func(t *testing.T) { _apiUrlPath := "/v2/project/{projectId}/regions/{region}/access-key/{keyId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - keyIdValue := "keyId" + keyIdValue := "keyId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"keyId"+"}", url.PathEscape(ParameterValueToString(keyIdValue, "keyId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -253,11 +253,11 @@ func Test_objectstorage_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService DeleteBucket", func(t *testing.T) { _apiUrlPath := "/v2/project/{projectId}/regions/{region}/bucket/{bucketName}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - bucketNameValue := "bucketName" + bucketNameValue := "bucketName-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"bucketName"+"}", url.PathEscape(ParameterValueToString(bucketNameValue, "bucketName")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -311,11 +311,11 @@ func Test_objectstorage_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService DeleteCredentialsGroup", func(t *testing.T) { _apiUrlPath := "/v2/project/{projectId}/regions/{region}/credentials-group/{groupId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - groupIdValue := "groupId" + groupIdValue := "groupId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"groupId"+"}", url.PathEscape(ParameterValueToString(groupIdValue, "groupId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -369,9 +369,9 @@ func Test_objectstorage_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService DisableService", func(t *testing.T) { _apiUrlPath := "/v2/project/{projectId}/regions/{region}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -424,9 +424,9 @@ func Test_objectstorage_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService EnableService", func(t *testing.T) { _apiUrlPath := "/v2/project/{projectId}/regions/{region}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -479,11 +479,11 @@ func Test_objectstorage_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetBucket", func(t *testing.T) { _apiUrlPath := "/v2/project/{projectId}/regions/{region}/bucket/{bucketName}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - bucketNameValue := "bucketName" + bucketNameValue := "bucketName-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"bucketName"+"}", url.PathEscape(ParameterValueToString(bucketNameValue, "bucketName")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -537,9 +537,9 @@ func Test_objectstorage_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetServiceStatus", func(t *testing.T) { _apiUrlPath := "/v2/project/{projectId}/regions/{region}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -592,9 +592,9 @@ func Test_objectstorage_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListAccessKeys", func(t *testing.T) { _apiUrlPath := "/v2/project/{projectId}/regions/{region}/access-keys" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -647,9 +647,9 @@ func Test_objectstorage_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListBuckets", func(t *testing.T) { _apiUrlPath := "/v2/project/{projectId}/regions/{region}/buckets" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -702,9 +702,9 @@ func Test_objectstorage_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListCredentialsGroups", func(t *testing.T) { _apiUrlPath := "/v2/project/{projectId}/regions/{region}/credentials-groups" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) testDefaultApiServeMux := http.NewServeMux() diff --git a/services/objectstorage/client.go b/services/objectstorage/client.go index 2bdb9c09a..21dcfe853 100644 --- a/services/objectstorage/client.go +++ b/services/objectstorage/client.go @@ -305,7 +305,7 @@ func (c *APIClient) prepareRequest( var body *bytes.Buffer // Detect postBody type and post. - if postBody != nil { + if !IsNil(postBody) { contentType := headerParams["Content-Type"] if contentType == "" { contentType = detectContentType(postBody) diff --git a/services/observability/CHANGELOG.md b/services/observability/CHANGELOG.md index 6a6620e45..d97e47bbf 100644 --- a/services/observability/CHANGELOG.md +++ b/services/observability/CHANGELOG.md @@ -1,3 +1,6 @@ +## v0.5.1 (2025-04-29) +- **Bugfix:** Correctly handle empty payload in body + ## v0.5.0 (2025-04-16) - **Feature:** Add new methods `ListLogsAlertgroups`, `CreateLogsAlertgroups`, `GetLogsAlertgroup`, `UpdateLogsAlertgroup`, `DeleteLogsAlertgroup` diff --git a/services/observability/api_default_test.go b/services/observability/api_default_test.go index 5e82b82c7..a977987e4 100644 --- a/services/observability/api_default_test.go +++ b/services/observability/api_default_test.go @@ -25,9 +25,9 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService CreateAlertConfigReceiver", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertconfigs/receivers" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -81,9 +81,9 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService CreateAlertConfigRoute", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertconfigs/routes" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -137,9 +137,9 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService CreateAlertgroups", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertgroups" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -193,11 +193,11 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService CreateAlertrules", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertgroups/{groupName}/alertrules" - groupNameValue := "groupName" + groupNameValue := "groupName-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"groupName"+"}", url.PathEscape(ParameterValueToString(groupNameValue, "groupName")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -252,9 +252,9 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService CreateCredentials", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/credentials" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -307,7 +307,7 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService CreateInstance", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -360,9 +360,9 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService CreateLogsAlertgroups", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/logs-alertgroups" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -416,9 +416,9 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService CreateScrapeConfig", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/scrapeconfigs" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -472,11 +472,11 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService DeleteAlertConfigReceiver", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertconfigs/receivers/{receiver}" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - receiverValue := "receiver" + receiverValue := "receiver-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"receiver"+"}", url.PathEscape(ParameterValueToString(receiverValue, "receiver")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -530,11 +530,11 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService DeleteAlertConfigRoute", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertconfigs/routes/{receiver}" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - receiverValue := "receiver" + receiverValue := "receiver-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"receiver"+"}", url.PathEscape(ParameterValueToString(receiverValue, "receiver")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -588,11 +588,11 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService DeleteAlertgroup", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertgroups/{groupName}" - groupNameValue := "groupName" + groupNameValue := "groupName-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"groupName"+"}", url.PathEscape(ParameterValueToString(groupNameValue, "groupName")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -646,9 +646,9 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService DeleteAlertgroups", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertgroups" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -702,11 +702,11 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService DeleteAlertrules", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertgroups/{groupName}/alertrules" - groupNameValue := "groupName" + groupNameValue := "groupName-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"groupName"+"}", url.PathEscape(ParameterValueToString(groupNameValue, "groupName")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -761,11 +761,11 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService DeleteCredentials", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/credentials/{username}" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - usernameValue := "username" + usernameValue := "username-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"username"+"}", url.PathEscape(ParameterValueToString(usernameValue, "username")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -819,11 +819,11 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService DeleteCredentialsRemoteWriteConfig", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/credentials/{username}/remote-write-limits" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - usernameValue := "username" + usernameValue := "username-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"username"+"}", url.PathEscape(ParameterValueToString(usernameValue, "username")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -877,9 +877,9 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService DeleteInstance", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -932,11 +932,11 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService DeleteLogsAlertgroup", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/logs-alertgroups/{groupName}" - groupNameValue := "groupName" + groupNameValue := "groupName-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"groupName"+"}", url.PathEscape(ParameterValueToString(groupNameValue, "groupName")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -990,11 +990,11 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService DeleteScrapeConfig", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/scrapeconfigs/{jobName}" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - jobNameValue := "jobName" + jobNameValue := "jobName-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"jobName"+"}", url.PathEscape(ParameterValueToString(jobNameValue, "jobName")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -1048,11 +1048,11 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetAlertConfigReceiver", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertconfigs/receivers/{receiver}" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - receiverValue := "receiver" + receiverValue := "receiver-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"receiver"+"}", url.PathEscape(ParameterValueToString(receiverValue, "receiver")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -1106,11 +1106,11 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetAlertConfigRoute", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertconfigs/routes/{receiver}" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - receiverValue := "receiver" + receiverValue := "receiver-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"receiver"+"}", url.PathEscape(ParameterValueToString(receiverValue, "receiver")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -1164,9 +1164,9 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetAlertConfigs", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertconfigs" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -1219,11 +1219,11 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetAlertgroup", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertgroups/{groupName}" - groupNameValue := "groupName" + groupNameValue := "groupName-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"groupName"+"}", url.PathEscape(ParameterValueToString(groupNameValue, "groupName")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -1277,11 +1277,11 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetCredentials", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/credentials/{username}" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - usernameValue := "username" + usernameValue := "username-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"username"+"}", url.PathEscape(ParameterValueToString(usernameValue, "username")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -1335,11 +1335,11 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetCredentialsRemoteWriteConfig", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/credentials/{username}/remote-write-limits" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - usernameValue := "username" + usernameValue := "username-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"username"+"}", url.PathEscape(ParameterValueToString(usernameValue, "username")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -1393,9 +1393,9 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetGrafanaConfigs", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/grafana-configs" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -1448,9 +1448,9 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetInstance", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -1503,11 +1503,11 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetLogsAlertgroup", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/logs-alertgroups/{groupName}" - groupNameValue := "groupName" + groupNameValue := "groupName-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"groupName"+"}", url.PathEscape(ParameterValueToString(groupNameValue, "groupName")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -1561,9 +1561,9 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetMetricsStorageRetention", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/metrics-storage-retentions" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -1616,11 +1616,11 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetScrapeConfig", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/scrapeconfigs/{jobName}" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - jobNameValue := "jobName" + jobNameValue := "jobName-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"jobName"+"}", url.PathEscape(ParameterValueToString(jobNameValue, "jobName")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -1674,9 +1674,9 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListACL", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/acl" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -1729,9 +1729,9 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListAlertConfigReceivers", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertconfigs/receivers" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -1784,9 +1784,9 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListAlertConfigRoutes", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertconfigs/routes" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -1839,9 +1839,9 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListAlertgroups", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertgroups" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -1894,11 +1894,11 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListAlertrules", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertgroups/{groupName}/alertrules" - groupNameValue := "groupName" + groupNameValue := "groupName-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"groupName"+"}", url.PathEscape(ParameterValueToString(groupNameValue, "groupName")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -1952,9 +1952,9 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListCredentials", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/credentials" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -2007,7 +2007,7 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListInstances", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -2059,9 +2059,9 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListLogsAlertgroups", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/logs-alertgroups" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -2114,7 +2114,7 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListPlans", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/plans" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -2166,9 +2166,9 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListScrapeConfigs", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/scrapeconfigs" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -2221,9 +2221,9 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService PartialUpdateAlertgroups", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertgroups" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -2277,11 +2277,11 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService PartialUpdateAlertrules", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertgroups/{groupName}/alertrules" - groupNameValue := "groupName" + groupNameValue := "groupName-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"groupName"+"}", url.PathEscape(ParameterValueToString(groupNameValue, "groupName")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -2336,9 +2336,9 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService UpdateACL", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/acl" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -2391,11 +2391,11 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService UpdateAlertConfigReceiver", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertconfigs/receivers/{receiver}" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - receiverValue := "receiver" + receiverValue := "receiver-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"receiver"+"}", url.PathEscape(ParameterValueToString(receiverValue, "receiver")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -2450,11 +2450,11 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService UpdateAlertConfigRoute", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertconfigs/routes/{receiver}" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - receiverValue := "receiver" + receiverValue := "receiver-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"receiver"+"}", url.PathEscape(ParameterValueToString(receiverValue, "receiver")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -2509,9 +2509,9 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService UpdateAlertConfigs", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertconfigs" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -2565,11 +2565,11 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService UpdateAlertgroup", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertgroups/{groupName}" - groupNameValue := "groupName" + groupNameValue := "groupName-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"groupName"+"}", url.PathEscape(ParameterValueToString(groupNameValue, "groupName")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -2624,9 +2624,9 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService UpdateAlertgroups", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertgroups" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -2680,11 +2680,11 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService UpdateCredentialsRemoteWriteConfig", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/credentials/{username}/remote-write-limits" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - usernameValue := "username" + usernameValue := "username-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"username"+"}", url.PathEscape(ParameterValueToString(usernameValue, "username")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -2739,9 +2739,9 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService UpdateGrafanaConfigs", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/grafana-configs" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -2795,9 +2795,9 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService UpdateInstance", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -2851,11 +2851,11 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService UpdateLogsAlertgroup", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/logs-alertgroups/{groupName}" - groupNameValue := "groupName" + groupNameValue := "groupName-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"groupName"+"}", url.PathEscape(ParameterValueToString(groupNameValue, "groupName")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -2910,9 +2910,9 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService UpdateMetricsStorageRetention", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/metrics-storage-retentions" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -2966,11 +2966,11 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService UpdateScrapeConfig", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/scrapeconfigs/{jobName}" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - jobNameValue := "jobName" + jobNameValue := "jobName-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"jobName"+"}", url.PathEscape(ParameterValueToString(jobNameValue, "jobName")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() diff --git a/services/observability/client.go b/services/observability/client.go index 4c2819027..197dc4867 100644 --- a/services/observability/client.go +++ b/services/observability/client.go @@ -308,7 +308,7 @@ func (c *APIClient) prepareRequest( var body *bytes.Buffer // Detect postBody type and post. - if postBody != nil { + if !IsNil(postBody) { contentType := headerParams["Content-Type"] if contentType == "" { contentType = detectContentType(postBody) diff --git a/services/opensearch/CHANGELOG.md b/services/opensearch/CHANGELOG.md index 79b22211f..99fe28063 100644 --- a/services/opensearch/CHANGELOG.md +++ b/services/opensearch/CHANGELOG.md @@ -1,3 +1,6 @@ +## v0.21.1 (2025-04-29) +- **Bugfix:** Correctly handle empty payload in body + ## v0.21.0 (2025-04-03) - **Feature:** Adapt constants to evolved API. diff --git a/services/opensearch/api_default_test.go b/services/opensearch/api_default_test.go index 72f773586..c83b2c93c 100644 --- a/services/opensearch/api_default_test.go +++ b/services/opensearch/api_default_test.go @@ -25,9 +25,9 @@ func Test_opensearch_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService CreateBackup", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/backups" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -80,9 +80,9 @@ func Test_opensearch_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService CreateCredentials", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/credentials" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -135,7 +135,7 @@ func Test_opensearch_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService CreateInstance", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -188,11 +188,11 @@ func Test_opensearch_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService DeleteCredentials", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/credentials/{credentialsId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - credentialsIdValue := "credentialsId" + credentialsIdValue := "credentialsId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"credentialsId"+"}", url.PathEscape(ParameterValueToString(credentialsIdValue, "credentialsId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -240,9 +240,9 @@ func Test_opensearch_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService DeleteInstance", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -291,9 +291,9 @@ func Test_opensearch_DefaultApiService(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/backups/{backupId}/download" backupIdValue := int32(123) _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(backupIdValue, "backupId")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -347,11 +347,11 @@ func Test_opensearch_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetCredentials", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/credentials/{credentialsId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - credentialsIdValue := "credentialsId" + credentialsIdValue := "credentialsId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"credentialsId"+"}", url.PathEscape(ParameterValueToString(credentialsIdValue, "credentialsId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -405,9 +405,9 @@ func Test_opensearch_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetInstance", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -460,9 +460,9 @@ func Test_opensearch_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetMetrics", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/metrics" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -515,9 +515,9 @@ func Test_opensearch_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListBackups", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/backups" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -570,9 +570,9 @@ func Test_opensearch_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListCredentials", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/credentials" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -625,7 +625,7 @@ func Test_opensearch_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListInstances", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -677,7 +677,7 @@ func Test_opensearch_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListOfferings", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/offerings" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -729,9 +729,9 @@ func Test_opensearch_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListRestores", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/restores" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -784,9 +784,9 @@ func Test_opensearch_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService PartialUpdateInstance", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -834,9 +834,9 @@ func Test_opensearch_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService TriggerRecreate", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/recreate" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -889,9 +889,9 @@ func Test_opensearch_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService TriggerRestart", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/restart" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -944,9 +944,9 @@ func Test_opensearch_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService TriggerRestore", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/backups/{backupId}/restore" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) backupIdValue := int32(123) _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(backupIdValue, "backupId")), -1) @@ -1002,9 +1002,9 @@ func Test_opensearch_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService UpdateBackupsConfig", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/backups-config" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() diff --git a/services/opensearch/client.go b/services/opensearch/client.go index 82053e0aa..4c85c6e50 100644 --- a/services/opensearch/client.go +++ b/services/opensearch/client.go @@ -308,7 +308,7 @@ func (c *APIClient) prepareRequest( var body *bytes.Buffer // Detect postBody type and post. - if postBody != nil { + if !IsNil(postBody) { contentType := headerParams["Content-Type"] if contentType == "" { contentType = detectContentType(postBody) diff --git a/services/postgresflex/CHANGELOG.md b/services/postgresflex/CHANGELOG.md index 5d4634333..d98e98e85 100644 --- a/services/postgresflex/CHANGELOG.md +++ b/services/postgresflex/CHANGELOG.md @@ -1,3 +1,6 @@ +## v1.0.3 (2025-04-29) +- **Bugfix:** Correctly handle empty payload in body + ## v1.0.2 (2025-03-19) - **Internal:** Backwards compatible change to generated code diff --git a/services/postgresflex/api_default_test.go b/services/postgresflex/api_default_test.go index 78b06ca50..fa66a0eb2 100644 --- a/services/postgresflex/api_default_test.go +++ b/services/postgresflex/api_default_test.go @@ -25,11 +25,11 @@ func Test_postgresflex_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService CloneInstance", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/instances/{instanceId}/clone" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -84,11 +84,11 @@ func Test_postgresflex_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService CreateDatabase", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/instances/{instanceId}/databases" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -143,9 +143,9 @@ func Test_postgresflex_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService CreateInstance", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/instances" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -199,11 +199,11 @@ func Test_postgresflex_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService CreateUser", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/instances/{instanceId}/users" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -258,13 +258,13 @@ func Test_postgresflex_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService DeleteDatabase", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/instances/{instanceId}/databases/{databaseId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - databaseIdValue := "databaseId" + databaseIdValue := "databaseId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"databaseId"+"}", url.PathEscape(ParameterValueToString(databaseIdValue, "databaseId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -313,11 +313,11 @@ func Test_postgresflex_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService DeleteInstance", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/instances/{instanceId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -365,13 +365,13 @@ func Test_postgresflex_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService DeleteUser", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/instances/{instanceId}/users/{userId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - userIdValue := "userId" + userIdValue := "userId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"userId"+"}", url.PathEscape(ParameterValueToString(userIdValue, "userId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -420,11 +420,11 @@ func Test_postgresflex_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ForceDeleteInstance", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/instances/{instanceId}/force" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -472,13 +472,13 @@ func Test_postgresflex_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetBackup", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/instances/{instanceId}/backups/{backupId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - backupIdValue := "backupId" + backupIdValue := "backupId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(backupIdValue, "backupId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -533,11 +533,11 @@ func Test_postgresflex_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetInstance", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/instances/{instanceId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -591,13 +591,13 @@ func Test_postgresflex_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetUser", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/instances/{instanceId}/users/{userId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - userIdValue := "userId" + userIdValue := "userId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"userId"+"}", url.PathEscape(ParameterValueToString(userIdValue, "userId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -652,11 +652,11 @@ func Test_postgresflex_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListBackups", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/instances/{instanceId}/backups" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -710,11 +710,11 @@ func Test_postgresflex_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListDatabaseParameters", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/instances/{instanceId}/parameter" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -768,11 +768,11 @@ func Test_postgresflex_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListDatabases", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/instances/{instanceId}/databases" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -826,9 +826,9 @@ func Test_postgresflex_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListFlavors", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/flavors" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -881,9 +881,9 @@ func Test_postgresflex_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListInstances", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/instances" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -936,13 +936,13 @@ func Test_postgresflex_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListMetrics", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/instances/{instanceId}/metrics/{metric}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - metricValue := "metric" + metricValue := "metric-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"metric"+"}", url.PathEscape(ParameterValueToString(metricValue, "metric")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -998,11 +998,11 @@ func Test_postgresflex_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListStorages", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/storages/{flavorId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - flavorIdValue := "flavorId" + flavorIdValue := "flavorId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"flavorId"+"}", url.PathEscape(ParameterValueToString(flavorIdValue, "flavorId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -1056,11 +1056,11 @@ func Test_postgresflex_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListUsers", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/instances/{instanceId}/users" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -1114,9 +1114,9 @@ func Test_postgresflex_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListVersions", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/versions" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -1169,11 +1169,11 @@ func Test_postgresflex_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService PartialUpdateInstance", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/instances/{instanceId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -1228,13 +1228,13 @@ func Test_postgresflex_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService PartialUpdateUser", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/instances/{instanceId}/users/{userId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - userIdValue := "userId" + userIdValue := "userId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"userId"+"}", url.PathEscape(ParameterValueToString(userIdValue, "userId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -1283,13 +1283,13 @@ func Test_postgresflex_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ResetUser", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/instances/{instanceId}/users/{userId}/reset" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - userIdValue := "userId" + userIdValue := "userId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"userId"+"}", url.PathEscape(ParameterValueToString(userIdValue, "userId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -1344,11 +1344,11 @@ func Test_postgresflex_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService UpdateBackupSchedule", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/instances/{instanceId}/backups" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -1397,11 +1397,11 @@ func Test_postgresflex_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService UpdateInstance", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/instances/{instanceId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -1456,13 +1456,13 @@ func Test_postgresflex_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService UpdateUser", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/instances/{instanceId}/users/{userId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - userIdValue := "userId" + userIdValue := "userId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"userId"+"}", url.PathEscape(ParameterValueToString(userIdValue, "userId")), -1) testDefaultApiServeMux := http.NewServeMux() diff --git a/services/postgresflex/client.go b/services/postgresflex/client.go index 28d9726e0..56fce4f8f 100644 --- a/services/postgresflex/client.go +++ b/services/postgresflex/client.go @@ -305,7 +305,7 @@ func (c *APIClient) prepareRequest( var body *bytes.Buffer // Detect postBody type and post. - if postBody != nil { + if !IsNil(postBody) { contentType := headerParams["Content-Type"] if contentType == "" { contentType = detectContentType(postBody) diff --git a/services/rabbitmq/CHANGELOG.md b/services/rabbitmq/CHANGELOG.md index e5fb35ba5..84d9e5209 100644 --- a/services/rabbitmq/CHANGELOG.md +++ b/services/rabbitmq/CHANGELOG.md @@ -1,3 +1,6 @@ +## v0.22.1 (2025-04-29) +- **Bugfix:** Correctly handle empty payload in body + ## v0.22.0 (2025-04-03) - **Feature:** Adapt constants to evolved API. diff --git a/services/rabbitmq/api_default_test.go b/services/rabbitmq/api_default_test.go index 3f67c73cb..b0ac1b36d 100644 --- a/services/rabbitmq/api_default_test.go +++ b/services/rabbitmq/api_default_test.go @@ -25,9 +25,9 @@ func Test_rabbitmq_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService CreateBackup", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/backups" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -80,9 +80,9 @@ func Test_rabbitmq_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService CreateCredentials", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/credentials" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -135,7 +135,7 @@ func Test_rabbitmq_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService CreateInstance", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -188,11 +188,11 @@ func Test_rabbitmq_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService DeleteCredentials", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/credentials/{credentialsId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - credentialsIdValue := "credentialsId" + credentialsIdValue := "credentialsId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"credentialsId"+"}", url.PathEscape(ParameterValueToString(credentialsIdValue, "credentialsId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -240,9 +240,9 @@ func Test_rabbitmq_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService DeleteInstance", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -291,9 +291,9 @@ func Test_rabbitmq_DefaultApiService(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/backups/{backupId}/download" backupIdValue := int32(123) _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(backupIdValue, "backupId")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -347,11 +347,11 @@ func Test_rabbitmq_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetCredentials", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/credentials/{credentialsId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - credentialsIdValue := "credentialsId" + credentialsIdValue := "credentialsId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"credentialsId"+"}", url.PathEscape(ParameterValueToString(credentialsIdValue, "credentialsId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -405,9 +405,9 @@ func Test_rabbitmq_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetInstance", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -460,9 +460,9 @@ func Test_rabbitmq_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetMetrics", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/metrics" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -515,9 +515,9 @@ func Test_rabbitmq_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListBackups", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/backups" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -570,9 +570,9 @@ func Test_rabbitmq_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListCredentials", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/credentials" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -625,7 +625,7 @@ func Test_rabbitmq_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListInstances", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -677,7 +677,7 @@ func Test_rabbitmq_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListOfferings", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/offerings" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -729,9 +729,9 @@ func Test_rabbitmq_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListRestores", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/restores" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -784,9 +784,9 @@ func Test_rabbitmq_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService PartialUpdateInstance", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -834,9 +834,9 @@ func Test_rabbitmq_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService TriggerRecreate", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/recreate" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -889,9 +889,9 @@ func Test_rabbitmq_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService TriggerRestart", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/restart" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -944,9 +944,9 @@ func Test_rabbitmq_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService TriggerRestore", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/backups/{backupId}/restore" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) backupIdValue := int32(123) _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(backupIdValue, "backupId")), -1) @@ -1002,9 +1002,9 @@ func Test_rabbitmq_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService UpdateBackupsConfig", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/backups-config" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() diff --git a/services/rabbitmq/client.go b/services/rabbitmq/client.go index 9c0d6c395..4d81e97eb 100644 --- a/services/rabbitmq/client.go +++ b/services/rabbitmq/client.go @@ -308,7 +308,7 @@ func (c *APIClient) prepareRequest( var body *bytes.Buffer // Detect postBody type and post. - if postBody != nil { + if !IsNil(postBody) { contentType := headerParams["Content-Type"] if contentType == "" { contentType = detectContentType(postBody) diff --git a/services/redis/CHANGELOG.md b/services/redis/CHANGELOG.md index 4de529464..582264346 100644 --- a/services/redis/CHANGELOG.md +++ b/services/redis/CHANGELOG.md @@ -1,3 +1,6 @@ +## v0.22.1 (2025-04-29) +- **Bugfix:** Correctly handle empty payload in body + ## v0.22.0 (2025-04-03) - **Feature:** Adapt constants to evolved API. diff --git a/services/redis/api_default_test.go b/services/redis/api_default_test.go index 0a2cc0de3..6b3d6141e 100644 --- a/services/redis/api_default_test.go +++ b/services/redis/api_default_test.go @@ -25,9 +25,9 @@ func Test_redis_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService CreateBackup", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/backups" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -80,9 +80,9 @@ func Test_redis_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService CreateCredentials", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/credentials" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -135,7 +135,7 @@ func Test_redis_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService CreateInstance", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -188,11 +188,11 @@ func Test_redis_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService DeleteCredentials", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/credentials/{credentialsId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - credentialsIdValue := "credentialsId" + credentialsIdValue := "credentialsId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"credentialsId"+"}", url.PathEscape(ParameterValueToString(credentialsIdValue, "credentialsId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -240,9 +240,9 @@ func Test_redis_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService DeleteInstance", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -291,9 +291,9 @@ func Test_redis_DefaultApiService(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/backups/{backupId}/download" backupIdValue := int32(123) _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(backupIdValue, "backupId")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -347,11 +347,11 @@ func Test_redis_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetCredentials", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/credentials/{credentialsId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - credentialsIdValue := "credentialsId" + credentialsIdValue := "credentialsId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"credentialsId"+"}", url.PathEscape(ParameterValueToString(credentialsIdValue, "credentialsId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -405,9 +405,9 @@ func Test_redis_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetInstance", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -460,9 +460,9 @@ func Test_redis_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetMetrics", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/metrics" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -515,9 +515,9 @@ func Test_redis_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListBackups", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/backups" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -570,9 +570,9 @@ func Test_redis_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListCredentials", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/credentials" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -625,7 +625,7 @@ func Test_redis_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListInstances", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -677,7 +677,7 @@ func Test_redis_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListOfferings", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/offerings" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -729,9 +729,9 @@ func Test_redis_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListRestores", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/restores" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -784,9 +784,9 @@ func Test_redis_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService PartialUpdateInstance", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -834,9 +834,9 @@ func Test_redis_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService TriggerRecreate", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/recreate" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -889,9 +889,9 @@ func Test_redis_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService TriggerRestart", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/restart" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -944,9 +944,9 @@ func Test_redis_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService TriggerRestore", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/backups/{backupId}/restore" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) backupIdValue := int32(123) _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(backupIdValue, "backupId")), -1) @@ -1002,9 +1002,9 @@ func Test_redis_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService UpdateBackupsConfig", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/backups-config" - instanceIdValue := "instanceId" + instanceIdValue := "instanceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() diff --git a/services/redis/client.go b/services/redis/client.go index f001fa727..aef11cd82 100644 --- a/services/redis/client.go +++ b/services/redis/client.go @@ -308,7 +308,7 @@ func (c *APIClient) prepareRequest( var body *bytes.Buffer // Detect postBody type and post. - if postBody != nil { + if !IsNil(postBody) { contentType := headerParams["Content-Type"] if contentType == "" { contentType = detectContentType(postBody) diff --git a/services/runcommand/CHANGELOG.md b/services/runcommand/CHANGELOG.md index 3512a5f9c..55d1abf89 100644 --- a/services/runcommand/CHANGELOG.md +++ b/services/runcommand/CHANGELOG.md @@ -1,3 +1,6 @@ +## v1.0.1 (2025-04-29) +- **Bugfix:** Correctly handle empty payload in body + ## v1.0.0 (2025-03-19) - **Breaking Change:** The region is no longer specified within the client configuration. Instead, the region must be passed as a parameter to any region-specific request. diff --git a/services/runcommand/api_default_test.go b/services/runcommand/api_default_test.go index bc1341399..a8859181d 100644 --- a/services/runcommand/api_default_test.go +++ b/services/runcommand/api_default_test.go @@ -25,11 +25,11 @@ func Test_runcommand_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService CreateCommand", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/commands" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - serverIdValue := "serverId" + serverIdValue := "serverId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -83,13 +83,13 @@ func Test_runcommand_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetCommand", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/commands/{commandId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - serverIdValue := "serverId" + serverIdValue := "serverId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) - commandIdValue := "commandId" + commandIdValue := "commandId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"commandId"+"}", url.PathEscape(ParameterValueToString(commandIdValue, "commandId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -144,13 +144,13 @@ func Test_runcommand_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetCommandTemplate", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/command-templates/{commandTemplateName}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - serverIdValue := "serverId" + serverIdValue := "serverId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) - commandTemplateNameValue := "commandTemplateName" + commandTemplateNameValue := "commandTemplateName-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"commandTemplateName"+"}", url.PathEscape(ParameterValueToString(commandTemplateNameValue, "commandTemplateName")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -253,11 +253,11 @@ func Test_runcommand_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListCommands", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/commands" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - serverIdValue := "serverId" + serverIdValue := "serverId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) testDefaultApiServeMux := http.NewServeMux() diff --git a/services/runcommand/client.go b/services/runcommand/client.go index 5c5066291..677afee80 100644 --- a/services/runcommand/client.go +++ b/services/runcommand/client.go @@ -308,7 +308,7 @@ func (c *APIClient) prepareRequest( var body *bytes.Buffer // Detect postBody type and post. - if postBody != nil { + if !IsNil(postBody) { contentType := headerParams["Content-Type"] if contentType == "" { contentType = detectContentType(postBody) diff --git a/services/secretsmanager/CHANGELOG.md b/services/secretsmanager/CHANGELOG.md index 1fc8a2b5c..02a6347fd 100644 --- a/services/secretsmanager/CHANGELOG.md +++ b/services/secretsmanager/CHANGELOG.md @@ -1,3 +1,6 @@ +## v0.11.3 (2025-04-29) +- **Bugfix:** Correctly handle empty payload in body + ## v0.11.2 (2025-03-20) - **Improvement:** Error handling - **Feature:** Add description to `UpdateUserPayload` diff --git a/services/secretsmanager/client.go b/services/secretsmanager/client.go index 8466e7b28..4fab6a423 100644 --- a/services/secretsmanager/client.go +++ b/services/secretsmanager/client.go @@ -308,7 +308,7 @@ func (c *APIClient) prepareRequest( var body *bytes.Buffer // Detect postBody type and post. - if postBody != nil { + if !IsNil(postBody) { contentType := headerParams["Content-Type"] if contentType == "" { contentType = detectContentType(postBody) diff --git a/services/serverbackup/CHANGELOG.md b/services/serverbackup/CHANGELOG.md index a5d5d4dc1..223c9cf56 100644 --- a/services/serverbackup/CHANGELOG.md +++ b/services/serverbackup/CHANGELOG.md @@ -1,3 +1,6 @@ +## v1.0.2 (2025-04-29) +- **Bugfix:** Correctly handle empty payload in body + ## v1.0.1 (2025-03-27) - **Bugfix:** Removed ConfigureRegion() from API client diff --git a/services/serverbackup/api_default_test.go b/services/serverbackup/api_default_test.go index 5157f42a2..2883d848a 100644 --- a/services/serverbackup/api_default_test.go +++ b/services/serverbackup/api_default_test.go @@ -25,11 +25,11 @@ func Test_serverbackup_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService CreateBackup", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/backups" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - serverIdValue := "serverId" + serverIdValue := "serverId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -83,11 +83,11 @@ func Test_serverbackup_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService CreateBackupSchedule", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/backup-schedules" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - serverIdValue := "serverId" + serverIdValue := "serverId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -141,13 +141,13 @@ func Test_serverbackup_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService DeleteBackup", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/backups/{backupId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - serverIdValue := "serverId" + serverIdValue := "serverId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - backupIdValue := "backupId" + backupIdValue := "backupId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(backupIdValue, "backupId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -196,13 +196,13 @@ func Test_serverbackup_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService DeleteBackupSchedule", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/backup-schedules/{backupScheduleId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - serverIdValue := "serverId" + serverIdValue := "serverId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - backupScheduleIdValue := "backupScheduleId" + backupScheduleIdValue := "backupScheduleId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"backupScheduleId"+"}", url.PathEscape(ParameterValueToString(backupScheduleIdValue, "backupScheduleId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -251,15 +251,15 @@ func Test_serverbackup_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService DeleteVolumeBackup", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/backups/{backupId}/volume-backups/{volumeBackupId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - serverIdValue := "serverId" + serverIdValue := "serverId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - backupIdValue := "backupId" + backupIdValue := "backupId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(backupIdValue, "backupId")), -1) - volumeBackupIdValue := "volumeBackupId" + volumeBackupIdValue := "volumeBackupId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"volumeBackupId"+"}", url.PathEscape(ParameterValueToString(volumeBackupIdValue, "volumeBackupId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -309,11 +309,11 @@ func Test_serverbackup_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService DisableServiceResource", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/service" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - serverIdValue := "serverId" + serverIdValue := "serverId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -361,11 +361,11 @@ func Test_serverbackup_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService EnableServiceResource", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/service" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - serverIdValue := "serverId" + serverIdValue := "serverId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -413,13 +413,13 @@ func Test_serverbackup_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetBackup", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/backups/{backupId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - serverIdValue := "serverId" + serverIdValue := "serverId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - backupIdValue := "backupId" + backupIdValue := "backupId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(backupIdValue, "backupId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -474,13 +474,13 @@ func Test_serverbackup_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetBackupSchedule", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/backup-schedules/{backupScheduleId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - serverIdValue := "serverId" + serverIdValue := "serverId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - backupScheduleIdValue := "backupScheduleId" + backupScheduleIdValue := "backupScheduleId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"backupScheduleId"+"}", url.PathEscape(ParameterValueToString(backupScheduleIdValue, "backupScheduleId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -535,11 +535,11 @@ func Test_serverbackup_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetServiceResource", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/service" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - serverIdValue := "serverId" + serverIdValue := "serverId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -593,7 +593,7 @@ func Test_serverbackup_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListBackupPolicies", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/backup-policies" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -645,11 +645,11 @@ func Test_serverbackup_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListBackupSchedules", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/backup-schedules" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - serverIdValue := "serverId" + serverIdValue := "serverId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -703,11 +703,11 @@ func Test_serverbackup_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListBackups", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/backups" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - serverIdValue := "serverId" + serverIdValue := "serverId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -761,13 +761,13 @@ func Test_serverbackup_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService RestoreBackup", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/backups/{backupId}/restore" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - serverIdValue := "serverId" + serverIdValue := "serverId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - backupIdValue := "backupId" + backupIdValue := "backupId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(backupIdValue, "backupId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -816,15 +816,15 @@ func Test_serverbackup_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService RestoreVolumeBackup", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/backups/{backupId}/volume-backups/{volumeBackupId}/restore" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - serverIdValue := "serverId" + serverIdValue := "serverId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - backupIdValue := "backupId" + backupIdValue := "backupId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(backupIdValue, "backupId")), -1) - volumeBackupIdValue := "volumeBackupId" + volumeBackupIdValue := "volumeBackupId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"volumeBackupId"+"}", url.PathEscape(ParameterValueToString(volumeBackupIdValue, "volumeBackupId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -874,13 +874,13 @@ func Test_serverbackup_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService UpdateBackupSchedule", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/backup-schedules/{backupScheduleId}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - serverIdValue := "serverId" + serverIdValue := "serverId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - backupScheduleIdValue := "backupScheduleId" + backupScheduleIdValue := "backupScheduleId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"backupScheduleId"+"}", url.PathEscape(ParameterValueToString(backupScheduleIdValue, "backupScheduleId")), -1) testDefaultApiServeMux := http.NewServeMux() diff --git a/services/serverbackup/client.go b/services/serverbackup/client.go index 4a94284e3..59e211c78 100644 --- a/services/serverbackup/client.go +++ b/services/serverbackup/client.go @@ -305,7 +305,7 @@ func (c *APIClient) prepareRequest( var body *bytes.Buffer // Detect postBody type and post. - if postBody != nil { + if !IsNil(postBody) { contentType := headerParams["Content-Type"] if contentType == "" { contentType = detectContentType(postBody) diff --git a/services/serviceenablement/CHANGELOG.md b/services/serviceenablement/CHANGELOG.md index 6544a9517..79a70a902 100644 --- a/services/serviceenablement/CHANGELOG.md +++ b/services/serviceenablement/CHANGELOG.md @@ -1,3 +1,6 @@ +## v1.0.2 (2025-04-29) +- **Bugfix:** Correctly handle empty payload in body + ## v1.0.1 (2025-03-19) - **Internal:** Backwards compatible change to generated code diff --git a/services/serviceenablement/api_default_test.go b/services/serviceenablement/api_default_test.go index 9a148d337..a17486cf0 100644 --- a/services/serviceenablement/api_default_test.go +++ b/services/serviceenablement/api_default_test.go @@ -25,11 +25,11 @@ func Test_serviceenablement_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService DisableServiceRegional", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/services/{serviceId}" - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - serviceIdValue := "serviceId" + serviceIdValue := "serviceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serviceId"+"}", url.PathEscape(ParameterValueToString(serviceIdValue, "serviceId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -77,11 +77,11 @@ func Test_serviceenablement_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService EnableServiceRegional", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/services/{serviceId}" - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - serviceIdValue := "serviceId" + serviceIdValue := "serviceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serviceId"+"}", url.PathEscape(ParameterValueToString(serviceIdValue, "serviceId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -129,11 +129,11 @@ func Test_serviceenablement_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetServiceStatusRegional", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/services/{serviceId}" - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - serviceIdValue := "serviceId" + serviceIdValue := "serviceId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serviceId"+"}", url.PathEscape(ParameterValueToString(serviceIdValue, "serviceId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -187,9 +187,9 @@ func Test_serviceenablement_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListServiceStatusRegional", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/services" - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() diff --git a/services/serviceenablement/client.go b/services/serviceenablement/client.go index f6795f163..70a4693aa 100644 --- a/services/serviceenablement/client.go +++ b/services/serviceenablement/client.go @@ -305,7 +305,7 @@ func (c *APIClient) prepareRequest( var body *bytes.Buffer // Detect postBody type and post. - if postBody != nil { + if !IsNil(postBody) { contentType := headerParams["Content-Type"] if contentType == "" { contentType = detectContentType(postBody) diff --git a/services/ske/CHANGELOG.md b/services/ske/CHANGELOG.md index e51ac4004..c4628fd38 100644 --- a/services/ske/CHANGELOG.md +++ b/services/ske/CHANGELOG.md @@ -1,3 +1,6 @@ +## v0.22.2 (2025-04-29) +- **Bugfix:** Correctly handle empty payload in body + ## v0.22.1 (2025-03-19) - **Internal:** Backwards compatible change to generated code diff --git a/services/ske/api_default_test.go b/services/ske/api_default_test.go index d0bb579f6..14f37d2f0 100644 --- a/services/ske/api_default_test.go +++ b/services/ske/api_default_test.go @@ -25,9 +25,9 @@ func Test_ske_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService CompleteCredentialsRotation", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/clusters/{clusterName}/complete-credentials-rotation" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - clusterNameValue := "clusterName" + clusterNameValue := "clusterName-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"clusterName"+"}", url.PathEscape(ParameterValueToString(clusterNameValue, "clusterName")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -80,9 +80,9 @@ func Test_ske_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService CreateKubeconfig", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/clusters/{clusterName}/kubeconfig" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - clusterNameValue := "clusterName" + clusterNameValue := "clusterName-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"clusterName"+"}", url.PathEscape(ParameterValueToString(clusterNameValue, "clusterName")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -136,9 +136,9 @@ func Test_ske_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService CreateOrUpdateCluster", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/clusters/{clusterName}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - clusterNameValue := "clusterName" + clusterNameValue := "clusterName-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"clusterName"+"}", url.PathEscape(ParameterValueToString(clusterNameValue, "clusterName")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -192,9 +192,9 @@ func Test_ske_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService DeleteCluster", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/clusters/{clusterName}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - clusterNameValue := "clusterName" + clusterNameValue := "clusterName-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"clusterName"+"}", url.PathEscape(ParameterValueToString(clusterNameValue, "clusterName")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -247,9 +247,9 @@ func Test_ske_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetCluster", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/clusters/{clusterName}" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - clusterNameValue := "clusterName" + clusterNameValue := "clusterName-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"clusterName"+"}", url.PathEscape(ParameterValueToString(clusterNameValue, "clusterName")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -302,9 +302,9 @@ func Test_ske_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetLoginKubeconfig", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/clusters/{clusterName}/kubeconfig/login" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - clusterNameValue := "clusterName" + clusterNameValue := "clusterName-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"clusterName"+"}", url.PathEscape(ParameterValueToString(clusterNameValue, "clusterName")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -357,7 +357,7 @@ func Test_ske_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListClusters", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/clusters" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -457,9 +457,9 @@ func Test_ske_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService StartCredentialsRotation", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/clusters/{clusterName}/start-credentials-rotation" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - clusterNameValue := "clusterName" + clusterNameValue := "clusterName-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"clusterName"+"}", url.PathEscape(ParameterValueToString(clusterNameValue, "clusterName")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -512,9 +512,9 @@ func Test_ske_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService TriggerHibernate", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/clusters/{clusterName}/hibernate" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - clusterNameValue := "clusterName" + clusterNameValue := "clusterName-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"clusterName"+"}", url.PathEscape(ParameterValueToString(clusterNameValue, "clusterName")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -567,9 +567,9 @@ func Test_ske_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService TriggerMaintenance", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/clusters/{clusterName}/maintenance" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - clusterNameValue := "clusterName" + clusterNameValue := "clusterName-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"clusterName"+"}", url.PathEscape(ParameterValueToString(clusterNameValue, "clusterName")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -622,9 +622,9 @@ func Test_ske_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService TriggerReconcile", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/clusters/{clusterName}/reconcile" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - clusterNameValue := "clusterName" + clusterNameValue := "clusterName-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"clusterName"+"}", url.PathEscape(ParameterValueToString(clusterNameValue, "clusterName")), -1) testDefaultApiServeMux := http.NewServeMux() diff --git a/services/ske/client.go b/services/ske/client.go index a403a24be..d39a26a4a 100644 --- a/services/ske/client.go +++ b/services/ske/client.go @@ -308,7 +308,7 @@ func (c *APIClient) prepareRequest( var body *bytes.Buffer // Detect postBody type and post. - if postBody != nil { + if !IsNil(postBody) { contentType := headerParams["Content-Type"] if contentType == "" { contentType = detectContentType(postBody) diff --git a/services/sqlserverflex/CHANGELOG.md b/services/sqlserverflex/CHANGELOG.md index 21bf00fbf..a02a649de 100644 --- a/services/sqlserverflex/CHANGELOG.md +++ b/services/sqlserverflex/CHANGELOG.md @@ -1,3 +1,6 @@ +## v1.0.2 (2025-04-29) +- **Bugfix:** Correctly handle empty payload in body + ## v1.0.1 (2025-03-19) - **Internal:** Backwards compatible change to generated code diff --git a/services/sqlserverflex/client.go b/services/sqlserverflex/client.go index 1a5506ab5..9ea8afe48 100644 --- a/services/sqlserverflex/client.go +++ b/services/sqlserverflex/client.go @@ -305,7 +305,7 @@ func (c *APIClient) prepareRequest( var body *bytes.Buffer // Detect postBody type and post. - if postBody != nil { + if !IsNil(postBody) { contentType := headerParams["Content-Type"] if contentType == "" { contentType = detectContentType(postBody) From 8771639f1aba1479abeb6cca76348d8e22cea2da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ruben=20H=C3=B6nle?= Date: Tue, 29 Apr 2025 15:54:58 +0200 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Marcel Jacek <72880145+marceljk@users.noreply.github.com> --- CHANGELOG.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 73d63411a..2138b09d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,7 +25,7 @@ - **Bugfix:** Correctly handle empty payload in body - `sqlserverflex`: [v1.0.2](services/sqlserverflex/CHANGELOG.md#v102-2025-04-29) - **Bugfix:** Correctly handle empty payload in body -- `sqlserverflex`: [v0.22.2](services/ske/CHANGELOG.md#v0222-2025-04-29) +- `ske`: [v0.22.2](services/ske/CHANGELOG.md#v0222-2025-04-29) - **Bugfix:** Correctly handle empty payload in body - `serviceenablement`: [v1.0.2](services/serviceenablement/CHANGELOG.md#v102-2025-04-29) - **Bugfix:** Correctly handle empty payload in body @@ -35,7 +35,7 @@ - **Bugfix:** Correctly handle empty payload in body - `runcommand`: [v1.0.1](services/runcommand/CHANGELOG.md#v101-2025-04-29) - **Bugfix:** Correctly handle empty payload in body -- `redis`: [v0.22.1](services/runcommand/CHANGELOG.md#v0221-2025-04-29) +- `redis`: [v0.22.1](services/redis/CHANGELOG.md#v0221-2025-04-29) - **Bugfix:** Correctly handle empty payload in body - `rabbitmq`: [v0.22.1](services/rabbitmq/CHANGELOG.md#v0221-2025-04-29) - **Bugfix:** Correctly handle empty payload in body @@ -45,13 +45,13 @@ - **Bugfix:** Correctly handle empty payload in body - `objectstorage`: [v1.1.2](services/objectstorage/CHANGELOG.md#v112-2025-04-29) - **Bugfix:** Correctly handle empty payload in body -- `mongodbflex`: [v0.18.2](services/objectstorage/CHANGELOG.md#v0182-2025-04-29) +- `mongodbflex`: [v0.18.2](services/mongodbflex/CHANGELOG.md#v0182-2025-04-29) - **Bugfix:** Correctly handle empty payload in body -- `mariadb`: [v0.22.1](services/objectstorage/CHANGELOG.md#v0221-2025-04-29) +- `mariadb`: [v0.22.1](services/mariadb/CHANGELOG.md#v0221-2025-04-29) - **Bugfix:** Correctly handle empty payload in body - `logme`: [v0.22.1](services/logme/CHANGELOG.md#v0221-2025-04-29) - **Bugfix:** Correctly handle empty payload in body -- `loadbalancer`: [v1.0.2](services/logme/CHANGELOG.md#v102-2025-04-29) +- `loadbalancer`: [v1.0.2](services/loadbalancer/CHANGELOG.md#v102-2025-04-29) - **Bugfix:** Correctly handle empty payload in body - `iaas`: [v0.22.1](services/iaas/CHANGELOG.md#v0221-2025-04-29) - **Bugfix:** Correctly handle empty payload in body @@ -61,7 +61,7 @@ - **Bugfix:** Correctly handle empty payload in body - `cdn`: [v0.3.1](services/cdn/CHANGELOG.md#v031-2025-04-29) - **Bugfix:** Correctly handle empty payload in body -- `authorization`: [v0.6.2](services/cdn/CHANGELOG.md#v062-2025-04-29) +- `authorization`: [v0.6.2](services/authorization/CHANGELOG.md#v062-2025-04-29) - **Bugfix:** Correctly handle empty payload in body ## Release (2025-04-09)