From 9561ef1c6f84c5965fcdb5896e73a5c976d9c204 Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Tue, 29 Apr 2025 06:57:51 +0000 Subject: [PATCH 1/2] Generate serverupdate --- services/serverupdate/api_default_test.go | 76 +++++++++++------------ services/serverupdate/client.go | 2 +- 2 files changed, 39 insertions(+), 39 deletions(-) diff --git a/services/serverupdate/api_default_test.go b/services/serverupdate/api_default_test.go index 322629a3e..3bc5dff5a 100644 --- a/services/serverupdate/api_default_test.go +++ b/services/serverupdate/api_default_test.go @@ -25,11 +25,11 @@ func Test_serverupdate_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService CreateUpdate", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/updates" - 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_serverupdate_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService CreateUpdateSchedule", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/update-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_serverupdate_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService DeleteUpdateSchedule", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/update-schedules/{scheduleId}" - 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) - scheduleIdValue := "scheduleId" + scheduleIdValue := "scheduleId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"scheduleId"+"}", url.PathEscape(ParameterValueToString(scheduleIdValue, "scheduleId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -196,11 +196,11 @@ func Test_serverupdate_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() @@ -248,11 +248,11 @@ func Test_serverupdate_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() @@ -300,11 +300,11 @@ func Test_serverupdate_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() @@ -358,13 +358,13 @@ func Test_serverupdate_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetUpdate", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/updates/{updateId}" - 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) - updateIdValue := "updateId" + updateIdValue := "updateId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"updateId"+"}", url.PathEscape(ParameterValueToString(updateIdValue, "updateId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -419,13 +419,13 @@ func Test_serverupdate_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetUpdateSchedule", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/update-schedules/{scheduleId}" - 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) - scheduleIdValue := "scheduleId" + scheduleIdValue := "scheduleId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"scheduleId"+"}", url.PathEscape(ParameterValueToString(scheduleIdValue, "scheduleId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -480,7 +480,7 @@ func Test_serverupdate_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListUpdatePolicies", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/update-policies" - projectIdValue := "projectId" + projectIdValue := "projectId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() @@ -532,11 +532,11 @@ func Test_serverupdate_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListUpdateSchedules", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/update-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() @@ -590,11 +590,11 @@ func Test_serverupdate_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListUpdates", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/updates" - 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() @@ -648,13 +648,13 @@ func Test_serverupdate_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService UpdateUpdateSchedule", func(t *testing.T) { _apiUrlPath := "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/update-schedules/{scheduleId}" - 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) - scheduleIdValue := "scheduleId" + scheduleIdValue := "scheduleId-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"scheduleId"+"}", url.PathEscape(ParameterValueToString(scheduleIdValue, "scheduleId")), -1) - regionValue := "region" + regionValue := "region-value" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) testDefaultApiServeMux := http.NewServeMux() diff --git a/services/serverupdate/client.go b/services/serverupdate/client.go index 88674033f..4bfc83f89 100644 --- a/services/serverupdate/client.go +++ b/services/serverupdate/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 0ece87913571db539b575f0312a9b30219b7c75d Mon Sep 17 00:00:00 2001 From: Ruben Hoenle Date: Tue, 29 Apr 2025 14:34:55 +0200 Subject: [PATCH 2/2] add changelog entries --- CHANGELOG.md | 2 ++ services/serverupdate/CHANGELOG.md | 3 +++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 272a4928f..95a3b36f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,8 @@ - **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 ## Release (2025-04-09) - `cdn`: [v0.3.0](services/cdn/CHANGELOG.md#v030-2025-04-04) diff --git a/services/serverupdate/CHANGELOG.md b/services/serverupdate/CHANGELOG.md index e2c6cd2d5..bf422094d 100644 --- a/services/serverupdate/CHANGELOG.md +++ b/services/serverupdate/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