From 56a61bc3c3e801377c1aa406ea878e8c30d7cee3 Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Mon, 27 Apr 2026 10:12:41 +0000 Subject: [PATCH] Generate serverupdate --- services/serverupdate/README.md | 5 + services/serverupdate/oas_commit | 2 +- .../serverupdate/{v2api => }/ApiCallback.java | 2 +- .../serverupdate/{v2api => }/ApiClient.java | 12 +- .../serverupdate/{v2api => }/ApiResponse.java | 2 +- .../{v2api => }/GzipRequestInterceptor.java | 2 +- .../sdk/serverupdate/{v2api => }/JSON.java | 31 +- .../sdk/serverupdate/{v2api => }/Pair.java | 2 +- .../{v2api => }/ProgressRequestBody.java | 2 +- .../{v2api => }/ProgressResponseBody.java | 2 +- .../{v2api => }/ServerConfiguration.java | 2 +- .../{v2api => }/ServerVariable.java | 2 +- .../serverupdate/{v2api => }/StringUtil.java | 2 +- .../{v2api => }/api/DefaultApi.java | 30 +- .../{v2api => }/api/ServerUpdateApi.java | 4 +- .../model/AbstractOpenApiSchema.java | 2 +- .../model/CreateUpdatePayload.java | 4 +- .../model/CreateUpdateSchedulePayload.java | 4 +- .../model/EnableServiceResourcePayload.java | 4 +- .../{v2api => }/model/ErrorResponse.java | 4 +- .../model/GetUpdatePoliciesResponse.java | 4 +- .../model/GetUpdateSchedulesResponse.java | 4 +- .../model/GetUpdateServiceResponse.java | 4 +- .../model/GetUpdatesListResponse.java | 4 +- .../{v2api => }/model/Update.java | 4 +- .../{v2api => }/model/UpdatePolicy.java | 4 +- .../{v2api => }/model/UpdateSchedule.java | 4 +- .../model/UpdateScheduleCreateRequest.java | 4 +- .../model/UpdateUpdateSchedulePayload.java | 4 +- .../sdk/serverupdate/v1api/ApiCallback.java | 60 - .../sdk/serverupdate/v1api/ApiClient.java | 1601 --------- .../sdk/serverupdate/v1api/ApiResponse.java | 73 - .../v1api/GzipRequestInterceptor.java | 87 - .../stackit/sdk/serverupdate/v1api/JSON.java | 459 --- .../stackit/sdk/serverupdate/v1api/Pair.java | 38 - .../v1api/ProgressRequestBody.java | 71 - .../v1api/ProgressResponseBody.java | 68 - .../v1api/ServerConfiguration.java | 79 - .../serverupdate/v1api/ServerVariable.java | 37 - .../sdk/serverupdate/v1api/StringUtil.java | 83 - .../serverupdate/v1api/api/DefaultApi.java | 2867 ----------------- .../v1api/api/ServerUpdateApi.java | 64 - .../v1api/model/AbstractOpenApiSchema.java | 145 - .../v1api/model/CreateUpdatePayload.java | 333 -- .../model/CreateUpdateSchedulePayload.java | 406 --- .../v1api/model/EnableServicePayload.java | 296 -- .../model/EnableServiceResourcePayload.java | 304 -- .../model/GetUpdatePoliciesResponse.java | 317 -- .../model/GetUpdateSchedulesResponse.java | 317 -- .../v1api/model/GetUpdateServiceResponse.java | 288 -- .../v1api/model/GetUpdatesListResponse.java | 316 -- .../sdk/serverupdate/v1api/model/Update.java | 500 --- .../v1api/model/UpdatePolicy.java | 486 --- .../v1api/model/UpdateSchedule.java | 427 --- .../model/UpdateScheduleCreateRequest.java | 406 --- .../model/UpdateUpdateSchedulePayload.java | 406 --- .../{v2api => }/api/DefaultApiTest.java | 2 +- .../{v2api => }/api/ServerUpdateApiTest.java | 2 +- .../v1api/api/DefaultApiTest.java | 66 - .../v1api/api/ServerUpdateApiTest.java | 67 - 60 files changed, 81 insertions(+), 10746 deletions(-) rename services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/{v2api => }/ApiCallback.java (97%) rename services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/{v2api => }/ApiClient.java (99%) rename services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/{v2api => }/ApiResponse.java (97%) rename services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/{v2api => }/GzipRequestInterceptor.java (97%) rename services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/{v2api => }/JSON.java (91%) rename services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/{v2api => }/Pair.java (95%) rename services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/{v2api => }/ProgressRequestBody.java (97%) rename services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/{v2api => }/ProgressResponseBody.java (97%) rename services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/{v2api => }/ServerConfiguration.java (97%) rename services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/{v2api => }/ServerVariable.java (96%) rename services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/{v2api => }/StringUtil.java (97%) rename services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/{v2api => }/api/DefaultApi.java (99%) rename services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/{v2api => }/api/ServerUpdateApi.java (93%) rename services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/{v2api => }/model/AbstractOpenApiSchema.java (98%) rename services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/{v2api => }/model/CreateUpdatePayload.java (99%) rename services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/{v2api => }/model/CreateUpdateSchedulePayload.java (99%) rename services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/{v2api => }/model/EnableServiceResourcePayload.java (99%) rename services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/{v2api => }/model/ErrorResponse.java (99%) rename services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/{v2api => }/model/GetUpdatePoliciesResponse.java (99%) rename services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/{v2api => }/model/GetUpdateSchedulesResponse.java (99%) rename services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/{v2api => }/model/GetUpdateServiceResponse.java (98%) rename services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/{v2api => }/model/GetUpdatesListResponse.java (99%) rename services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/{v2api => }/model/Update.java (99%) rename services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/{v2api => }/model/UpdatePolicy.java (99%) rename services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/{v2api => }/model/UpdateSchedule.java (99%) rename services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/{v2api => }/model/UpdateScheduleCreateRequest.java (99%) rename services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/{v2api => }/model/UpdateUpdateSchedulePayload.java (99%) delete mode 100644 services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/ApiCallback.java delete mode 100644 services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/ApiClient.java delete mode 100644 services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/ApiResponse.java delete mode 100644 services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/GzipRequestInterceptor.java delete mode 100644 services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/JSON.java delete mode 100644 services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/Pair.java delete mode 100644 services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/ProgressRequestBody.java delete mode 100644 services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/ProgressResponseBody.java delete mode 100644 services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/ServerConfiguration.java delete mode 100644 services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/ServerVariable.java delete mode 100644 services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/StringUtil.java delete mode 100644 services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/api/DefaultApi.java delete mode 100644 services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/api/ServerUpdateApi.java delete mode 100644 services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/AbstractOpenApiSchema.java delete mode 100644 services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/CreateUpdatePayload.java delete mode 100644 services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/CreateUpdateSchedulePayload.java delete mode 100644 services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/EnableServicePayload.java delete mode 100644 services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/EnableServiceResourcePayload.java delete mode 100644 services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/GetUpdatePoliciesResponse.java delete mode 100644 services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/GetUpdateSchedulesResponse.java delete mode 100644 services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/GetUpdateServiceResponse.java delete mode 100644 services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/GetUpdatesListResponse.java delete mode 100644 services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/Update.java delete mode 100644 services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/UpdatePolicy.java delete mode 100644 services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/UpdateSchedule.java delete mode 100644 services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/UpdateScheduleCreateRequest.java delete mode 100644 services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/UpdateUpdateSchedulePayload.java rename services/serverupdate/src/test/java/cloud/stackit/sdk/serverupdate/{v2api => }/api/DefaultApiTest.java (97%) rename services/serverupdate/src/test/java/cloud/stackit/sdk/serverupdate/{v2api => }/api/ServerUpdateApiTest.java (97%) delete mode 100644 services/serverupdate/src/test/java/cloud/stackit/sdk/serverupdate/v1api/api/DefaultApiTest.java delete mode 100644 services/serverupdate/src/test/java/cloud/stackit/sdk/serverupdate/v1api/api/ServerUpdateApiTest.java diff --git a/services/serverupdate/README.md b/services/serverupdate/README.md index f52e591a..d2f29bc3 100644 --- a/services/serverupdate/README.md +++ b/services/serverupdate/README.md @@ -1,5 +1,10 @@ # STACKIT Java SDK for STACKIT Server Update Management API +- API version: 2.0 + +API endpoints for Server Update Operations on STACKIT Servers. + + This package is part of the STACKIT Java SDK. For additional information, please visit the [GitHub repository](https://github.com/stackitcloud/stackit-sdk-java) of the SDK. ## Installation from Maven Central (recommended) diff --git a/services/serverupdate/oas_commit b/services/serverupdate/oas_commit index 6694ae65..3fc3e0ee 100644 --- a/services/serverupdate/oas_commit +++ b/services/serverupdate/oas_commit @@ -1 +1 @@ -29ed135519d2a7b1b043cd0c8243bb8d423a784b +14680de719c438311d250bd6f5bdedae9c11aa8e diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/ApiCallback.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/ApiCallback.java similarity index 97% rename from services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/ApiCallback.java rename to services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/ApiCallback.java index 7f21cebf..4892026d 100644 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/ApiCallback.java +++ b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/ApiCallback.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.serverupdate.v2api; +package cloud.stackit.sdk.serverupdate; import cloud.stackit.sdk.core.exception.ApiException; import java.util.List; diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/ApiClient.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/ApiClient.java similarity index 99% rename from services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/ApiClient.java rename to services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/ApiClient.java index eaa6f652..cce4c448 100644 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/ApiClient.java +++ b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/ApiClient.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.serverupdate.v2api; +package cloud.stackit.sdk.serverupdate; import cloud.stackit.sdk.core.KeyFlowAuthenticator; import cloud.stackit.sdk.core.config.CoreConfiguration; @@ -357,7 +357,7 @@ public DateFormat getDateFormat() { * Setter for the field dateFormat. * * @param dateFormat a {@link java.text.DateFormat} object - * @return a {@link cloud.stackit.sdk.serverupdate.v2api.ApiClient} object + * @return a {@link cloud.stackit.sdk.serverupdate.ApiClient} object */ public ApiClient setDateFormat(DateFormat dateFormat) { JSON.setDateFormat(dateFormat); @@ -368,7 +368,7 @@ public ApiClient setDateFormat(DateFormat dateFormat) { * Set SqlDateFormat. * * @param dateFormat a {@link java.text.DateFormat} object - * @return a {@link cloud.stackit.sdk.serverupdate.v2api.ApiClient} object + * @return a {@link cloud.stackit.sdk.serverupdate.ApiClient} object */ public ApiClient setSqlDateFormat(DateFormat dateFormat) { JSON.setSqlDateFormat(dateFormat); @@ -379,7 +379,7 @@ public ApiClient setSqlDateFormat(DateFormat dateFormat) { * Set OffsetDateTimeFormat. * * @param dateFormat a {@link java.time.format.DateTimeFormatter} object - * @return a {@link cloud.stackit.sdk.serverupdate.v2api.ApiClient} object + * @return a {@link cloud.stackit.sdk.serverupdate.ApiClient} object */ public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { JSON.setOffsetDateTimeFormat(dateFormat); @@ -390,7 +390,7 @@ public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { * Set LocalDateFormat. * * @param dateFormat a {@link java.time.format.DateTimeFormatter} object - * @return a {@link cloud.stackit.sdk.serverupdate.v2api.ApiClient} object + * @return a {@link cloud.stackit.sdk.serverupdate.ApiClient} object */ public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { JSON.setLocalDateFormat(dateFormat); @@ -401,7 +401,7 @@ public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { * Set LenientOnJson. * * @param lenientOnJson a boolean - * @return a {@link cloud.stackit.sdk.serverupdate.v2api.ApiClient} object + * @return a {@link cloud.stackit.sdk.serverupdate.ApiClient} object */ public ApiClient setLenientOnJson(boolean lenientOnJson) { JSON.setLenientOnJson(lenientOnJson); diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/ApiResponse.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/ApiResponse.java similarity index 97% rename from services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/ApiResponse.java rename to services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/ApiResponse.java index 600836de..bd897073 100644 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/ApiResponse.java +++ b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/ApiResponse.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.serverupdate.v2api; +package cloud.stackit.sdk.serverupdate; import java.util.List; import java.util.Map; diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/GzipRequestInterceptor.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/GzipRequestInterceptor.java similarity index 97% rename from services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/GzipRequestInterceptor.java rename to services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/GzipRequestInterceptor.java index bc072589..834a1b7d 100644 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/GzipRequestInterceptor.java +++ b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/GzipRequestInterceptor.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.serverupdate.v2api; +package cloud.stackit.sdk.serverupdate; import java.io.IOException; import okhttp3.*; diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/JSON.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/JSON.java similarity index 91% rename from services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/JSON.java rename to services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/JSON.java index 856468c1..064b85a2 100644 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/JSON.java +++ b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/JSON.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.serverupdate.v2api; +package cloud.stackit.sdk.serverupdate; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -96,42 +96,39 @@ private static Class getClassByDiscriminator( gsonBuilder.registerTypeAdapter(LocalDate.class, localDateTypeAdapter); gsonBuilder.registerTypeAdapter(byte[].class, byteArrayAdapter); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.serverupdate.v2api.model.CreateUpdatePayload + new cloud.stackit.sdk.serverupdate.model.CreateUpdatePayload .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.serverupdate.v2api.model.CreateUpdateSchedulePayload + new cloud.stackit.sdk.serverupdate.model.CreateUpdateSchedulePayload .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.serverupdate.v2api.model.EnableServiceResourcePayload + new cloud.stackit.sdk.serverupdate.model.EnableServiceResourcePayload .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.serverupdate.v2api.model.ErrorResponse - .CustomTypeAdapterFactory()); + new cloud.stackit.sdk.serverupdate.model.ErrorResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.serverupdate.v2api.model.GetUpdatePoliciesResponse + new cloud.stackit.sdk.serverupdate.model.GetUpdatePoliciesResponse .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.serverupdate.v2api.model.GetUpdateSchedulesResponse + new cloud.stackit.sdk.serverupdate.model.GetUpdateSchedulesResponse .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.serverupdate.v2api.model.GetUpdateServiceResponse + new cloud.stackit.sdk.serverupdate.model.GetUpdateServiceResponse .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.serverupdate.v2api.model.GetUpdatesListResponse + new cloud.stackit.sdk.serverupdate.model.GetUpdatesListResponse .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.serverupdate.v2api.model.Update.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.serverupdate.model.Update.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.serverupdate.v2api.model.UpdatePolicy - .CustomTypeAdapterFactory()); + new cloud.stackit.sdk.serverupdate.model.UpdatePolicy.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.serverupdate.v2api.model.UpdateSchedule - .CustomTypeAdapterFactory()); + new cloud.stackit.sdk.serverupdate.model.UpdateSchedule.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.serverupdate.v2api.model.UpdateScheduleCreateRequest + new cloud.stackit.sdk.serverupdate.model.UpdateScheduleCreateRequest .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.serverupdate.v2api.model.UpdateUpdateSchedulePayload + new cloud.stackit.sdk.serverupdate.model.UpdateUpdateSchedulePayload .CustomTypeAdapterFactory()); gson = gsonBuilder.create(); } diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/Pair.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/Pair.java similarity index 95% rename from services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/Pair.java rename to services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/Pair.java index d2ca4b62..a25ef4db 100644 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/Pair.java +++ b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/Pair.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.serverupdate.v2api; +package cloud.stackit.sdk.serverupdate; @javax.annotation.Generated( value = "org.openapitools.codegen.languages.JavaClientCodegen", diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/ProgressRequestBody.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/ProgressRequestBody.java similarity index 97% rename from services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/ProgressRequestBody.java rename to services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/ProgressRequestBody.java index 94f2566d..0d52474a 100644 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/ProgressRequestBody.java +++ b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/ProgressRequestBody.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.serverupdate.v2api; +package cloud.stackit.sdk.serverupdate; import java.io.IOException; import okhttp3.MediaType; diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/ProgressResponseBody.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/ProgressResponseBody.java similarity index 97% rename from services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/ProgressResponseBody.java rename to services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/ProgressResponseBody.java index 56a1a3bf..d73ffbe2 100644 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/ProgressResponseBody.java +++ b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/ProgressResponseBody.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.serverupdate.v2api; +package cloud.stackit.sdk.serverupdate; import java.io.IOException; import okhttp3.MediaType; diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/ServerConfiguration.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/ServerConfiguration.java similarity index 97% rename from services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/ServerConfiguration.java rename to services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/ServerConfiguration.java index 14803448..591f5df2 100644 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/ServerConfiguration.java +++ b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/ServerConfiguration.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.serverupdate.v2api; +package cloud.stackit.sdk.serverupdate; import java.util.Map; diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/ServerVariable.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/ServerVariable.java similarity index 96% rename from services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/ServerVariable.java rename to services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/ServerVariable.java index 716c9d52..d31068d4 100644 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/ServerVariable.java +++ b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/ServerVariable.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.serverupdate.v2api; +package cloud.stackit.sdk.serverupdate; import java.util.HashSet; diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/StringUtil.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/StringUtil.java similarity index 97% rename from services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/StringUtil.java rename to services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/StringUtil.java index f12e94ee..6e79b716 100644 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/StringUtil.java +++ b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/StringUtil.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.serverupdate.v2api; +package cloud.stackit.sdk.serverupdate; import java.util.Collection; import java.util.Iterator; diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/api/DefaultApi.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/api/DefaultApi.java similarity index 99% rename from services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/api/DefaultApi.java rename to services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/api/DefaultApi.java index 4f805a5f..4ddb3981 100644 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/api/DefaultApi.java +++ b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/api/DefaultApi.java @@ -10,24 +10,24 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.serverupdate.v2api.api; +package cloud.stackit.sdk.serverupdate.api; import cloud.stackit.sdk.core.config.CoreConfiguration; import cloud.stackit.sdk.core.exception.ApiException; -import cloud.stackit.sdk.serverupdate.v2api.ApiCallback; -import cloud.stackit.sdk.serverupdate.v2api.ApiClient; -import cloud.stackit.sdk.serverupdate.v2api.ApiResponse; -import cloud.stackit.sdk.serverupdate.v2api.Pair; -import cloud.stackit.sdk.serverupdate.v2api.model.CreateUpdatePayload; -import cloud.stackit.sdk.serverupdate.v2api.model.CreateUpdateSchedulePayload; -import cloud.stackit.sdk.serverupdate.v2api.model.EnableServiceResourcePayload; -import cloud.stackit.sdk.serverupdate.v2api.model.GetUpdatePoliciesResponse; -import cloud.stackit.sdk.serverupdate.v2api.model.GetUpdateSchedulesResponse; -import cloud.stackit.sdk.serverupdate.v2api.model.GetUpdateServiceResponse; -import cloud.stackit.sdk.serverupdate.v2api.model.GetUpdatesListResponse; -import cloud.stackit.sdk.serverupdate.v2api.model.Update; -import cloud.stackit.sdk.serverupdate.v2api.model.UpdateSchedule; -import cloud.stackit.sdk.serverupdate.v2api.model.UpdateUpdateSchedulePayload; +import cloud.stackit.sdk.serverupdate.ApiCallback; +import cloud.stackit.sdk.serverupdate.ApiClient; +import cloud.stackit.sdk.serverupdate.ApiResponse; +import cloud.stackit.sdk.serverupdate.Pair; +import cloud.stackit.sdk.serverupdate.model.CreateUpdatePayload; +import cloud.stackit.sdk.serverupdate.model.CreateUpdateSchedulePayload; +import cloud.stackit.sdk.serverupdate.model.EnableServiceResourcePayload; +import cloud.stackit.sdk.serverupdate.model.GetUpdatePoliciesResponse; +import cloud.stackit.sdk.serverupdate.model.GetUpdateSchedulesResponse; +import cloud.stackit.sdk.serverupdate.model.GetUpdateServiceResponse; +import cloud.stackit.sdk.serverupdate.model.GetUpdatesListResponse; +import cloud.stackit.sdk.serverupdate.model.Update; +import cloud.stackit.sdk.serverupdate.model.UpdateSchedule; +import cloud.stackit.sdk.serverupdate.model.UpdateUpdateSchedulePayload; import com.google.gson.reflect.TypeToken; import java.io.IOException; import java.lang.reflect.Type; diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/api/ServerUpdateApi.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/api/ServerUpdateApi.java similarity index 93% rename from services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/api/ServerUpdateApi.java rename to services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/api/ServerUpdateApi.java index 95826994..2c8c2a93 100644 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/api/ServerUpdateApi.java +++ b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/api/ServerUpdateApi.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.serverupdate.v2api.api; +package cloud.stackit.sdk.serverupdate.api; import cloud.stackit.sdk.core.config.CoreConfiguration; import java.io.IOException; @@ -33,7 +33,7 @@ public ServerUpdateApi() throws IOException { * *

For production use consider using the constructor with the OkHttpClient parameter. * - * @param configuration your STACKIT SDK CoreConfiguration + * @param config your STACKIT SDK CoreConfiguration * @throws IOException */ public ServerUpdateApi(CoreConfiguration configuration) throws IOException { diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/model/AbstractOpenApiSchema.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/model/AbstractOpenApiSchema.java similarity index 98% rename from services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/model/AbstractOpenApiSchema.java rename to services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/model/AbstractOpenApiSchema.java index 4b800e82..4e741baa 100644 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/model/AbstractOpenApiSchema.java +++ b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/model/AbstractOpenApiSchema.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.serverupdate.v2api.model; +package cloud.stackit.sdk.serverupdate.model; import java.util.Map; import java.util.Objects; diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/model/CreateUpdatePayload.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/model/CreateUpdatePayload.java similarity index 99% rename from services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/model/CreateUpdatePayload.java rename to services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/model/CreateUpdatePayload.java index 1d7e6557..0f883422 100644 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/model/CreateUpdatePayload.java +++ b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/model/CreateUpdatePayload.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.serverupdate.v2api.model; +package cloud.stackit.sdk.serverupdate.model; -import cloud.stackit.sdk.serverupdate.v2api.JSON; +import cloud.stackit.sdk.serverupdate.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/model/CreateUpdateSchedulePayload.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/model/CreateUpdateSchedulePayload.java similarity index 99% rename from services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/model/CreateUpdateSchedulePayload.java rename to services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/model/CreateUpdateSchedulePayload.java index 80d50029..66f82523 100644 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/model/CreateUpdateSchedulePayload.java +++ b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/model/CreateUpdateSchedulePayload.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.serverupdate.v2api.model; +package cloud.stackit.sdk.serverupdate.model; -import cloud.stackit.sdk.serverupdate.v2api.JSON; +import cloud.stackit.sdk.serverupdate.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/model/EnableServiceResourcePayload.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/model/EnableServiceResourcePayload.java similarity index 99% rename from services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/model/EnableServiceResourcePayload.java rename to services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/model/EnableServiceResourcePayload.java index cb8b1f03..d707fd15 100644 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/model/EnableServiceResourcePayload.java +++ b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/model/EnableServiceResourcePayload.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.serverupdate.v2api.model; +package cloud.stackit.sdk.serverupdate.model; -import cloud.stackit.sdk.serverupdate.v2api.JSON; +import cloud.stackit.sdk.serverupdate.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/model/ErrorResponse.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/model/ErrorResponse.java similarity index 99% rename from services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/model/ErrorResponse.java rename to services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/model/ErrorResponse.java index b84ac9d0..e9ed81ce 100644 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/model/ErrorResponse.java +++ b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/model/ErrorResponse.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.serverupdate.v2api.model; +package cloud.stackit.sdk.serverupdate.model; -import cloud.stackit.sdk.serverupdate.v2api.JSON; +import cloud.stackit.sdk.serverupdate.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/model/GetUpdatePoliciesResponse.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/model/GetUpdatePoliciesResponse.java similarity index 99% rename from services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/model/GetUpdatePoliciesResponse.java rename to services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/model/GetUpdatePoliciesResponse.java index 5426cd94..644cbd01 100644 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/model/GetUpdatePoliciesResponse.java +++ b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/model/GetUpdatePoliciesResponse.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.serverupdate.v2api.model; +package cloud.stackit.sdk.serverupdate.model; -import cloud.stackit.sdk.serverupdate.v2api.JSON; +import cloud.stackit.sdk.serverupdate.JSON; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/model/GetUpdateSchedulesResponse.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/model/GetUpdateSchedulesResponse.java similarity index 99% rename from services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/model/GetUpdateSchedulesResponse.java rename to services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/model/GetUpdateSchedulesResponse.java index 2812916a..3602bfcc 100644 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/model/GetUpdateSchedulesResponse.java +++ b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/model/GetUpdateSchedulesResponse.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.serverupdate.v2api.model; +package cloud.stackit.sdk.serverupdate.model; -import cloud.stackit.sdk.serverupdate.v2api.JSON; +import cloud.stackit.sdk.serverupdate.JSON; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/model/GetUpdateServiceResponse.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/model/GetUpdateServiceResponse.java similarity index 98% rename from services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/model/GetUpdateServiceResponse.java rename to services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/model/GetUpdateServiceResponse.java index d5905ce3..f2a94856 100644 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/model/GetUpdateServiceResponse.java +++ b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/model/GetUpdateServiceResponse.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.serverupdate.v2api.model; +package cloud.stackit.sdk.serverupdate.model; -import cloud.stackit.sdk.serverupdate.v2api.JSON; +import cloud.stackit.sdk.serverupdate.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/model/GetUpdatesListResponse.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/model/GetUpdatesListResponse.java similarity index 99% rename from services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/model/GetUpdatesListResponse.java rename to services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/model/GetUpdatesListResponse.java index d856513e..4e990434 100644 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/model/GetUpdatesListResponse.java +++ b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/model/GetUpdatesListResponse.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.serverupdate.v2api.model; +package cloud.stackit.sdk.serverupdate.model; -import cloud.stackit.sdk.serverupdate.v2api.JSON; +import cloud.stackit.sdk.serverupdate.JSON; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/model/Update.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/model/Update.java similarity index 99% rename from services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/model/Update.java rename to services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/model/Update.java index ccf00641..1ccd1a76 100644 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/model/Update.java +++ b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/model/Update.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.serverupdate.v2api.model; +package cloud.stackit.sdk.serverupdate.model; -import cloud.stackit.sdk.serverupdate.v2api.JSON; +import cloud.stackit.sdk.serverupdate.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/model/UpdatePolicy.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/model/UpdatePolicy.java similarity index 99% rename from services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/model/UpdatePolicy.java rename to services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/model/UpdatePolicy.java index 79e482bd..f0c7d732 100644 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/model/UpdatePolicy.java +++ b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/model/UpdatePolicy.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.serverupdate.v2api.model; +package cloud.stackit.sdk.serverupdate.model; -import cloud.stackit.sdk.serverupdate.v2api.JSON; +import cloud.stackit.sdk.serverupdate.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/model/UpdateSchedule.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/model/UpdateSchedule.java similarity index 99% rename from services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/model/UpdateSchedule.java rename to services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/model/UpdateSchedule.java index 334cc2ff..ee060104 100644 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/model/UpdateSchedule.java +++ b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/model/UpdateSchedule.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.serverupdate.v2api.model; +package cloud.stackit.sdk.serverupdate.model; -import cloud.stackit.sdk.serverupdate.v2api.JSON; +import cloud.stackit.sdk.serverupdate.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/model/UpdateScheduleCreateRequest.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/model/UpdateScheduleCreateRequest.java similarity index 99% rename from services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/model/UpdateScheduleCreateRequest.java rename to services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/model/UpdateScheduleCreateRequest.java index 8d5a7e15..f35f14e8 100644 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/model/UpdateScheduleCreateRequest.java +++ b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/model/UpdateScheduleCreateRequest.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.serverupdate.v2api.model; +package cloud.stackit.sdk.serverupdate.model; -import cloud.stackit.sdk.serverupdate.v2api.JSON; +import cloud.stackit.sdk.serverupdate.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/model/UpdateUpdateSchedulePayload.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/model/UpdateUpdateSchedulePayload.java similarity index 99% rename from services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/model/UpdateUpdateSchedulePayload.java rename to services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/model/UpdateUpdateSchedulePayload.java index 25753f07..cb06a29d 100644 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v2api/model/UpdateUpdateSchedulePayload.java +++ b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/model/UpdateUpdateSchedulePayload.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.serverupdate.v2api.model; +package cloud.stackit.sdk.serverupdate.model; -import cloud.stackit.sdk.serverupdate.v2api.JSON; +import cloud.stackit.sdk.serverupdate.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/ApiCallback.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/ApiCallback.java deleted file mode 100644 index 52135132..00000000 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/ApiCallback.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * STACKIT Server Update Management API - * API endpoints for Server Update Operations on STACKIT Servers. - * - * The version of the OpenAPI document: 1.0 - * Contact: support@stackit.de - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package cloud.stackit.sdk.serverupdate.v1api; - -import cloud.stackit.sdk.core.exception.ApiException; -import java.util.List; -import java.util.Map; - -/** - * Callback for asynchronous API call. - * - * @param The return type - */ -public interface ApiCallback { - /** - * This is called when the API call fails. - * - * @param e The exception causing the failure - * @param statusCode Status code of the response if available, otherwise it would be 0 - * @param responseHeaders Headers of the response if available, otherwise it would be null - */ - void onFailure(ApiException e, int statusCode, Map> responseHeaders); - - /** - * This is called when the API call succeeded. - * - * @param result The result deserialized from response - * @param statusCode Status code of the response - * @param responseHeaders Headers of the response - */ - void onSuccess(T result, int statusCode, Map> responseHeaders); - - /** - * This is called when the API upload processing. - * - * @param bytesWritten bytes Written - * @param contentLength content length of request body - * @param done write end - */ - void onUploadProgress(long bytesWritten, long contentLength, boolean done); - - /** - * This is called when the API download processing. - * - * @param bytesRead bytes Read - * @param contentLength content length of the response - * @param done Read end - */ - void onDownloadProgress(long bytesRead, long contentLength, boolean done); -} diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/ApiClient.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/ApiClient.java deleted file mode 100644 index 420a2694..00000000 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/ApiClient.java +++ /dev/null @@ -1,1601 +0,0 @@ -/* - * STACKIT Server Update Management API - * API endpoints for Server Update Operations on STACKIT Servers. - * - * The version of the OpenAPI document: 1.0 - * Contact: support@stackit.de - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package cloud.stackit.sdk.serverupdate.v1api; - -import cloud.stackit.sdk.core.KeyFlowAuthenticator; -import cloud.stackit.sdk.core.config.CoreConfiguration; -import cloud.stackit.sdk.core.exception.ApiException; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.UnsupportedEncodingException; -import java.lang.reflect.Type; -import java.net.URLConnection; -import java.net.URLEncoder; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.security.GeneralSecurityException; -import java.security.KeyStore; -import java.security.SecureRandom; -import java.security.cert.Certificate; -import java.security.cert.CertificateException; -import java.security.cert.CertificateFactory; -import java.text.DateFormat; -import java.time.LocalDate; -import java.time.OffsetDateTime; -import java.time.format.DateTimeFormatter; -import java.util.*; -import java.util.Map.Entry; -import java.util.concurrent.TimeUnit; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import javax.net.ssl.*; -import okhttp3.*; -import okhttp3.internal.http.HttpMethod; -import okhttp3.internal.tls.OkHostnameVerifier; -import okhttp3.logging.HttpLoggingInterceptor; -import okhttp3.logging.HttpLoggingInterceptor.Level; -import okio.Buffer; -import okio.BufferedSink; -import okio.Okio; - -/** ApiClient class. */ -public class ApiClient { - - protected String basePath = "https://server-update.api.eu01.stackit.cloud"; - protected List servers = - new ArrayList( - Arrays.asList( - new ServerConfiguration( - "https://server-update.api.{region}stackit.cloud", - "No description provided", - new HashMap() { - { - put( - "region", - new ServerVariable( - "No description provided", - "eu01.", - new HashSet( - Arrays.asList("eu01.")))); - } - }))); - protected Integer serverIndex = 0; - protected Map serverVariables = null; - protected boolean debugging = false; - protected Map defaultHeaderMap = new HashMap(); - protected Map defaultCookieMap = new HashMap(); - protected String tempFolderPath = null; - - protected DateFormat dateFormat; - protected DateFormat datetimeFormat; - protected boolean lenientDatetimeFormat; - protected int dateLength; - - protected InputStream sslCaCert; - protected boolean verifyingSsl; - protected KeyManager[] keyManagers; - protected String tlsServerName; - - protected OkHttpClient httpClient; - protected JSON json; - - protected HttpLoggingInterceptor loggingInterceptor; - - protected CoreConfiguration configuration; - - /** - * Basic constructor for ApiClient. - * - *

Not recommended for production use, use the one with the OkHttpClient parameter instead. - * - * @throws IOException thrown when a file can not be found - */ - public ApiClient() throws IOException { - this(null, new CoreConfiguration()); - } - - /** - * Basic constructor for ApiClient - * - *

Not recommended for production use, use the one with the OkHttpClient parameter instead. - * - * @param config a {@link cloud.stackit.sdk.core.config.CoreConfiguration} object - * @throws IOException thrown when a file can not be found - */ - public ApiClient(CoreConfiguration config) throws IOException { - this(null, config); - } - - /** - * Constructor for ApiClient with OkHttpClient parameter. Recommended for production use. - * - * @param httpClient a OkHttpClient object - * @throws IOException thrown when a file can not be found - */ - public ApiClient(OkHttpClient httpClient) throws IOException { - this(httpClient, new CoreConfiguration()); - } - - /** - * Constructor for ApiClient with OkHttpClient parameter. Recommended for production use. - * - * @param httpClient a OkHttpClient object - * @param config a {@link cloud.stackit.sdk.core.config.CoreConfiguration} object - * @throws IOException thrown when a file can not be found - */ - public ApiClient(OkHttpClient httpClient, CoreConfiguration config) throws IOException { - init(); - - if (config.getCustomEndpoint() != null && !config.getCustomEndpoint().trim().isEmpty()) { - basePath = config.getCustomEndpoint(); - } - if (config.getDefaultHeader() != null) { - defaultHeaderMap = config.getDefaultHeader(); - } - this.configuration = config; - - if (httpClient == null) { - initHttpClient(); - KeyFlowAuthenticator authenticator = new KeyFlowAuthenticator(this.httpClient, config); - this.httpClient = this.httpClient.newBuilder().authenticator(authenticator).build(); - } else { - // Authorization has to be configured manually in case a custom http client object is - // passed - this.httpClient = httpClient; - } - } - - protected void initHttpClient() { - initHttpClient(Collections.emptyList()); - } - - protected void initHttpClient(List interceptors) { - OkHttpClient.Builder builder = new OkHttpClient.Builder(); - builder.addNetworkInterceptor(getProgressInterceptor()); - for (Interceptor interceptor : interceptors) { - builder.addInterceptor(interceptor); - } - - httpClient = builder.build(); - } - - protected void init() { - verifyingSsl = true; - - json = new JSON(); - - // Set default User-Agent. - setUserAgent("stackit-sdk-java/serverupdate"); - } - - /** - * Get base path - * - * @return Base path - */ - public String getBasePath() { - return basePath; - } - - /** - * Set base path - * - * @param basePath Base path of the URL (e.g https://server-update.api.eu01.stackit.cloud) - * @return An instance of ApiClient - */ - public ApiClient setBasePath(String basePath) { - this.basePath = basePath; - this.serverIndex = null; - return this; - } - - public List getServers() { - return servers; - } - - public ApiClient setServers(List servers) { - this.servers = servers; - return this; - } - - public Integer getServerIndex() { - return serverIndex; - } - - public ApiClient setServerIndex(Integer serverIndex) { - this.serverIndex = serverIndex; - return this; - } - - public Map getServerVariables() { - return serverVariables; - } - - public ApiClient setServerVariables(Map serverVariables) { - this.serverVariables = serverVariables; - return this; - } - - /** - * Get HTTP client - * - * @return An instance of OkHttpClient - */ - public OkHttpClient getHttpClient() { - return httpClient; - } - - /** - * Get JSON - * - * @return JSON object - */ - public JSON getJSON() { - return json; - } - - /** - * Set JSON - * - * @param json JSON object - * @return Api client - */ - public ApiClient setJSON(JSON json) { - this.json = json; - return this; - } - - /** - * True if isVerifyingSsl flag is on - * - * @return True if isVerifySsl flag is on - */ - public boolean isVerifyingSsl() { - return verifyingSsl; - } - - /** - * Configure whether to verify certificate and hostname when making https requests. Default to - * true. NOTE: Do NOT set to false in production code, otherwise you would face multiple types - * of cryptographic attacks. - * - * @param verifyingSsl True to verify TLS/SSL connection - * @return ApiClient - */ - public ApiClient setVerifyingSsl(boolean verifyingSsl) { - this.verifyingSsl = verifyingSsl; - applySslSettings(); - return this; - } - - /** - * Get SSL CA cert. - * - * @return Input stream to the SSL CA cert - */ - public InputStream getSslCaCert() { - return sslCaCert; - } - - /** - * Configure the CA certificate to be trusted when making https requests. Use null to reset to - * default. - * - * @param sslCaCert input stream for SSL CA cert - * @return ApiClient - */ - public ApiClient setSslCaCert(InputStream sslCaCert) { - this.sslCaCert = sslCaCert; - applySslSettings(); - return this; - } - - /** - * Getter for the field keyManagers. - * - * @return an array of {@link javax.net.ssl.KeyManager} objects - */ - public KeyManager[] getKeyManagers() { - return keyManagers; - } - - /** - * Configure client keys to use for authorization in an SSL session. Use null to reset to - * default. - * - * @param managers The KeyManagers to use - * @return ApiClient - */ - public ApiClient setKeyManagers(KeyManager[] managers) { - this.keyManagers = managers; - applySslSettings(); - return this; - } - - /** - * Get TLS server name for SNI (Server Name Indication). - * - * @return The TLS server name - */ - public String getTlsServerName() { - return tlsServerName; - } - - /** - * Set TLS server name for SNI (Server Name Indication). This is used to verify the server - * certificate against a specific hostname instead of the hostname in the URL. - * - * @param tlsServerName The TLS server name to use for certificate verification - * @return ApiClient - */ - public ApiClient setTlsServerName(String tlsServerName) { - this.tlsServerName = tlsServerName; - applySslSettings(); - return this; - } - - /** - * Getter for the field dateFormat. - * - * @return a {@link java.text.DateFormat} object - */ - public DateFormat getDateFormat() { - return dateFormat; - } - - /** - * Setter for the field dateFormat. - * - * @param dateFormat a {@link java.text.DateFormat} object - * @return a {@link cloud.stackit.sdk.serverupdate.v1api.ApiClient} object - */ - public ApiClient setDateFormat(DateFormat dateFormat) { - JSON.setDateFormat(dateFormat); - return this; - } - - /** - * Set SqlDateFormat. - * - * @param dateFormat a {@link java.text.DateFormat} object - * @return a {@link cloud.stackit.sdk.serverupdate.v1api.ApiClient} object - */ - public ApiClient setSqlDateFormat(DateFormat dateFormat) { - JSON.setSqlDateFormat(dateFormat); - return this; - } - - /** - * Set OffsetDateTimeFormat. - * - * @param dateFormat a {@link java.time.format.DateTimeFormatter} object - * @return a {@link cloud.stackit.sdk.serverupdate.v1api.ApiClient} object - */ - public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { - JSON.setOffsetDateTimeFormat(dateFormat); - return this; - } - - /** - * Set LocalDateFormat. - * - * @param dateFormat a {@link java.time.format.DateTimeFormatter} object - * @return a {@link cloud.stackit.sdk.serverupdate.v1api.ApiClient} object - */ - public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { - JSON.setLocalDateFormat(dateFormat); - return this; - } - - /** - * Set LenientOnJson. - * - * @param lenientOnJson a boolean - * @return a {@link cloud.stackit.sdk.serverupdate.v1api.ApiClient} object - */ - public ApiClient setLenientOnJson(boolean lenientOnJson) { - JSON.setLenientOnJson(lenientOnJson); - return this; - } - - /** - * Set the User-Agent header's value (by adding to the default header map). - * - * @param userAgent HTTP request's user agent - * @return ApiClient - */ - public ApiClient setUserAgent(String userAgent) { - addDefaultHeader("User-Agent", userAgent); - return this; - } - - /** - * Add a default header. - * - * @param key The header's key - * @param value The header's value - * @return ApiClient - */ - public ApiClient addDefaultHeader(String key, String value) { - defaultHeaderMap.put(key, value); - return this; - } - - /** - * Add a default cookie. - * - * @param key The cookie's key - * @param value The cookie's value - * @return ApiClient - */ - public ApiClient addDefaultCookie(String key, String value) { - defaultCookieMap.put(key, value); - return this; - } - - /** - * Check that whether debugging is enabled for this API client. - * - * @return True if debugging is enabled, false otherwise. - */ - public boolean isDebugging() { - return debugging; - } - - /** - * Enable/disable debugging for this API client. - * - * @param debugging To enable (true) or disable (false) debugging - * @return ApiClient - */ - public ApiClient setDebugging(boolean debugging) { - if (debugging != this.debugging) { - if (debugging) { - loggingInterceptor = new HttpLoggingInterceptor(); - loggingInterceptor.setLevel(Level.BODY); - httpClient = httpClient.newBuilder().addInterceptor(loggingInterceptor).build(); - } else { - final OkHttpClient.Builder builder = httpClient.newBuilder(); - builder.interceptors().remove(loggingInterceptor); - httpClient = builder.build(); - loggingInterceptor = null; - } - } - this.debugging = debugging; - return this; - } - - /** - * The path of temporary folder used to store downloaded files from endpoints with file - * response. The default value is null, i.e. using the system's default temporary - * folder. - * - * @see createTempFile - * @return Temporary folder path - */ - public String getTempFolderPath() { - return tempFolderPath; - } - - /** - * Set the temporary folder path (for downloading files) - * - * @param tempFolderPath Temporary folder path - * @return ApiClient - */ - public ApiClient setTempFolderPath(String tempFolderPath) { - this.tempFolderPath = tempFolderPath; - return this; - } - - /** - * Get connection timeout (in milliseconds). - * - * @return Timeout in milliseconds - */ - public int getConnectTimeout() { - return httpClient.connectTimeoutMillis(); - } - - /** - * Sets the connect timeout (in milliseconds). A value of 0 means no timeout, otherwise values - * must be between 1 and {@link java.lang.Integer#MAX_VALUE}. - * - * @param connectionTimeout connection timeout in milliseconds - * @return Api client - */ - public ApiClient setConnectTimeout(int connectionTimeout) { - httpClient = - httpClient - .newBuilder() - .connectTimeout(connectionTimeout, TimeUnit.MILLISECONDS) - .build(); - return this; - } - - /** - * Get read timeout (in milliseconds). - * - * @return Timeout in milliseconds - */ - public int getReadTimeout() { - return httpClient.readTimeoutMillis(); - } - - /** - * Sets the read timeout (in milliseconds). A value of 0 means no timeout, otherwise values must - * be between 1 and {@link java.lang.Integer#MAX_VALUE}. - * - * @param readTimeout read timeout in milliseconds - * @return Api client - */ - public ApiClient setReadTimeout(int readTimeout) { - httpClient = - httpClient.newBuilder().readTimeout(readTimeout, TimeUnit.MILLISECONDS).build(); - return this; - } - - /** - * Get write timeout (in milliseconds). - * - * @return Timeout in milliseconds - */ - public int getWriteTimeout() { - return httpClient.writeTimeoutMillis(); - } - - /** - * Sets the write timeout (in milliseconds). A value of 0 means no timeout, otherwise values - * must be between 1 and {@link java.lang.Integer#MAX_VALUE}. - * - * @param writeTimeout connection timeout in milliseconds - * @return Api client - */ - public ApiClient setWriteTimeout(int writeTimeout) { - httpClient = - httpClient.newBuilder().writeTimeout(writeTimeout, TimeUnit.MILLISECONDS).build(); - return this; - } - - /** - * Format the given parameter object into string. - * - * @param param Parameter - * @return String representation of the parameter - */ - public String parameterToString(Object param) { - if (param == null) { - return ""; - } else if (param instanceof Date - || param instanceof OffsetDateTime - || param instanceof LocalDate) { - // Serialize to json string and remove the " enclosing characters - String jsonStr = JSON.serialize(param); - return jsonStr.substring(1, jsonStr.length() - 1); - } else if (param instanceof Collection) { - StringBuilder b = new StringBuilder(); - for (Object o : (Collection) param) { - if (b.length() > 0) { - b.append(","); - } - b.append(o); - } - return b.toString(); - } else { - return String.valueOf(param); - } - } - - /** - * Formats the specified query parameter to a list containing a single {@code Pair} object. - * - *

Note that {@code value} must not be a collection. - * - * @param name The name of the parameter. - * @param value The value of the parameter. - * @return A list containing a single {@code Pair} object. - */ - public List parameterToPair(String name, Object value) { - List params = new ArrayList(); - - // preconditions - if (name == null || name.isEmpty() || value == null || value instanceof Collection) { - return params; - } - - params.add(new Pair(name, parameterToString(value))); - return params; - } - - /** - * Formats the specified collection query parameters to a list of {@code Pair} objects. - * - *

Note that the values of each of the returned Pair objects are percent-encoded. - * - * @param collectionFormat The collection format of the parameter. - * @param name The name of the parameter. - * @param value The value of the parameter. - * @return A list of {@code Pair} objects. - */ - public List parameterToPairs(String collectionFormat, String name, Collection value) { - List params = new ArrayList(); - - // preconditions - if (name == null || name.isEmpty() || value == null || value.isEmpty()) { - return params; - } - - // create the params based on the collection format - if ("multi".equals(collectionFormat)) { - for (Object item : value) { - params.add(new Pair(name, escapeString(parameterToString(item)))); - } - return params; - } - - // collectionFormat is assumed to be "csv" by default - String delimiter = ","; - - // escape all delimiters except commas, which are URI reserved - // characters - if ("ssv".equals(collectionFormat)) { - delimiter = escapeString(" "); - } else if ("tsv".equals(collectionFormat)) { - delimiter = escapeString("\t"); - } else if ("pipes".equals(collectionFormat)) { - delimiter = escapeString("|"); - } - - StringBuilder sb = new StringBuilder(); - for (Object item : value) { - sb.append(delimiter); - sb.append(escapeString(parameterToString(item))); - } - - params.add(new Pair(name, sb.substring(delimiter.length()))); - - return params; - } - - /** - * Formats the specified free-form query parameters to a list of {@code Pair} objects. - * - * @param value The free-form query parameters. - * @return A list of {@code Pair} objects. - */ - public List freeFormParameterToPairs(Object value) { - List params = new ArrayList<>(); - - // preconditions - if (value == null || !(value instanceof Map)) { - return params; - } - - @SuppressWarnings("unchecked") - final Map valuesMap = (Map) value; - - for (Map.Entry entry : valuesMap.entrySet()) { - params.add(new Pair(entry.getKey(), parameterToString(entry.getValue()))); - } - - return params; - } - - /** - * Formats the specified collection path parameter to a string value. - * - * @param collectionFormat The collection format of the parameter. - * @param value The value of the parameter. - * @return String representation of the parameter - */ - public String collectionPathParameterToString(String collectionFormat, Collection value) { - // create the value based on the collection format - if ("multi".equals(collectionFormat)) { - // not valid for path params - return parameterToString(value); - } - - // collectionFormat is assumed to be "csv" by default - String delimiter = ","; - - if ("ssv".equals(collectionFormat)) { - delimiter = " "; - } else if ("tsv".equals(collectionFormat)) { - delimiter = "\t"; - } else if ("pipes".equals(collectionFormat)) { - delimiter = "|"; - } - - StringBuilder sb = new StringBuilder(); - for (Object item : value) { - sb.append(delimiter); - sb.append(parameterToString(item)); - } - - return sb.substring(delimiter.length()); - } - - /** - * Sanitize filename by removing path. e.g. ../../sun.gif becomes sun.gif - * - * @param filename The filename to be sanitized - * @return The sanitized filename - */ - public String sanitizeFilename(String filename) { - return filename.replaceFirst("^.*[/\\\\]", ""); - } - - /** - * Check if the given MIME is a JSON MIME. JSON MIME examples: application/json - * application/json; charset=UTF8 APPLICATION/JSON application/vnd.company+json "* / *" is also - * default to JSON - * - * @param mime MIME (Multipurpose Internet Mail Extensions) - * @return True if the given MIME is JSON, false otherwise. - */ - public boolean isJsonMime(String mime) { - String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"; - return mime != null && (mime.matches(jsonMime) || mime.equals("*/*")); - } - - /** - * Select the Accept header's value from the given accepts array: if JSON exists in the given - * array, use it; otherwise use all of them (joining into a string) - * - * @param accepts The accepts array to select from - * @return The Accept header to use. If the given array is empty, null will be returned (not to - * set the Accept header explicitly). - */ - public String selectHeaderAccept(String[] accepts) { - if (accepts.length == 0) { - return null; - } - for (String accept : accepts) { - if (isJsonMime(accept)) { - return accept; - } - } - return StringUtil.join(accepts, ","); - } - - /** - * Select the Content-Type header's value from the given array: if JSON exists in the given - * array, use it; otherwise use the first one of the array. - * - * @param contentTypes The Content-Type array to select from - * @return The Content-Type header to use. If the given array is empty, returns null. If it - * matches "any", JSON will be used. - */ - public String selectHeaderContentType(String[] contentTypes) { - if (contentTypes.length == 0) { - return null; - } - - if (contentTypes[0].equals("*/*")) { - return "application/json"; - } - - for (String contentType : contentTypes) { - if (isJsonMime(contentType)) { - return contentType; - } - } - - return contentTypes[0]; - } - - /** - * Escape the given string to be used as URL query value. - * - * @param str String to be escaped - * @return Escaped string - */ - public String escapeString(String str) { - try { - return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); - } catch (UnsupportedEncodingException e) { - return str; - } - } - - /** - * Deserialize response body to Java object, according to the return type and the Content-Type - * response header. - * - * @param Type - * @param response HTTP response - * @param returnType The type of the Java object - * @return The deserialized Java object - * @throws cloud.stackit.sdk.core.exception.ApiException If fail to deserialize response body, - * i.e. cannot read response body or the Content-Type of the response is not supported. - */ - @SuppressWarnings("unchecked") - public T deserialize(Response response, Type returnType) throws ApiException { - if (response == null || returnType == null) { - return null; - } - - if ("byte[]".equals(returnType.toString())) { - // Handle binary response (byte array). - try { - return (T) response.body().bytes(); - } catch (IOException e) { - throw new ApiException(e); - } - } else if (returnType.equals(File.class)) { - // Handle file downloading. - return (T) downloadFileFromResponse(response); - } - - ResponseBody respBody = response.body(); - if (respBody == null) { - return null; - } - - String contentType = response.headers().get("Content-Type"); - if (contentType == null) { - // ensuring a default content type - contentType = "application/json"; - } - try { - if (isJsonMime(contentType)) { - if (returnType.equals(String.class)) { - String respBodyString = respBody.string(); - if (respBodyString.isEmpty()) { - return null; - } - // Use String-based deserialize for String return type with fallback - return JSON.deserialize(respBodyString, returnType); - } else { - // Use InputStream-based deserialize which supports responses > 2GB - return JSON.deserialize(respBody.byteStream(), returnType); - } - } else if (returnType.equals(String.class)) { - String respBodyString = respBody.string(); - if (respBodyString.isEmpty()) { - return null; - } - // Expecting string, return the raw response body. - return (T) respBodyString; - } else { - throw new ApiException( - "Content type \"" - + contentType - + "\" is not supported for type: " - + returnType, - response.code(), - response.headers().toMultimap(), - response.body().string()); - } - } catch (IOException e) { - throw new ApiException(e); - } - } - - /** - * Serialize the given Java object into request body according to the object's class and the - * request Content-Type. - * - * @param obj The Java object - * @param contentType The request Content-Type - * @return The serialized request body - * @throws cloud.stackit.sdk.core.exception.ApiException If fail to serialize the given object - */ - public RequestBody serialize(Object obj, String contentType) throws ApiException { - if (obj instanceof byte[]) { - // Binary (byte array) body parameter support. - return RequestBody.create((byte[]) obj, MediaType.parse(contentType)); - } else if (obj instanceof File) { - // File body parameter support. - return RequestBody.create((File) obj, MediaType.parse(contentType)); - } else if ("text/plain".equals(contentType) && obj instanceof String) { - return RequestBody.create((String) obj, MediaType.parse(contentType)); - } else if (isJsonMime(contentType)) { - String content; - if (obj != null) { - content = JSON.serialize(obj); - } else { - content = null; - } - return RequestBody.create(content, MediaType.parse(contentType)); - } else if (obj instanceof String) { - return RequestBody.create((String) obj, MediaType.parse(contentType)); - } else { - throw new ApiException("Content type \"" + contentType + "\" is not supported"); - } - } - - /** - * Download file from the given response. - * - * @param response An instance of the Response object - * @throws cloud.stackit.sdk.core.exception.ApiException If fail to read file content from - * response and write to disk - * @return Downloaded file - */ - public File downloadFileFromResponse(Response response) throws ApiException { - try { - File file = prepareDownloadFile(response); - BufferedSink sink = Okio.buffer(Okio.sink(file)); - sink.writeAll(response.body().source()); - sink.close(); - return file; - } catch (IOException e) { - throw new ApiException(e); - } - } - - /** - * Prepare file for download - * - * @param response An instance of the Response object - * @return Prepared file for the download - * @throws java.io.IOException If fail to prepare file for download - */ - public File prepareDownloadFile(Response response) throws IOException { - String filename = null; - String contentDisposition = response.header("Content-Disposition"); - if (contentDisposition != null && !"".equals(contentDisposition)) { - // Get filename from the Content-Disposition header. - Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); - Matcher matcher = pattern.matcher(contentDisposition); - if (matcher.find()) { - filename = sanitizeFilename(matcher.group(1)); - } - } - - String prefix = null; - String suffix = null; - if (filename == null) { - prefix = "download-"; - suffix = ""; - } else { - int pos = filename.lastIndexOf("."); - if (pos == -1) { - prefix = filename + "-"; - } else { - prefix = filename.substring(0, pos) + "-"; - suffix = filename.substring(pos); - } - // Files.createTempFile requires the prefix to be at least three characters long - if (prefix.length() < 3) prefix = "download-"; - } - - if (tempFolderPath == null) return Files.createTempFile(prefix, suffix).toFile(); - else return Files.createTempFile(Paths.get(tempFolderPath), prefix, suffix).toFile(); - } - - /** - * {@link #execute(Call, Type)} - * - * @param Type - * @param call An instance of the Call object - * @return ApiResponse<T> - * @throws cloud.stackit.sdk.core.exception.ApiException If fail to execute the call - */ - public ApiResponse execute(Call call) throws ApiException { - return execute(call, null); - } - - /** - * Execute HTTP call and deserialize the HTTP response body into the given return type. - * - * @param returnType The return type used to deserialize HTTP response body - * @param The return type corresponding to (same with) returnType - * @param call Call - * @return ApiResponse object containing response status, headers and data, which is a Java - * object deserialized from response body and would be null when returnType is null. - * @throws cloud.stackit.sdk.core.exception.ApiException If fail to execute the call - */ - public ApiResponse execute(Call call, Type returnType) throws ApiException { - try { - Response response = call.execute(); - T data = handleResponse(response, returnType); - return new ApiResponse(response.code(), response.headers().toMultimap(), data); - } catch (IOException e) { - throw new ApiException(e); - } - } - - /** - * {@link #executeAsync(Call, Type, ApiCallback)} - * - * @param Type - * @param call An instance of the Call object - * @param callback ApiCallback<T> - */ - public void executeAsync(Call call, ApiCallback callback) { - executeAsync(call, null, callback); - } - - /** - * Execute HTTP call asynchronously. - * - * @param Type - * @param call The callback to be executed when the API call finishes - * @param returnType Return type - * @param callback ApiCallback - * @see #execute(Call, Type) - */ - @SuppressWarnings("unchecked") - public void executeAsync(Call call, final Type returnType, final ApiCallback callback) { - call.enqueue( - new Callback() { - @Override - public void onFailure(Call call, IOException e) { - callback.onFailure(new ApiException(e), 0, null); - } - - @Override - public void onResponse(Call call, Response response) throws IOException { - T result; - try { - result = (T) handleResponse(response, returnType); - } catch (ApiException e) { - callback.onFailure(e, response.code(), response.headers().toMultimap()); - return; - } catch (Exception e) { - callback.onFailure( - new ApiException(e), - response.code(), - response.headers().toMultimap()); - return; - } - callback.onSuccess( - result, response.code(), response.headers().toMultimap()); - } - }); - } - - /** - * Handle the given response, return the deserialized object when the response is successful. - * - * @param Type - * @param response Response - * @param returnType Return type - * @return Type - * @throws cloud.stackit.sdk.core.exception.ApiException If the response has an unsuccessful - * status code or fail to deserialize the response body - */ - public T handleResponse(Response response, Type returnType) throws ApiException { - if (response.isSuccessful()) { - if (returnType == null || response.code() == 204) { - // returning null if the returnType is not defined, - // or the status code is 204 (No Content) - if (response.body() != null) { - try { - response.body().close(); - } catch (Exception e) { - throw new ApiException( - response.message(), - e, - response.code(), - response.headers().toMultimap()); - } - } - return null; - } else { - return deserialize(response, returnType); - } - } else { - String respBody = null; - if (response.body() != null) { - try { - respBody = response.body().string(); - } catch (IOException e) { - throw new ApiException( - response.message(), - e, - response.code(), - response.headers().toMultimap()); - } - } - throw new ApiException( - response.message(), response.code(), response.headers().toMultimap(), respBody); - } - } - - /** - * Build HTTP call with the given options. - * - * @param baseUrl The base URL - * @param path The sub-path of the HTTP URL - * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and - * "DELETE" - * @param queryParams The query parameters - * @param collectionQueryParams The collection query parameters - * @param body The request body object - * @param headerParams The header parameters - * @param cookieParams The cookie parameters - * @param formParams The form parameters - * @param authNames The authentications to apply - * @param callback Callback for upload/download progress - * @return The HTTP call - * @throws cloud.stackit.sdk.core.exception.ApiException If fail to serialize the request body - * object - */ - public Call buildCall( - String baseUrl, - String path, - String method, - List queryParams, - List collectionQueryParams, - Object body, - Map headerParams, - Map cookieParams, - Map formParams, - String[] authNames, - ApiCallback callback) - throws ApiException { - Request request = - buildRequest( - baseUrl, - path, - method, - queryParams, - collectionQueryParams, - body, - headerParams, - cookieParams, - formParams, - authNames, - callback); - - return httpClient.newCall(request); - } - - /** - * Build an HTTP request with the given options. - * - * @param baseUrl The base URL - * @param path The sub-path of the HTTP URL - * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and - * "DELETE" - * @param queryParams The query parameters - * @param collectionQueryParams The collection query parameters - * @param body The request body object - * @param headerParams The header parameters - * @param cookieParams The cookie parameters - * @param formParams The form parameters - * @param authNames The authentications to apply - * @param callback Callback for upload/download progress - * @return The HTTP request - * @throws cloud.stackit.sdk.core.exception.ApiException If fail to serialize the request body - * object - */ - public Request buildRequest( - String baseUrl, - String path, - String method, - List queryParams, - List collectionQueryParams, - Object body, - Map headerParams, - Map cookieParams, - Map formParams, - String[] authNames, - ApiCallback callback) - throws ApiException { - final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams); - - // prepare HTTP request body - RequestBody reqBody; - String contentType = headerParams.get("Content-Type"); - String contentTypePure = contentType; - if (contentTypePure != null && contentTypePure.contains(";")) { - contentTypePure = contentType.substring(0, contentType.indexOf(";")); - } - if (!HttpMethod.permitsRequestBody(method)) { - reqBody = null; - } else if ("application/x-www-form-urlencoded".equals(contentTypePure)) { - reqBody = buildRequestBodyFormEncoding(formParams); - } else if ("multipart/form-data".equals(contentTypePure)) { - reqBody = buildRequestBodyMultipart(formParams); - } else if (body == null) { - if ("DELETE".equals(method)) { - // allow calling DELETE without sending a request body - reqBody = null; - } else { - // use an empty request body (for POST, PUT and PATCH) - reqBody = - RequestBody.create( - "", contentType == null ? null : MediaType.parse(contentType)); - } - } else { - reqBody = serialize(body, contentType); - } - - List updatedQueryParams = new ArrayList<>(queryParams); - - final Request.Builder reqBuilder = - new Request.Builder() - .url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams)); - processHeaderParams(headerParams, reqBuilder); - processCookieParams(cookieParams, reqBuilder); - - // Associate callback with request (if not null) so interceptor can - // access it when creating ProgressResponseBody - reqBuilder.tag(callback); - - Request request = null; - - if (callback != null && reqBody != null) { - ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, callback); - request = reqBuilder.method(method, progressRequestBody).build(); - } else { - request = reqBuilder.method(method, reqBody).build(); - } - - return request; - } - - /** - * Build full URL by concatenating base path, the given sub path and query parameters. - * - * @param baseUrl The base URL - * @param path The sub path - * @param queryParams The query parameters - * @param collectionQueryParams The collection query parameters - * @return The full URL - */ - public String buildUrl( - String baseUrl, String path, List queryParams, List collectionQueryParams) { - final StringBuilder url = new StringBuilder(); - if (baseUrl != null) { - url.append(baseUrl).append(path); - } else { - String baseURL; - if (serverIndex != null) { - if (serverIndex < 0 || serverIndex >= servers.size()) { - throw new ArrayIndexOutOfBoundsException( - String.format( - java.util.Locale.ROOT, - "Invalid index %d when selecting the host settings. Must be less than %d", - serverIndex, - servers.size())); - } - baseURL = servers.get(serverIndex).URL(serverVariables); - } else { - baseURL = basePath; - } - url.append(baseURL).append(path); - } - - if (queryParams != null && !queryParams.isEmpty()) { - // support (constant) query string in `path`, e.g. "/posts?draft=1" - String prefix = path.contains("?") ? "&" : "?"; - for (Pair param : queryParams) { - if (param.getValue() != null) { - if (prefix != null) { - url.append(prefix); - prefix = null; - } else { - url.append("&"); - } - String value = parameterToString(param.getValue()); - url.append(escapeString(param.getName())) - .append("=") - .append(escapeString(value)); - } - } - } - - if (collectionQueryParams != null && !collectionQueryParams.isEmpty()) { - String prefix = url.toString().contains("?") ? "&" : "?"; - for (Pair param : collectionQueryParams) { - if (param.getValue() != null) { - if (prefix != null) { - url.append(prefix); - prefix = null; - } else { - url.append("&"); - } - String value = parameterToString(param.getValue()); - // collection query parameter value already escaped as part of parameterToPairs - url.append(escapeString(param.getName())).append("=").append(value); - } - } - } - - return url.toString(); - } - - /** - * Set header parameters to the request builder, including default headers. - * - * @param headerParams Header parameters in the form of Map - * @param reqBuilder Request.Builder - */ - public void processHeaderParams(Map headerParams, Request.Builder reqBuilder) { - for (Entry param : headerParams.entrySet()) { - reqBuilder.header(param.getKey(), parameterToString(param.getValue())); - } - for (Entry header : defaultHeaderMap.entrySet()) { - if (!headerParams.containsKey(header.getKey())) { - reqBuilder.header(header.getKey(), parameterToString(header.getValue())); - } - } - } - - /** - * Set cookie parameters to the request builder, including default cookies. - * - * @param cookieParams Cookie parameters in the form of Map - * @param reqBuilder Request.Builder - */ - public void processCookieParams(Map cookieParams, Request.Builder reqBuilder) { - for (Entry param : cookieParams.entrySet()) { - reqBuilder.addHeader( - "Cookie", - String.format( - java.util.Locale.ROOT, "%s=%s", param.getKey(), param.getValue())); - } - for (Entry param : defaultCookieMap.entrySet()) { - if (!cookieParams.containsKey(param.getKey())) { - reqBuilder.addHeader( - "Cookie", - String.format( - java.util.Locale.ROOT, "%s=%s", param.getKey(), param.getValue())); - } - } - } - - /** - * Build a form-encoding request body with the given form parameters. - * - * @param formParams Form parameters in the form of Map - * @return RequestBody - */ - public RequestBody buildRequestBodyFormEncoding(Map formParams) { - okhttp3.FormBody.Builder formBuilder = new okhttp3.FormBody.Builder(); - for (Entry param : formParams.entrySet()) { - formBuilder.add(param.getKey(), parameterToString(param.getValue())); - } - return formBuilder.build(); - } - - /** - * Build a multipart (file uploading) request body with the given form parameters, which could - * contain text fields and file fields. - * - * @param formParams Form parameters in the form of Map - * @return RequestBody - */ - public RequestBody buildRequestBodyMultipart(Map formParams) { - MultipartBody.Builder mpBuilder = new MultipartBody.Builder().setType(MultipartBody.FORM); - for (Entry param : formParams.entrySet()) { - if (param.getValue() instanceof File) { - File file = (File) param.getValue(); - addPartToMultiPartBuilder(mpBuilder, param.getKey(), file); - } else if (param.getValue() instanceof List) { - List list = (List) param.getValue(); - for (Object item : list) { - if (item instanceof File) { - addPartToMultiPartBuilder(mpBuilder, param.getKey(), (File) item); - } else { - addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); - } - } - } else { - addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); - } - } - return mpBuilder.build(); - } - - /** - * Guess Content-Type header from the given file (defaults to "application/octet-stream"). - * - * @param file The given file - * @return The guessed Content-Type - */ - public String guessContentTypeFromFile(File file) { - String contentType = URLConnection.guessContentTypeFromName(file.getName()); - if (contentType == null) { - return "application/octet-stream"; - } else { - return contentType; - } - } - - /** - * Add a Content-Disposition Header for the given key and file to the MultipartBody Builder. - * - * @param mpBuilder MultipartBody.Builder - * @param key The key of the Header element - * @param file The file to add to the Header - */ - protected void addPartToMultiPartBuilder( - MultipartBody.Builder mpBuilder, String key, File file) { - Headers partHeaders = - Headers.of( - "Content-Disposition", - "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\""); - MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); - mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType)); - } - - /** - * Add a Content-Disposition Header for the given key and complex object to the MultipartBody - * Builder. - * - * @param mpBuilder MultipartBody.Builder - * @param key The key of the Header element - * @param obj The complex object to add to the Header - */ - protected void addPartToMultiPartBuilder( - MultipartBody.Builder mpBuilder, String key, Object obj) { - RequestBody requestBody; - if (obj instanceof String) { - requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain")); - } else { - String content; - if (obj != null) { - content = JSON.serialize(obj); - } else { - content = null; - } - requestBody = RequestBody.create(content, MediaType.parse("application/json")); - } - - Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\""); - mpBuilder.addPart(partHeaders, requestBody); - } - - /** - * Get network interceptor to add it to the httpClient to track download progress for async - * requests. - */ - protected Interceptor getProgressInterceptor() { - return new Interceptor() { - @Override - public Response intercept(Interceptor.Chain chain) throws IOException { - final Request request = chain.request(); - final Response originalResponse = chain.proceed(request); - if (request.tag() instanceof ApiCallback) { - final ApiCallback callback = (ApiCallback) request.tag(); - return originalResponse - .newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), callback)) - .build(); - } - return originalResponse; - } - }; - } - - /** - * Apply SSL related settings to httpClient according to the current values of verifyingSsl and - * sslCaCert. - */ - protected void applySslSettings() { - try { - TrustManager[] trustManagers; - HostnameVerifier hostnameVerifier; - if (!verifyingSsl) { - trustManagers = - new TrustManager[] { - new X509TrustManager() { - @Override - public void checkClientTrusted( - java.security.cert.X509Certificate[] chain, String authType) - throws CertificateException {} - - @Override - public void checkServerTrusted( - java.security.cert.X509Certificate[] chain, String authType) - throws CertificateException {} - - @Override - public java.security.cert.X509Certificate[] getAcceptedIssuers() { - return new java.security.cert.X509Certificate[] {}; - } - } - }; - hostnameVerifier = - new HostnameVerifier() { - @Override - public boolean verify(String hostname, SSLSession session) { - return true; - } - }; - } else { - TrustManagerFactory trustManagerFactory = - TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); - - if (sslCaCert == null) { - trustManagerFactory.init((KeyStore) null); - } else { - char[] password = null; // Any password will work. - CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); - Collection certificates = - certificateFactory.generateCertificates(sslCaCert); - if (certificates.isEmpty()) { - throw new IllegalArgumentException( - "expected non-empty set of trusted certificates"); - } - KeyStore caKeyStore = newEmptyKeyStore(password); - int index = 0; - for (Certificate certificate : certificates) { - String certificateAlias = "ca" + (index++); - caKeyStore.setCertificateEntry(certificateAlias, certificate); - } - trustManagerFactory.init(caKeyStore); - } - trustManagers = trustManagerFactory.getTrustManagers(); - if (tlsServerName != null && !tlsServerName.isEmpty()) { - hostnameVerifier = - new HostnameVerifier() { - @Override - public boolean verify(String hostname, SSLSession session) { - // Verify the certificate against tlsServerName instead of the - // actual hostname - return OkHostnameVerifier.INSTANCE.verify( - tlsServerName, session); - } - }; - } else { - hostnameVerifier = OkHostnameVerifier.INSTANCE; - } - } - - SSLContext sslContext = SSLContext.getInstance("TLS"); - sslContext.init(keyManagers, trustManagers, new SecureRandom()); - httpClient = - httpClient - .newBuilder() - .sslSocketFactory( - sslContext.getSocketFactory(), - (X509TrustManager) trustManagers[0]) - .hostnameVerifier(hostnameVerifier) - .build(); - } catch (GeneralSecurityException e) { - throw new RuntimeException(e); - } - } - - protected KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException { - try { - KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); - keyStore.load(null, password); - return keyStore; - } catch (IOException e) { - throw new AssertionError(e); - } - } - - /** - * Convert the HTTP request body to a string. - * - * @param requestBody The HTTP request object - * @return The string representation of the HTTP request body - * @throws cloud.stackit.sdk.core.exception.ApiException If fail to serialize the request body - * object into a string - */ - protected String requestBodyToString(RequestBody requestBody) throws ApiException { - if (requestBody != null) { - try { - final Buffer buffer = new Buffer(); - requestBody.writeTo(buffer); - return buffer.readUtf8(); - } catch (final IOException e) { - throw new ApiException(e); - } - } - - // empty http request body - return ""; - } -} diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/ApiResponse.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/ApiResponse.java deleted file mode 100644 index 3277c12d..00000000 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/ApiResponse.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * STACKIT Server Update Management API - * API endpoints for Server Update Operations on STACKIT Servers. - * - * The version of the OpenAPI document: 1.0 - * Contact: support@stackit.de - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package cloud.stackit.sdk.serverupdate.v1api; - -import java.util.List; -import java.util.Map; - -/** API response returned by API call. */ -public class ApiResponse { - private final int statusCode; - private final Map> headers; - private final T data; - - /** - * Constructor for ApiResponse. - * - * @param statusCode The status code of HTTP response - * @param headers The headers of HTTP response - */ - public ApiResponse(int statusCode, Map> headers) { - this(statusCode, headers, null); - } - - /** - * Constructor for ApiResponse. - * - * @param statusCode The status code of HTTP response - * @param headers The headers of HTTP response - * @param data The object deserialized from response bod - */ - public ApiResponse(int statusCode, Map> headers, T data) { - this.statusCode = statusCode; - this.headers = headers; - this.data = data; - } - - /** - * Get the status code. - * - * @return the status code - */ - public int getStatusCode() { - return statusCode; - } - - /** - * Get the headers. - * - * @return a {@link java.util.Map} of headers - */ - public Map> getHeaders() { - return headers; - } - - /** - * Get the data. - * - * @return the data - */ - public T getData() { - return data; - } -} diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/GzipRequestInterceptor.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/GzipRequestInterceptor.java deleted file mode 100644 index 97867de6..00000000 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/GzipRequestInterceptor.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * STACKIT Server Update Management API - * API endpoints for Server Update Operations on STACKIT Servers. - * - * The version of the OpenAPI document: 1.0 - * Contact: support@stackit.de - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package cloud.stackit.sdk.serverupdate.v1api; - -import java.io.IOException; -import okhttp3.*; -import okio.Buffer; -import okio.BufferedSink; -import okio.GzipSink; -import okio.Okio; - -/** - * Encodes request bodies using gzip. - * - *

Taken from https://github.com/square/okhttp/issues/350 - */ -class GzipRequestInterceptor implements Interceptor { - @Override - public Response intercept(Chain chain) throws IOException { - Request originalRequest = chain.request(); - if (originalRequest.body() == null || originalRequest.header("Content-Encoding") != null) { - return chain.proceed(originalRequest); - } - - Request compressedRequest = - originalRequest - .newBuilder() - .header("Content-Encoding", "gzip") - .method( - originalRequest.method(), - forceContentLength(gzip(originalRequest.body()))) - .build(); - return chain.proceed(compressedRequest); - } - - private RequestBody forceContentLength(final RequestBody requestBody) throws IOException { - final Buffer buffer = new Buffer(); - requestBody.writeTo(buffer); - return new RequestBody() { - @Override - public MediaType contentType() { - return requestBody.contentType(); - } - - @Override - public long contentLength() { - return buffer.size(); - } - - @Override - public void writeTo(BufferedSink sink) throws IOException { - sink.write(buffer.snapshot()); - } - }; - } - - private RequestBody gzip(final RequestBody body) { - return new RequestBody() { - @Override - public MediaType contentType() { - return body.contentType(); - } - - @Override - public long contentLength() { - return -1; // We don't know the compressed length in advance! - } - - @Override - public void writeTo(BufferedSink sink) throws IOException { - BufferedSink gzipSink = Okio.buffer(new GzipSink(sink)); - body.writeTo(gzipSink); - gzipSink.close(); - } - }; - } -} diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/JSON.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/JSON.java deleted file mode 100644 index 0e0c7674..00000000 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/JSON.java +++ /dev/null @@ -1,459 +0,0 @@ -/* - * STACKIT Server Update Management API - * API endpoints for Server Update Operations on STACKIT Servers. - * - * The version of the OpenAPI document: 1.0 - * Contact: support@stackit.de - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package cloud.stackit.sdk.serverupdate.v1api; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonElement; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapter; -import com.google.gson.internal.bind.util.ISO8601Utils; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.gsonfire.GsonFireBuilder; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.StringReader; -import java.lang.reflect.Type; -import java.nio.charset.StandardCharsets; -import java.text.DateFormat; -import java.text.ParseException; -import java.text.ParsePosition; -import java.time.LocalDate; -import java.time.OffsetDateTime; -import java.time.format.DateTimeFormatter; -import java.util.Date; -import java.util.Map; -import okio.ByteString; - -/* - * A JSON utility class - * - * NOTE: in the future, this class may be converted to static, which may break - * backward-compatibility - */ -public class JSON { - private static Gson gson; - private static boolean isLenientOnJson = false; - private static DateTypeAdapter dateTypeAdapter = new DateTypeAdapter(); - private static SqlDateTypeAdapter sqlDateTypeAdapter = new SqlDateTypeAdapter(); - private static OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = - new OffsetDateTimeTypeAdapter(); - private static LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter(); - private static ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter(); - - @SuppressWarnings("unchecked") - public static GsonBuilder createGson() { - GsonFireBuilder fireBuilder = new GsonFireBuilder(); - GsonBuilder builder = fireBuilder.createGsonBuilder(); - return builder; - } - - private static String getDiscriminatorValue( - JsonElement readElement, String discriminatorField) { - JsonElement element = readElement.getAsJsonObject().get(discriminatorField); - if (null == element) { - throw new IllegalArgumentException( - "missing discriminator field: <" + discriminatorField + ">"); - } - return element.getAsString(); - } - - /** - * Returns the Java class that implements the OpenAPI schema for the specified discriminator - * value. - * - * @param classByDiscriminatorValue The map of discriminator values to Java classes. - * @param discriminatorValue The value of the OpenAPI discriminator in the input data. - * @return The Java class that implements the OpenAPI schema - */ - private static Class getClassByDiscriminator( - Map classByDiscriminatorValue, String discriminatorValue) { - Class clazz = (Class) classByDiscriminatorValue.get(discriminatorValue); - if (null == clazz) { - throw new IllegalArgumentException( - "cannot determine model class of name: <" + discriminatorValue + ">"); - } - return clazz; - } - - static { - GsonBuilder gsonBuilder = createGson(); - gsonBuilder.registerTypeAdapter(Date.class, dateTypeAdapter); - gsonBuilder.registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter); - gsonBuilder.registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter); - gsonBuilder.registerTypeAdapter(LocalDate.class, localDateTypeAdapter); - gsonBuilder.registerTypeAdapter(byte[].class, byteArrayAdapter); - gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.serverupdate.v1api.model.CreateUpdatePayload - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.serverupdate.v1api.model.CreateUpdateSchedulePayload - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.serverupdate.v1api.model.EnableServicePayload - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.serverupdate.v1api.model.EnableServiceResourcePayload - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.serverupdate.v1api.model.GetUpdatePoliciesResponse - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.serverupdate.v1api.model.GetUpdateSchedulesResponse - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.serverupdate.v1api.model.GetUpdateServiceResponse - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.serverupdate.v1api.model.GetUpdatesListResponse - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.serverupdate.v1api.model.Update.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.serverupdate.v1api.model.UpdatePolicy - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.serverupdate.v1api.model.UpdateSchedule - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.serverupdate.v1api.model.UpdateScheduleCreateRequest - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.serverupdate.v1api.model.UpdateUpdateSchedulePayload - .CustomTypeAdapterFactory()); - gson = gsonBuilder.create(); - } - - /** - * Get Gson. - * - * @return Gson - */ - public static Gson getGson() { - return gson; - } - - /** - * Set Gson. - * - * @param gson Gson - */ - public static void setGson(Gson gson) { - JSON.gson = gson; - } - - public static void setLenientOnJson(boolean lenientOnJson) { - isLenientOnJson = lenientOnJson; - } - - /** - * Serialize the given Java object into JSON string. - * - * @param obj Object - * @return String representation of the JSON - */ - public static String serialize(Object obj) { - return gson.toJson(obj); - } - - /** - * Deserialize the given JSON string to Java object. - * - * @param Type - * @param body The JSON string - * @param returnType The type to deserialize into - * @return The deserialized Java object - */ - @SuppressWarnings("unchecked") - public static T deserialize(String body, Type returnType) { - try { - if (isLenientOnJson) { - JsonReader jsonReader = new JsonReader(new StringReader(body)); - // see - // https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean) - jsonReader.setLenient(true); - return gson.fromJson(jsonReader, returnType); - } else { - return gson.fromJson(body, returnType); - } - } catch (JsonParseException e) { - // Fallback processing when failed to parse JSON form response body: - // return the response body string directly for the String return type; - if (returnType.equals(String.class)) { - return (T) body; - } else { - throw (e); - } - } - } - - /** - * Deserialize the given JSON InputStream to a Java object. - * - * @param Type - * @param inputStream The JSON InputStream - * @param returnType The type to deserialize into - * @return The deserialized Java object - */ - @SuppressWarnings("unchecked") - public static T deserialize(InputStream inputStream, Type returnType) throws IOException { - try (InputStreamReader reader = - new InputStreamReader(inputStream, StandardCharsets.UTF_8)) { - if (isLenientOnJson) { - // see - // https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean) - JsonReader jsonReader = new JsonReader(reader); - jsonReader.setLenient(true); - return gson.fromJson(jsonReader, returnType); - } else { - return gson.fromJson(reader, returnType); - } - } - } - - /** Gson TypeAdapter for Byte Array type */ - public static class ByteArrayAdapter extends TypeAdapter { - - @Override - public void write(JsonWriter out, byte[] value) throws IOException { - if (value == null) { - out.nullValue(); - } else { - out.value(ByteString.of(value).base64()); - } - } - - @Override - public byte[] read(JsonReader in) throws IOException { - switch (in.peek()) { - case NULL: - in.nextNull(); - return null; - default: - String bytesAsBase64 = in.nextString(); - ByteString byteString = ByteString.decodeBase64(bytesAsBase64); - return byteString.toByteArray(); - } - } - } - - /** Gson TypeAdapter for JSR310 OffsetDateTime type */ - public static class OffsetDateTimeTypeAdapter extends TypeAdapter { - - private DateTimeFormatter formatter; - - public OffsetDateTimeTypeAdapter() { - this(DateTimeFormatter.ISO_OFFSET_DATE_TIME); - } - - public OffsetDateTimeTypeAdapter(DateTimeFormatter formatter) { - this.formatter = formatter; - } - - public void setFormat(DateTimeFormatter dateFormat) { - this.formatter = dateFormat; - } - - @Override - public void write(JsonWriter out, OffsetDateTime date) throws IOException { - if (date == null) { - out.nullValue(); - } else { - out.value(formatter.format(date)); - } - } - - @Override - public OffsetDateTime read(JsonReader in) throws IOException { - switch (in.peek()) { - case NULL: - in.nextNull(); - return null; - default: - String date = in.nextString(); - if (date.endsWith("+0000")) { - date = date.substring(0, date.length() - 5) + "Z"; - } - return OffsetDateTime.parse(date, formatter); - } - } - } - - /** Gson TypeAdapter for JSR310 LocalDate type */ - public static class LocalDateTypeAdapter extends TypeAdapter { - - private DateTimeFormatter formatter; - - public LocalDateTypeAdapter() { - this(DateTimeFormatter.ISO_LOCAL_DATE); - } - - public LocalDateTypeAdapter(DateTimeFormatter formatter) { - this.formatter = formatter; - } - - public void setFormat(DateTimeFormatter dateFormat) { - this.formatter = dateFormat; - } - - @Override - public void write(JsonWriter out, LocalDate date) throws IOException { - if (date == null) { - out.nullValue(); - } else { - out.value(formatter.format(date)); - } - } - - @Override - public LocalDate read(JsonReader in) throws IOException { - switch (in.peek()) { - case NULL: - in.nextNull(); - return null; - default: - String date = in.nextString(); - return LocalDate.parse(date, formatter); - } - } - } - - public static void setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { - offsetDateTimeTypeAdapter.setFormat(dateFormat); - } - - public static void setLocalDateFormat(DateTimeFormatter dateFormat) { - localDateTypeAdapter.setFormat(dateFormat); - } - - /** - * Gson TypeAdapter for java.sql.Date type If the dateFormat is null, a simple "yyyy-MM-dd" - * format will be used (more efficient than SimpleDateFormat). - */ - public static class SqlDateTypeAdapter extends TypeAdapter { - - private DateFormat dateFormat; - - public SqlDateTypeAdapter() {} - - public SqlDateTypeAdapter(DateFormat dateFormat) { - this.dateFormat = dateFormat; - } - - public void setFormat(DateFormat dateFormat) { - this.dateFormat = dateFormat; - } - - @Override - public void write(JsonWriter out, java.sql.Date date) throws IOException { - if (date == null) { - out.nullValue(); - } else { - String value; - if (dateFormat != null) { - value = dateFormat.format(date); - } else { - value = date.toString(); - } - out.value(value); - } - } - - @Override - public java.sql.Date read(JsonReader in) throws IOException { - switch (in.peek()) { - case NULL: - in.nextNull(); - return null; - default: - String date = in.nextString(); - try { - if (dateFormat != null) { - return new java.sql.Date(dateFormat.parse(date).getTime()); - } - return new java.sql.Date( - ISO8601Utils.parse(date, new ParsePosition(0)).getTime()); - } catch (ParseException e) { - throw new JsonParseException(e); - } - } - } - } - - /** - * Gson TypeAdapter for java.util.Date type If the dateFormat is null, ISO8601Utils will be - * used. - */ - public static class DateTypeAdapter extends TypeAdapter { - - private DateFormat dateFormat; - - public DateTypeAdapter() {} - - public DateTypeAdapter(DateFormat dateFormat) { - this.dateFormat = dateFormat; - } - - public void setFormat(DateFormat dateFormat) { - this.dateFormat = dateFormat; - } - - @Override - public void write(JsonWriter out, Date date) throws IOException { - if (date == null) { - out.nullValue(); - } else { - String value; - if (dateFormat != null) { - value = dateFormat.format(date); - } else { - value = ISO8601Utils.format(date, true); - } - out.value(value); - } - } - - @Override - public Date read(JsonReader in) throws IOException { - try { - switch (in.peek()) { - case NULL: - in.nextNull(); - return null; - default: - String date = in.nextString(); - try { - if (dateFormat != null) { - return dateFormat.parse(date); - } - return ISO8601Utils.parse(date, new ParsePosition(0)); - } catch (ParseException e) { - throw new JsonParseException(e); - } - } - } catch (IllegalArgumentException e) { - throw new JsonParseException(e); - } - } - } - - public static void setDateFormat(DateFormat dateFormat) { - dateTypeAdapter.setFormat(dateFormat); - } - - public static void setSqlDateFormat(DateFormat dateFormat) { - sqlDateTypeAdapter.setFormat(dateFormat); - } -} diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/Pair.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/Pair.java deleted file mode 100644 index 7d6bea5c..00000000 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/Pair.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * STACKIT Server Update Management API - * API endpoints for Server Update Operations on STACKIT Servers. - * - * The version of the OpenAPI document: 1.0 - * Contact: support@stackit.de - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package cloud.stackit.sdk.serverupdate.v1api; - -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - comments = "Generator version: 7.19.0") -public class Pair { - private final String name; - private final String value; - - public Pair(String name, String value) { - this.name = isValidString(name) ? name : ""; - this.value = isValidString(value) ? value : ""; - } - - public String getName() { - return this.name; - } - - public String getValue() { - return this.value; - } - - private static boolean isValidString(String arg) { - return arg != null; - } -} diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/ProgressRequestBody.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/ProgressRequestBody.java deleted file mode 100644 index 1b584c94..00000000 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/ProgressRequestBody.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * STACKIT Server Update Management API - * API endpoints for Server Update Operations on STACKIT Servers. - * - * The version of the OpenAPI document: 1.0 - * Contact: support@stackit.de - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package cloud.stackit.sdk.serverupdate.v1api; - -import java.io.IOException; -import okhttp3.MediaType; -import okhttp3.RequestBody; -import okio.Buffer; -import okio.BufferedSink; -import okio.ForwardingSink; -import okio.Okio; -import okio.Sink; - -public class ProgressRequestBody extends RequestBody { - - private final RequestBody requestBody; - - private final ApiCallback callback; - - public ProgressRequestBody(RequestBody requestBody, ApiCallback callback) { - this.requestBody = requestBody; - this.callback = callback; - } - - @Override - public MediaType contentType() { - return requestBody.contentType(); - } - - @Override - public long contentLength() throws IOException { - return requestBody.contentLength(); - } - - @Override - public void writeTo(BufferedSink sink) throws IOException { - BufferedSink bufferedSink = Okio.buffer(sink(sink)); - requestBody.writeTo(bufferedSink); - bufferedSink.flush(); - } - - private Sink sink(Sink sink) { - return new ForwardingSink(sink) { - - long bytesWritten = 0L; - long contentLength = 0L; - - @Override - public void write(Buffer source, long byteCount) throws IOException { - super.write(source, byteCount); - if (contentLength == 0) { - contentLength = contentLength(); - } - - bytesWritten += byteCount; - callback.onUploadProgress( - bytesWritten, contentLength, bytesWritten == contentLength); - } - }; - } -} diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/ProgressResponseBody.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/ProgressResponseBody.java deleted file mode 100644 index 5377dbeb..00000000 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/ProgressResponseBody.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * STACKIT Server Update Management API - * API endpoints for Server Update Operations on STACKIT Servers. - * - * The version of the OpenAPI document: 1.0 - * Contact: support@stackit.de - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package cloud.stackit.sdk.serverupdate.v1api; - -import java.io.IOException; -import okhttp3.MediaType; -import okhttp3.ResponseBody; -import okio.Buffer; -import okio.BufferedSource; -import okio.ForwardingSource; -import okio.Okio; -import okio.Source; - -public class ProgressResponseBody extends ResponseBody { - - private final ResponseBody responseBody; - private final ApiCallback callback; - private BufferedSource bufferedSource; - - public ProgressResponseBody(ResponseBody responseBody, ApiCallback callback) { - this.responseBody = responseBody; - this.callback = callback; - } - - @Override - public MediaType contentType() { - return responseBody.contentType(); - } - - @Override - public long contentLength() { - return responseBody.contentLength(); - } - - @Override - public BufferedSource source() { - if (bufferedSource == null) { - bufferedSource = Okio.buffer(source(responseBody.source())); - } - return bufferedSource; - } - - private Source source(Source source) { - return new ForwardingSource(source) { - long totalBytesRead = 0L; - - @Override - public long read(Buffer sink, long byteCount) throws IOException { - long bytesRead = super.read(sink, byteCount); - // read() returns the number of bytes read, or -1 if this source is exhausted. - totalBytesRead += bytesRead != -1 ? bytesRead : 0; - callback.onDownloadProgress( - totalBytesRead, responseBody.contentLength(), bytesRead == -1); - return bytesRead; - } - }; - } -} diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/ServerConfiguration.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/ServerConfiguration.java deleted file mode 100644 index 4b7ada83..00000000 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/ServerConfiguration.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * STACKIT Server Update Management API - * API endpoints for Server Update Operations on STACKIT Servers. - * - * The version of the OpenAPI document: 1.0 - * Contact: support@stackit.de - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package cloud.stackit.sdk.serverupdate.v1api; - -import java.util.Map; - -/** Representing a Server configuration. */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - comments = "Generator version: 7.19.0") -public class ServerConfiguration { - public String URL; - public String description; - public Map variables; - - /** - * @param URL A URL to the target host. - * @param description A description of the host designated by the URL. - * @param variables A map between a variable name and its value. The value is used for - * substitution in the server's URL template. - */ - public ServerConfiguration( - String URL, String description, Map variables) { - this.URL = URL; - this.description = description; - this.variables = variables; - } - - /** - * Format URL template using given variables. - * - * @param variables A map between a variable name and its value. - * @return Formatted URL. - */ - public String URL(Map variables) { - String url = this.URL; - - // go through variables and replace placeholders - for (Map.Entry variable : this.variables.entrySet()) { - String name = variable.getKey(); - ServerVariable serverVariable = variable.getValue(); - String value = serverVariable.defaultValue; - - if (variables != null && variables.containsKey(name)) { - value = variables.get(name); - if (serverVariable.enumValues.size() > 0 - && !serverVariable.enumValues.contains(value)) { - throw new IllegalArgumentException( - "The variable " - + name - + " in the server URL has invalid value " - + value - + "."); - } - } - url = url.replace("{" + name + "}", value); - } - return url; - } - - /** - * Format URL template using default server variables. - * - * @return Formatted URL. - */ - public String URL() { - return URL(null); - } -} diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/ServerVariable.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/ServerVariable.java deleted file mode 100644 index 3f05315b..00000000 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/ServerVariable.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * STACKIT Server Update Management API - * API endpoints for Server Update Operations on STACKIT Servers. - * - * The version of the OpenAPI document: 1.0 - * Contact: support@stackit.de - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package cloud.stackit.sdk.serverupdate.v1api; - -import java.util.HashSet; - -/** Representing a Server Variable for server URL template substitution. */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - comments = "Generator version: 7.19.0") -public class ServerVariable { - public String description; - public String defaultValue; - public HashSet enumValues = null; - - /** - * @param description A description for the server variable. - * @param defaultValue The default value to use for substitution. - * @param enumValues An enumeration of string values to be used if the substitution options are - * from a limited set. - */ - public ServerVariable(String description, String defaultValue, HashSet enumValues) { - this.description = description; - this.defaultValue = defaultValue; - this.enumValues = enumValues; - } -} diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/StringUtil.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/StringUtil.java deleted file mode 100644 index 0a9d19e8..00000000 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/StringUtil.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * STACKIT Server Update Management API - * API endpoints for Server Update Operations on STACKIT Servers. - * - * The version of the OpenAPI document: 1.0 - * Contact: support@stackit.de - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package cloud.stackit.sdk.serverupdate.v1api; - -import java.util.Collection; -import java.util.Iterator; - -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - comments = "Generator version: 7.19.0") -public class StringUtil { - /** - * Check if the given array contains the given value (with case-insensitive comparison). - * - * @param array The array - * @param value The value to search - * @return true if the array contains the value - */ - public static boolean containsIgnoreCase(String[] array, String value) { - for (String str : array) { - if (value == null && str == null) { - return true; - } - if (value != null && value.equalsIgnoreCase(str)) { - return true; - } - } - return false; - } - - /** - * Join an array of strings with the given separator. - * - *

Note: This might be replaced by utility method from commons-lang or guava someday if one - * of those libraries is added as dependency. - * - * @param array The array of strings - * @param separator The separator - * @return the resulting string - */ - public static String join(String[] array, String separator) { - int len = array.length; - if (len == 0) { - return ""; - } - - StringBuilder out = new StringBuilder(); - out.append(array[0]); - for (int i = 1; i < len; i++) { - out.append(separator).append(array[i]); - } - return out.toString(); - } - - /** - * Join a list of strings with the given separator. - * - * @param list The list of strings - * @param separator The separator - * @return the resulting string - */ - public static String join(Collection list, String separator) { - Iterator iterator = list.iterator(); - StringBuilder out = new StringBuilder(); - if (iterator.hasNext()) { - out.append(iterator.next()); - } - while (iterator.hasNext()) { - out.append(separator).append(iterator.next()); - } - return out.toString(); - } -} diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/api/DefaultApi.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/api/DefaultApi.java deleted file mode 100644 index 9d46e81c..00000000 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/api/DefaultApi.java +++ /dev/null @@ -1,2867 +0,0 @@ -/* - * STACKIT Server Update Management API - * API endpoints for Server Update Operations on STACKIT Servers. - * - * The version of the OpenAPI document: 1.0 - * Contact: support@stackit.de - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package cloud.stackit.sdk.serverupdate.v1api.api; - -import cloud.stackit.sdk.core.config.CoreConfiguration; -import cloud.stackit.sdk.core.exception.ApiException; -import cloud.stackit.sdk.serverupdate.v1api.ApiCallback; -import cloud.stackit.sdk.serverupdate.v1api.ApiClient; -import cloud.stackit.sdk.serverupdate.v1api.ApiResponse; -import cloud.stackit.sdk.serverupdate.v1api.Pair; -import cloud.stackit.sdk.serverupdate.v1api.model.CreateUpdatePayload; -import cloud.stackit.sdk.serverupdate.v1api.model.CreateUpdateSchedulePayload; -import cloud.stackit.sdk.serverupdate.v1api.model.EnableServicePayload; -import cloud.stackit.sdk.serverupdate.v1api.model.EnableServiceResourcePayload; -import cloud.stackit.sdk.serverupdate.v1api.model.GetUpdatePoliciesResponse; -import cloud.stackit.sdk.serverupdate.v1api.model.GetUpdateSchedulesResponse; -import cloud.stackit.sdk.serverupdate.v1api.model.GetUpdateServiceResponse; -import cloud.stackit.sdk.serverupdate.v1api.model.GetUpdatesListResponse; -import cloud.stackit.sdk.serverupdate.v1api.model.Update; -import cloud.stackit.sdk.serverupdate.v1api.model.UpdateSchedule; -import cloud.stackit.sdk.serverupdate.v1api.model.UpdateUpdateSchedulePayload; -import com.google.gson.reflect.TypeToken; -import java.io.IOException; -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import okhttp3.OkHttpClient; - -// Package-private access to enforce service-specific API usage (DefaultApi => Api) -class DefaultApi { - private ApiClient localVarApiClient; - private int localHostIndex; - private String localCustomBaseUrl; - - /** - * Basic constructor for DefaultApi - * - *

For production use consider using the constructor with the OkHttpClient parameter. - * - * @throws IOException - */ - public DefaultApi() throws IOException { - this(null, new CoreConfiguration()); - } - - /** - * Basic Constructor for DefaultApi - * - *

For production use consider using the constructor with the OkHttpClient parameter. - * - * @param config your STACKIT SDK CoreConfiguration - * @throws IOException - */ - public DefaultApi(CoreConfiguration config) throws IOException { - this(null, config); - } - - /** - * Constructor for DefaultApi - * - * @param httpClient OkHttpClient object - * @throws IOException - */ - public DefaultApi(OkHttpClient httpClient) throws IOException { - this(httpClient, new CoreConfiguration()); - } - - /** - * Constructor for DefaultApi - * - * @param httpClient OkHttpClient object - * @param config your STACKIT SDK CoreConfiguration - * @throws IOException - */ - public DefaultApi(OkHttpClient httpClient, CoreConfiguration config) throws IOException { - if (config.getCustomEndpoint() != null && !config.getCustomEndpoint().trim().isEmpty()) { - localCustomBaseUrl = config.getCustomEndpoint(); - } - this.localVarApiClient = new ApiClient(httpClient, config); - } - - public ApiClient getApiClient() { - return localVarApiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.localVarApiClient = apiClient; - } - - public int getHostIndex() { - return localHostIndex; - } - - public void setHostIndex(int hostIndex) { - this.localHostIndex = hostIndex; - } - - public String getCustomBaseUrl() { - return localCustomBaseUrl; - } - - public void setCustomBaseUrl(String customBaseUrl) { - this.localCustomBaseUrl = customBaseUrl; - } - - /** - * Build call for createUpdate - * - * @param projectId project id (required) - * @param serverId server id (required) - * @param createUpdatePayload (optional) - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details - * - * - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
202 Request is accepted, but processing may take some time. -
400 Bad Request -
401 Unauthorized -
404 Server not found -
409 Update already running -
- */ - public okhttp3.Call createUpdateCall( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - @javax.annotation.Nullable CreateUpdatePayload createUpdatePayload, - final ApiCallback _callback) - throws ApiException { - String basePath = null; - // Operation Servers - String[] localBasePaths = new String[] {}; - - // Determine Base Path to Use - if (localCustomBaseUrl != null) { - basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { - basePath = localBasePaths[localHostIndex]; - } else { - basePath = null; - } - - Object localVarPostBody = createUpdatePayload; - - // create path and map variables - String localVarPath = - "/v1/projects/{projectId}/servers/{serverId}/updates" - .replace( - "{" + "projectId" + "}", - localVarApiClient.escapeString(projectId.toString())) - .replace( - "{" + "serverId" + "}", - localVarApiClient.escapeString(serverId.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = {"application/json"}; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = {"application/json"}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); - if (localVarContentType != null) { - localVarHeaderParams.put("Content-Type", localVarContentType); - } - - String[] localVarAuthNames = new String[] {}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "POST", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call createUpdateValidateBeforeCall( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - @javax.annotation.Nullable CreateUpdatePayload createUpdatePayload, - final ApiCallback _callback) - throws ApiException { - // verify the required parameter 'projectId' is set - if (projectId == null) { - throw new ApiException( - "Missing the required parameter 'projectId' when calling createUpdate(Async)"); - } - - // verify the required parameter 'serverId' is set - if (serverId == null) { - throw new ApiException( - "Missing the required parameter 'serverId' when calling createUpdate(Async)"); - } - - return createUpdateCall(projectId, serverId, createUpdatePayload, _callback); - } - - /** - * create update - * - * @param projectId project id (required) - * @param serverId server id (required) - * @param createUpdatePayload (optional) - * @return Update - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - * @http.response.details - * - * - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
202 Request is accepted, but processing may take some time. -
400 Bad Request -
401 Unauthorized -
404 Server not found -
409 Update already running -
- */ - public Update createUpdate( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - @javax.annotation.Nullable CreateUpdatePayload createUpdatePayload) - throws ApiException { - ApiResponse localVarResp = - createUpdateWithHttpInfo(projectId, serverId, createUpdatePayload); - return localVarResp.getData(); - } - - /** - * create update - * - * @param projectId project id (required) - * @param serverId server id (required) - * @param createUpdatePayload (optional) - * @return ApiResponse<Update> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - * @http.response.details - * - * - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
202 Request is accepted, but processing may take some time. -
400 Bad Request -
401 Unauthorized -
404 Server not found -
409 Update already running -
- */ - public ApiResponse createUpdateWithHttpInfo( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - @javax.annotation.Nullable CreateUpdatePayload createUpdatePayload) - throws ApiException { - okhttp3.Call localVarCall = - createUpdateValidateBeforeCall(projectId, serverId, createUpdatePayload, null); - Type localVarReturnType = new TypeToken() {}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * create update (asynchronously) - * - * @param projectId project id (required) - * @param serverId server id (required) - * @param createUpdatePayload (optional) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object - * @http.response.details - * - * - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
202 Request is accepted, but processing may take some time. -
400 Bad Request -
401 Unauthorized -
404 Server not found -
409 Update already running -
- */ - public okhttp3.Call createUpdateAsync( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - @javax.annotation.Nullable CreateUpdatePayload createUpdatePayload, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = - createUpdateValidateBeforeCall(projectId, serverId, createUpdatePayload, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } - - /** - * Build call for createUpdateSchedule - * - * @param projectId project id (required) - * @param serverId server id (required) - * @param createUpdateSchedulePayload (optional) - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details - * - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
201 Schedule created -
400 Bad Request -
401 Unauthorized -
404 Server not found -
- */ - public okhttp3.Call createUpdateScheduleCall( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - @javax.annotation.Nullable CreateUpdateSchedulePayload createUpdateSchedulePayload, - final ApiCallback _callback) - throws ApiException { - String basePath = null; - // Operation Servers - String[] localBasePaths = new String[] {}; - - // Determine Base Path to Use - if (localCustomBaseUrl != null) { - basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { - basePath = localBasePaths[localHostIndex]; - } else { - basePath = null; - } - - Object localVarPostBody = createUpdateSchedulePayload; - - // create path and map variables - String localVarPath = - "/v1/projects/{projectId}/servers/{serverId}/update-schedules" - .replace( - "{" + "projectId" + "}", - localVarApiClient.escapeString(projectId.toString())) - .replace( - "{" + "serverId" + "}", - localVarApiClient.escapeString(serverId.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = {"application/json"}; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = {"application/json"}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); - if (localVarContentType != null) { - localVarHeaderParams.put("Content-Type", localVarContentType); - } - - String[] localVarAuthNames = new String[] {}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "POST", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call createUpdateScheduleValidateBeforeCall( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - @javax.annotation.Nullable CreateUpdateSchedulePayload createUpdateSchedulePayload, - final ApiCallback _callback) - throws ApiException { - // verify the required parameter 'projectId' is set - if (projectId == null) { - throw new ApiException( - "Missing the required parameter 'projectId' when calling createUpdateSchedule(Async)"); - } - - // verify the required parameter 'serverId' is set - if (serverId == null) { - throw new ApiException( - "Missing the required parameter 'serverId' when calling createUpdateSchedule(Async)"); - } - - return createUpdateScheduleCall( - projectId, serverId, createUpdateSchedulePayload, _callback); - } - - /** - * create update schedule - * - * @param projectId project id (required) - * @param serverId server id (required) - * @param createUpdateSchedulePayload (optional) - * @return UpdateSchedule - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - * @http.response.details - * - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
201 Schedule created -
400 Bad Request -
401 Unauthorized -
404 Server not found -
- */ - public UpdateSchedule createUpdateSchedule( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - @javax.annotation.Nullable CreateUpdateSchedulePayload createUpdateSchedulePayload) - throws ApiException { - ApiResponse localVarResp = - createUpdateScheduleWithHttpInfo(projectId, serverId, createUpdateSchedulePayload); - return localVarResp.getData(); - } - - /** - * create update schedule - * - * @param projectId project id (required) - * @param serverId server id (required) - * @param createUpdateSchedulePayload (optional) - * @return ApiResponse<UpdateSchedule> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - * @http.response.details - * - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
201 Schedule created -
400 Bad Request -
401 Unauthorized -
404 Server not found -
- */ - public ApiResponse createUpdateScheduleWithHttpInfo( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - @javax.annotation.Nullable CreateUpdateSchedulePayload createUpdateSchedulePayload) - throws ApiException { - okhttp3.Call localVarCall = - createUpdateScheduleValidateBeforeCall( - projectId, serverId, createUpdateSchedulePayload, null); - Type localVarReturnType = new TypeToken() {}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * create update schedule (asynchronously) - * - * @param projectId project id (required) - * @param serverId server id (required) - * @param createUpdateSchedulePayload (optional) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object - * @http.response.details - * - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
201 Schedule created -
400 Bad Request -
401 Unauthorized -
404 Server not found -
- */ - public okhttp3.Call createUpdateScheduleAsync( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - @javax.annotation.Nullable CreateUpdateSchedulePayload createUpdateSchedulePayload, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = - createUpdateScheduleValidateBeforeCall( - projectId, serverId, createUpdateSchedulePayload, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } - - /** - * Build call for deleteUpdateSchedule - * - * @param projectId project id (required) - * @param serverId server id (required) - * @param scheduleId update schedule id (required) - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details - * - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
204 update schedule successfully deleted -
400 Bad Request -
401 Unauthorized -
404 Server | schedule not found -
- */ - public okhttp3.Call deleteUpdateScheduleCall( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - @javax.annotation.Nonnull String scheduleId, - final ApiCallback _callback) - throws ApiException { - String basePath = null; - // Operation Servers - String[] localBasePaths = new String[] {}; - - // Determine Base Path to Use - if (localCustomBaseUrl != null) { - basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { - basePath = localBasePaths[localHostIndex]; - } else { - basePath = null; - } - - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = - "/v1/projects/{projectId}/servers/{serverId}/update-schedules/{scheduleId}" - .replace( - "{" + "projectId" + "}", - localVarApiClient.escapeString(projectId.toString())) - .replace( - "{" + "serverId" + "}", - localVarApiClient.escapeString(serverId.toString())) - .replace( - "{" + "scheduleId" + "}", - localVarApiClient.escapeString(scheduleId.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = {}; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); - if (localVarContentType != null) { - localVarHeaderParams.put("Content-Type", localVarContentType); - } - - String[] localVarAuthNames = new String[] {}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "DELETE", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call deleteUpdateScheduleValidateBeforeCall( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - @javax.annotation.Nonnull String scheduleId, - final ApiCallback _callback) - throws ApiException { - // verify the required parameter 'projectId' is set - if (projectId == null) { - throw new ApiException( - "Missing the required parameter 'projectId' when calling deleteUpdateSchedule(Async)"); - } - - // verify the required parameter 'serverId' is set - if (serverId == null) { - throw new ApiException( - "Missing the required parameter 'serverId' when calling deleteUpdateSchedule(Async)"); - } - - // verify the required parameter 'scheduleId' is set - if (scheduleId == null) { - throw new ApiException( - "Missing the required parameter 'scheduleId' when calling deleteUpdateSchedule(Async)"); - } - - return deleteUpdateScheduleCall(projectId, serverId, scheduleId, _callback); - } - - /** - * delete update schedule - * - * @param projectId project id (required) - * @param serverId server id (required) - * @param scheduleId update schedule id (required) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - * @http.response.details - * - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
204 update schedule successfully deleted -
400 Bad Request -
401 Unauthorized -
404 Server | schedule not found -
- */ - public void deleteUpdateSchedule( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - @javax.annotation.Nonnull String scheduleId) - throws ApiException { - deleteUpdateScheduleWithHttpInfo(projectId, serverId, scheduleId); - } - - /** - * delete update schedule - * - * @param projectId project id (required) - * @param serverId server id (required) - * @param scheduleId update schedule id (required) - * @return ApiResponse<Void> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - * @http.response.details - * - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
204 update schedule successfully deleted -
400 Bad Request -
401 Unauthorized -
404 Server | schedule not found -
- */ - public ApiResponse deleteUpdateScheduleWithHttpInfo( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - @javax.annotation.Nonnull String scheduleId) - throws ApiException { - okhttp3.Call localVarCall = - deleteUpdateScheduleValidateBeforeCall(projectId, serverId, scheduleId, null); - return localVarApiClient.execute(localVarCall); - } - - /** - * delete update schedule (asynchronously) - * - * @param projectId project id (required) - * @param serverId server id (required) - * @param scheduleId update schedule id (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object - * @http.response.details - * - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
204 update schedule successfully deleted -
400 Bad Request -
401 Unauthorized -
404 Server | schedule not found -
- */ - public okhttp3.Call deleteUpdateScheduleAsync( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - @javax.annotation.Nonnull String scheduleId, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = - deleteUpdateScheduleValidateBeforeCall(projectId, serverId, scheduleId, _callback); - localVarApiClient.executeAsync(localVarCall, _callback); - return localVarCall; - } - - /** - * Build call for disableService - * - * @param projectId project id (required) - * @param serverId server id (required) - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details - * - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
204 Update service disabled -
400 Bad request -
401 Unauthorized -
404 Server not found -
- * - * @deprecated - */ - @Deprecated - public okhttp3.Call disableServiceCall( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - final ApiCallback _callback) - throws ApiException { - String basePath = null; - // Operation Servers - String[] localBasePaths = new String[] {}; - - // Determine Base Path to Use - if (localCustomBaseUrl != null) { - basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { - basePath = localBasePaths[localHostIndex]; - } else { - basePath = null; - } - - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = - "/v1/projects/{projectId}/servers/{serverId}" - .replace( - "{" + "projectId" + "}", - localVarApiClient.escapeString(projectId.toString())) - .replace( - "{" + "serverId" + "}", - localVarApiClient.escapeString(serverId.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = {}; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); - if (localVarContentType != null) { - localVarHeaderParams.put("Content-Type", localVarContentType); - } - - String[] localVarAuthNames = new String[] {}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "DELETE", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); - } - - @Deprecated - @SuppressWarnings("rawtypes") - private okhttp3.Call disableServiceValidateBeforeCall( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - final ApiCallback _callback) - throws ApiException { - // verify the required parameter 'projectId' is set - if (projectId == null) { - throw new ApiException( - "Missing the required parameter 'projectId' when calling disableService(Async)"); - } - - // verify the required parameter 'serverId' is set - if (serverId == null) { - throw new ApiException( - "Missing the required parameter 'serverId' when calling disableService(Async)"); - } - - return disableServiceCall(projectId, serverId, _callback); - } - - /** - * disable update service - * - * @param projectId project id (required) - * @param serverId server id (required) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - * @http.response.details - * - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
204 Update service disabled -
400 Bad request -
401 Unauthorized -
404 Server not found -
- * - * @deprecated - */ - @Deprecated - public void disableService( - @javax.annotation.Nonnull String projectId, @javax.annotation.Nonnull String serverId) - throws ApiException { - disableServiceWithHttpInfo(projectId, serverId); - } - - /** - * disable update service - * - * @param projectId project id (required) - * @param serverId server id (required) - * @return ApiResponse<Void> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - * @http.response.details - * - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
204 Update service disabled -
400 Bad request -
401 Unauthorized -
404 Server not found -
- * - * @deprecated - */ - @Deprecated - public ApiResponse disableServiceWithHttpInfo( - @javax.annotation.Nonnull String projectId, @javax.annotation.Nonnull String serverId) - throws ApiException { - okhttp3.Call localVarCall = disableServiceValidateBeforeCall(projectId, serverId, null); - return localVarApiClient.execute(localVarCall); - } - - /** - * disable update service (asynchronously) - * - * @param projectId project id (required) - * @param serverId server id (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object - * @http.response.details - * - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
204 Update service disabled -
400 Bad request -
401 Unauthorized -
404 Server not found -
- * - * @deprecated - */ - @Deprecated - public okhttp3.Call disableServiceAsync( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = - disableServiceValidateBeforeCall(projectId, serverId, _callback); - localVarApiClient.executeAsync(localVarCall, _callback); - return localVarCall; - } - - /** - * Build call for disableServiceResource - * - * @param projectId project id (required) - * @param serverId server id (required) - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details - * - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
204 Update service disabled -
400 Bad request -
401 Unauthorized -
404 Server not found -
- */ - public okhttp3.Call disableServiceResourceCall( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - final ApiCallback _callback) - throws ApiException { - String basePath = null; - // Operation Servers - String[] localBasePaths = new String[] {}; - - // Determine Base Path to Use - if (localCustomBaseUrl != null) { - basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { - basePath = localBasePaths[localHostIndex]; - } else { - basePath = null; - } - - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = - "/v1/projects/{projectId}/servers/{serverId}/service" - .replace( - "{" + "projectId" + "}", - localVarApiClient.escapeString(projectId.toString())) - .replace( - "{" + "serverId" + "}", - localVarApiClient.escapeString(serverId.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = {}; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); - if (localVarContentType != null) { - localVarHeaderParams.put("Content-Type", localVarContentType); - } - - String[] localVarAuthNames = new String[] {}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "DELETE", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call disableServiceResourceValidateBeforeCall( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - final ApiCallback _callback) - throws ApiException { - // verify the required parameter 'projectId' is set - if (projectId == null) { - throw new ApiException( - "Missing the required parameter 'projectId' when calling disableServiceResource(Async)"); - } - - // verify the required parameter 'serverId' is set - if (serverId == null) { - throw new ApiException( - "Missing the required parameter 'serverId' when calling disableServiceResource(Async)"); - } - - return disableServiceResourceCall(projectId, serverId, _callback); - } - - /** - * disable update service - * - * @param projectId project id (required) - * @param serverId server id (required) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - * @http.response.details - * - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
204 Update service disabled -
400 Bad request -
401 Unauthorized -
404 Server not found -
- */ - public void disableServiceResource( - @javax.annotation.Nonnull String projectId, @javax.annotation.Nonnull String serverId) - throws ApiException { - disableServiceResourceWithHttpInfo(projectId, serverId); - } - - /** - * disable update service - * - * @param projectId project id (required) - * @param serverId server id (required) - * @return ApiResponse<Void> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - * @http.response.details - * - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
204 Update service disabled -
400 Bad request -
401 Unauthorized -
404 Server not found -
- */ - public ApiResponse disableServiceResourceWithHttpInfo( - @javax.annotation.Nonnull String projectId, @javax.annotation.Nonnull String serverId) - throws ApiException { - okhttp3.Call localVarCall = - disableServiceResourceValidateBeforeCall(projectId, serverId, null); - return localVarApiClient.execute(localVarCall); - } - - /** - * disable update service (asynchronously) - * - * @param projectId project id (required) - * @param serverId server id (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object - * @http.response.details - * - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
204 Update service disabled -
400 Bad request -
401 Unauthorized -
404 Server not found -
- */ - public okhttp3.Call disableServiceResourceAsync( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = - disableServiceResourceValidateBeforeCall(projectId, serverId, _callback); - localVarApiClient.executeAsync(localVarCall, _callback); - return localVarCall; - } - - /** - * Build call for enableService - * - * @param projectId project id (required) - * @param serverId server id (required) - * @param enableServicePayload (optional) - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details - * - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
204 Update service enabled -
400 Bad Request -
401 Unauthorized -
404 Server not found -
- * - * @deprecated - */ - @Deprecated - public okhttp3.Call enableServiceCall( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - @javax.annotation.Nullable EnableServicePayload enableServicePayload, - final ApiCallback _callback) - throws ApiException { - String basePath = null; - // Operation Servers - String[] localBasePaths = new String[] {}; - - // Determine Base Path to Use - if (localCustomBaseUrl != null) { - basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { - basePath = localBasePaths[localHostIndex]; - } else { - basePath = null; - } - - Object localVarPostBody = enableServicePayload; - - // create path and map variables - String localVarPath = - "/v1/projects/{projectId}/servers/{serverId}" - .replace( - "{" + "projectId" + "}", - localVarApiClient.escapeString(projectId.toString())) - .replace( - "{" + "serverId" + "}", - localVarApiClient.escapeString(serverId.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = {}; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = {"application/json"}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); - if (localVarContentType != null) { - localVarHeaderParams.put("Content-Type", localVarContentType); - } - - String[] localVarAuthNames = new String[] {}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "POST", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); - } - - @Deprecated - @SuppressWarnings("rawtypes") - private okhttp3.Call enableServiceValidateBeforeCall( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - @javax.annotation.Nullable EnableServicePayload enableServicePayload, - final ApiCallback _callback) - throws ApiException { - // verify the required parameter 'projectId' is set - if (projectId == null) { - throw new ApiException( - "Missing the required parameter 'projectId' when calling enableService(Async)"); - } - - // verify the required parameter 'serverId' is set - if (serverId == null) { - throw new ApiException( - "Missing the required parameter 'serverId' when calling enableService(Async)"); - } - - return enableServiceCall(projectId, serverId, enableServicePayload, _callback); - } - - /** - * enable update service - * - * @param projectId project id (required) - * @param serverId server id (required) - * @param enableServicePayload (optional) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - * @http.response.details - * - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
204 Update service enabled -
400 Bad Request -
401 Unauthorized -
404 Server not found -
- * - * @deprecated - */ - @Deprecated - public void enableService( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - @javax.annotation.Nullable EnableServicePayload enableServicePayload) - throws ApiException { - enableServiceWithHttpInfo(projectId, serverId, enableServicePayload); - } - - /** - * enable update service - * - * @param projectId project id (required) - * @param serverId server id (required) - * @param enableServicePayload (optional) - * @return ApiResponse<Void> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - * @http.response.details - * - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
204 Update service enabled -
400 Bad Request -
401 Unauthorized -
404 Server not found -
- * - * @deprecated - */ - @Deprecated - public ApiResponse enableServiceWithHttpInfo( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - @javax.annotation.Nullable EnableServicePayload enableServicePayload) - throws ApiException { - okhttp3.Call localVarCall = - enableServiceValidateBeforeCall(projectId, serverId, enableServicePayload, null); - return localVarApiClient.execute(localVarCall); - } - - /** - * enable update service (asynchronously) - * - * @param projectId project id (required) - * @param serverId server id (required) - * @param enableServicePayload (optional) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object - * @http.response.details - * - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
204 Update service enabled -
400 Bad Request -
401 Unauthorized -
404 Server not found -
- * - * @deprecated - */ - @Deprecated - public okhttp3.Call enableServiceAsync( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - @javax.annotation.Nullable EnableServicePayload enableServicePayload, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = - enableServiceValidateBeforeCall( - projectId, serverId, enableServicePayload, _callback); - localVarApiClient.executeAsync(localVarCall, _callback); - return localVarCall; - } - - /** - * Build call for enableServiceResource - * - * @param projectId project id (required) - * @param serverId server id (required) - * @param enableServiceResourcePayload (optional) - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details - * - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
204 Update service enabled -
400 Bad Request -
401 Unauthorized -
404 Server not found -
- */ - public okhttp3.Call enableServiceResourceCall( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - @javax.annotation.Nullable EnableServiceResourcePayload enableServiceResourcePayload, - final ApiCallback _callback) - throws ApiException { - String basePath = null; - // Operation Servers - String[] localBasePaths = new String[] {}; - - // Determine Base Path to Use - if (localCustomBaseUrl != null) { - basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { - basePath = localBasePaths[localHostIndex]; - } else { - basePath = null; - } - - Object localVarPostBody = enableServiceResourcePayload; - - // create path and map variables - String localVarPath = - "/v1/projects/{projectId}/servers/{serverId}/service" - .replace( - "{" + "projectId" + "}", - localVarApiClient.escapeString(projectId.toString())) - .replace( - "{" + "serverId" + "}", - localVarApiClient.escapeString(serverId.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = {}; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = {"application/json"}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); - if (localVarContentType != null) { - localVarHeaderParams.put("Content-Type", localVarContentType); - } - - String[] localVarAuthNames = new String[] {}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "POST", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call enableServiceResourceValidateBeforeCall( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - @javax.annotation.Nullable EnableServiceResourcePayload enableServiceResourcePayload, - final ApiCallback _callback) - throws ApiException { - // verify the required parameter 'projectId' is set - if (projectId == null) { - throw new ApiException( - "Missing the required parameter 'projectId' when calling enableServiceResource(Async)"); - } - - // verify the required parameter 'serverId' is set - if (serverId == null) { - throw new ApiException( - "Missing the required parameter 'serverId' when calling enableServiceResource(Async)"); - } - - return enableServiceResourceCall( - projectId, serverId, enableServiceResourcePayload, _callback); - } - - /** - * enable update service - * - * @param projectId project id (required) - * @param serverId server id (required) - * @param enableServiceResourcePayload (optional) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - * @http.response.details - * - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
204 Update service enabled -
400 Bad Request -
401 Unauthorized -
404 Server not found -
- */ - public void enableServiceResource( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - @javax.annotation.Nullable EnableServiceResourcePayload enableServiceResourcePayload) - throws ApiException { - enableServiceResourceWithHttpInfo(projectId, serverId, enableServiceResourcePayload); - } - - /** - * enable update service - * - * @param projectId project id (required) - * @param serverId server id (required) - * @param enableServiceResourcePayload (optional) - * @return ApiResponse<Void> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - * @http.response.details - * - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
204 Update service enabled -
400 Bad Request -
401 Unauthorized -
404 Server not found -
- */ - public ApiResponse enableServiceResourceWithHttpInfo( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - @javax.annotation.Nullable EnableServiceResourcePayload enableServiceResourcePayload) - throws ApiException { - okhttp3.Call localVarCall = - enableServiceResourceValidateBeforeCall( - projectId, serverId, enableServiceResourcePayload, null); - return localVarApiClient.execute(localVarCall); - } - - /** - * enable update service (asynchronously) - * - * @param projectId project id (required) - * @param serverId server id (required) - * @param enableServiceResourcePayload (optional) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object - * @http.response.details - * - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
204 Update service enabled -
400 Bad Request -
401 Unauthorized -
404 Server not found -
- */ - public okhttp3.Call enableServiceResourceAsync( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - @javax.annotation.Nullable EnableServiceResourcePayload enableServiceResourcePayload, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = - enableServiceResourceValidateBeforeCall( - projectId, serverId, enableServiceResourcePayload, _callback); - localVarApiClient.executeAsync(localVarCall, _callback); - return localVarCall; - } - - /** - * Build call for getServiceResource - * - * @param projectId project id (required) - * @param serverId server id (required) - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details - * - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
200 Update service details -
400 Bad Request -
401 Unauthorized -
404 Server, or service, Not Found -
- */ - public okhttp3.Call getServiceResourceCall( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - final ApiCallback _callback) - throws ApiException { - String basePath = null; - // Operation Servers - String[] localBasePaths = new String[] {}; - - // Determine Base Path to Use - if (localCustomBaseUrl != null) { - basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { - basePath = localBasePaths[localHostIndex]; - } else { - basePath = null; - } - - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = - "/v1/projects/{projectId}/servers/{serverId}/service" - .replace( - "{" + "projectId" + "}", - localVarApiClient.escapeString(projectId.toString())) - .replace( - "{" + "serverId" + "}", - localVarApiClient.escapeString(serverId.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = {"application/json"}; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); - if (localVarContentType != null) { - localVarHeaderParams.put("Content-Type", localVarContentType); - } - - String[] localVarAuthNames = new String[] {}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call getServiceResourceValidateBeforeCall( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - final ApiCallback _callback) - throws ApiException { - // verify the required parameter 'projectId' is set - if (projectId == null) { - throw new ApiException( - "Missing the required parameter 'projectId' when calling getServiceResource(Async)"); - } - - // verify the required parameter 'serverId' is set - if (serverId == null) { - throw new ApiException( - "Missing the required parameter 'serverId' when calling getServiceResource(Async)"); - } - - return getServiceResourceCall(projectId, serverId, _callback); - } - - /** - * get update service details - * - * @param projectId project id (required) - * @param serverId server id (required) - * @return GetUpdateServiceResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - * @http.response.details - * - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
200 Update service details -
400 Bad Request -
401 Unauthorized -
404 Server, or service, Not Found -
- */ - public GetUpdateServiceResponse getServiceResource( - @javax.annotation.Nonnull String projectId, @javax.annotation.Nonnull String serverId) - throws ApiException { - ApiResponse localVarResp = - getServiceResourceWithHttpInfo(projectId, serverId); - return localVarResp.getData(); - } - - /** - * get update service details - * - * @param projectId project id (required) - * @param serverId server id (required) - * @return ApiResponse<GetUpdateServiceResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - * @http.response.details - * - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
200 Update service details -
400 Bad Request -
401 Unauthorized -
404 Server, or service, Not Found -
- */ - public ApiResponse getServiceResourceWithHttpInfo( - @javax.annotation.Nonnull String projectId, @javax.annotation.Nonnull String serverId) - throws ApiException { - okhttp3.Call localVarCall = getServiceResourceValidateBeforeCall(projectId, serverId, null); - Type localVarReturnType = new TypeToken() {}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * get update service details (asynchronously) - * - * @param projectId project id (required) - * @param serverId server id (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object - * @http.response.details - * - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
200 Update service details -
400 Bad Request -
401 Unauthorized -
404 Server, or service, Not Found -
- */ - public okhttp3.Call getServiceResourceAsync( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = - getServiceResourceValidateBeforeCall(projectId, serverId, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } - - /** - * Build call for getUpdate - * - * @param projectId project id (required) - * @param serverId server id (required) - * @param updateId id of the update (required) - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details - * - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
200 update response -
400 Bad Request -
401 Unauthorized -
404 Server | update job not found -
- */ - public okhttp3.Call getUpdateCall( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - @javax.annotation.Nonnull String updateId, - final ApiCallback _callback) - throws ApiException { - String basePath = null; - // Operation Servers - String[] localBasePaths = new String[] {}; - - // Determine Base Path to Use - if (localCustomBaseUrl != null) { - basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { - basePath = localBasePaths[localHostIndex]; - } else { - basePath = null; - } - - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = - "/v1/projects/{projectId}/servers/{serverId}/updates/{updateId}" - .replace( - "{" + "projectId" + "}", - localVarApiClient.escapeString(projectId.toString())) - .replace( - "{" + "serverId" + "}", - localVarApiClient.escapeString(serverId.toString())) - .replace( - "{" + "updateId" + "}", - localVarApiClient.escapeString(updateId.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = {"application/json"}; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); - if (localVarContentType != null) { - localVarHeaderParams.put("Content-Type", localVarContentType); - } - - String[] localVarAuthNames = new String[] {}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call getUpdateValidateBeforeCall( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - @javax.annotation.Nonnull String updateId, - final ApiCallback _callback) - throws ApiException { - // verify the required parameter 'projectId' is set - if (projectId == null) { - throw new ApiException( - "Missing the required parameter 'projectId' when calling getUpdate(Async)"); - } - - // verify the required parameter 'serverId' is set - if (serverId == null) { - throw new ApiException( - "Missing the required parameter 'serverId' when calling getUpdate(Async)"); - } - - // verify the required parameter 'updateId' is set - if (updateId == null) { - throw new ApiException( - "Missing the required parameter 'updateId' when calling getUpdate(Async)"); - } - - return getUpdateCall(projectId, serverId, updateId, _callback); - } - - /** - * get update - * - * @param projectId project id (required) - * @param serverId server id (required) - * @param updateId id of the update (required) - * @return Update - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - * @http.response.details - * - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
200 update response -
400 Bad Request -
401 Unauthorized -
404 Server | update job not found -
- */ - public Update getUpdate( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - @javax.annotation.Nonnull String updateId) - throws ApiException { - ApiResponse localVarResp = getUpdateWithHttpInfo(projectId, serverId, updateId); - return localVarResp.getData(); - } - - /** - * get update - * - * @param projectId project id (required) - * @param serverId server id (required) - * @param updateId id of the update (required) - * @return ApiResponse<Update> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - * @http.response.details - * - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
200 update response -
400 Bad Request -
401 Unauthorized -
404 Server | update job not found -
- */ - public ApiResponse getUpdateWithHttpInfo( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - @javax.annotation.Nonnull String updateId) - throws ApiException { - okhttp3.Call localVarCall = - getUpdateValidateBeforeCall(projectId, serverId, updateId, null); - Type localVarReturnType = new TypeToken() {}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * get update (asynchronously) - * - * @param projectId project id (required) - * @param serverId server id (required) - * @param updateId id of the update (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object - * @http.response.details - * - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
200 update response -
400 Bad Request -
401 Unauthorized -
404 Server | update job not found -
- */ - public okhttp3.Call getUpdateAsync( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - @javax.annotation.Nonnull String updateId, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = - getUpdateValidateBeforeCall(projectId, serverId, updateId, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } - - /** - * Build call for getUpdateSchedule - * - * @param projectId project id (required) - * @param serverId server id (required) - * @param scheduleId update schedule id (required) - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details - * - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
200 update schedule response -
400 Bad Request -
401 Unauthorized -
404 Server | update schedule not found -
- */ - public okhttp3.Call getUpdateScheduleCall( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - @javax.annotation.Nonnull String scheduleId, - final ApiCallback _callback) - throws ApiException { - String basePath = null; - // Operation Servers - String[] localBasePaths = new String[] {}; - - // Determine Base Path to Use - if (localCustomBaseUrl != null) { - basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { - basePath = localBasePaths[localHostIndex]; - } else { - basePath = null; - } - - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = - "/v1/projects/{projectId}/servers/{serverId}/update-schedules/{scheduleId}" - .replace( - "{" + "projectId" + "}", - localVarApiClient.escapeString(projectId.toString())) - .replace( - "{" + "serverId" + "}", - localVarApiClient.escapeString(serverId.toString())) - .replace( - "{" + "scheduleId" + "}", - localVarApiClient.escapeString(scheduleId.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = {"application/json"}; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); - if (localVarContentType != null) { - localVarHeaderParams.put("Content-Type", localVarContentType); - } - - String[] localVarAuthNames = new String[] {}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call getUpdateScheduleValidateBeforeCall( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - @javax.annotation.Nonnull String scheduleId, - final ApiCallback _callback) - throws ApiException { - // verify the required parameter 'projectId' is set - if (projectId == null) { - throw new ApiException( - "Missing the required parameter 'projectId' when calling getUpdateSchedule(Async)"); - } - - // verify the required parameter 'serverId' is set - if (serverId == null) { - throw new ApiException( - "Missing the required parameter 'serverId' when calling getUpdateSchedule(Async)"); - } - - // verify the required parameter 'scheduleId' is set - if (scheduleId == null) { - throw new ApiException( - "Missing the required parameter 'scheduleId' when calling getUpdateSchedule(Async)"); - } - - return getUpdateScheduleCall(projectId, serverId, scheduleId, _callback); - } - - /** - * get single update schedule details - * - * @param projectId project id (required) - * @param serverId server id (required) - * @param scheduleId update schedule id (required) - * @return UpdateSchedule - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - * @http.response.details - * - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
200 update schedule response -
400 Bad Request -
401 Unauthorized -
404 Server | update schedule not found -
- */ - public UpdateSchedule getUpdateSchedule( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - @javax.annotation.Nonnull String scheduleId) - throws ApiException { - ApiResponse localVarResp = - getUpdateScheduleWithHttpInfo(projectId, serverId, scheduleId); - return localVarResp.getData(); - } - - /** - * get single update schedule details - * - * @param projectId project id (required) - * @param serverId server id (required) - * @param scheduleId update schedule id (required) - * @return ApiResponse<UpdateSchedule> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - * @http.response.details - * - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
200 update schedule response -
400 Bad Request -
401 Unauthorized -
404 Server | update schedule not found -
- */ - public ApiResponse getUpdateScheduleWithHttpInfo( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - @javax.annotation.Nonnull String scheduleId) - throws ApiException { - okhttp3.Call localVarCall = - getUpdateScheduleValidateBeforeCall(projectId, serverId, scheduleId, null); - Type localVarReturnType = new TypeToken() {}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * get single update schedule details (asynchronously) - * - * @param projectId project id (required) - * @param serverId server id (required) - * @param scheduleId update schedule id (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object - * @http.response.details - * - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
200 update schedule response -
400 Bad Request -
401 Unauthorized -
404 Server | update schedule not found -
- */ - public okhttp3.Call getUpdateScheduleAsync( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - @javax.annotation.Nonnull String scheduleId, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = - getUpdateScheduleValidateBeforeCall(projectId, serverId, scheduleId, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } - - /** - * Build call for listUpdatePolicies - * - * @param projectId project id (required) - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
200 update policy list response -
400 Bad Request -
404 Project Not Found -
- */ - public okhttp3.Call listUpdatePoliciesCall( - @javax.annotation.Nonnull String projectId, final ApiCallback _callback) - throws ApiException { - String basePath = null; - // Operation Servers - String[] localBasePaths = new String[] {}; - - // Determine Base Path to Use - if (localCustomBaseUrl != null) { - basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { - basePath = localBasePaths[localHostIndex]; - } else { - basePath = null; - } - - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = - "/v1/projects/{projectId}/update-policies" - .replace( - "{" + "projectId" + "}", - localVarApiClient.escapeString(projectId.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = {"application/json"}; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); - if (localVarContentType != null) { - localVarHeaderParams.put("Content-Type", localVarContentType); - } - - String[] localVarAuthNames = new String[] {}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call listUpdatePoliciesValidateBeforeCall( - @javax.annotation.Nonnull String projectId, final ApiCallback _callback) - throws ApiException { - // verify the required parameter 'projectId' is set - if (projectId == null) { - throw new ApiException( - "Missing the required parameter 'projectId' when calling listUpdatePolicies(Async)"); - } - - return listUpdatePoliciesCall(projectId, _callback); - } - - /** - * get list of update policies - * - * @param projectId project id (required) - * @return GetUpdatePoliciesResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - * @http.response.details - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
200 update policy list response -
400 Bad Request -
404 Project Not Found -
- */ - public GetUpdatePoliciesResponse listUpdatePolicies(@javax.annotation.Nonnull String projectId) - throws ApiException { - ApiResponse localVarResp = - listUpdatePoliciesWithHttpInfo(projectId); - return localVarResp.getData(); - } - - /** - * get list of update policies - * - * @param projectId project id (required) - * @return ApiResponse<GetUpdatePoliciesResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - * @http.response.details - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
200 update policy list response -
400 Bad Request -
404 Project Not Found -
- */ - public ApiResponse listUpdatePoliciesWithHttpInfo( - @javax.annotation.Nonnull String projectId) throws ApiException { - okhttp3.Call localVarCall = listUpdatePoliciesValidateBeforeCall(projectId, null); - Type localVarReturnType = new TypeToken() {}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * get list of update policies (asynchronously) - * - * @param projectId project id (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object - * @http.response.details - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
200 update policy list response -
400 Bad Request -
404 Project Not Found -
- */ - public okhttp3.Call listUpdatePoliciesAsync( - @javax.annotation.Nonnull String projectId, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = listUpdatePoliciesValidateBeforeCall(projectId, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } - - /** - * Build call for listUpdateSchedules - * - * @param projectId project id (required) - * @param serverId server id (required) - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details - * - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
200 schedule list response -
400 Bad Request -
401 Unauthorized -
404 Server not found -
- */ - public okhttp3.Call listUpdateSchedulesCall( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - final ApiCallback _callback) - throws ApiException { - String basePath = null; - // Operation Servers - String[] localBasePaths = new String[] {}; - - // Determine Base Path to Use - if (localCustomBaseUrl != null) { - basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { - basePath = localBasePaths[localHostIndex]; - } else { - basePath = null; - } - - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = - "/v1/projects/{projectId}/servers/{serverId}/update-schedules" - .replace( - "{" + "projectId" + "}", - localVarApiClient.escapeString(projectId.toString())) - .replace( - "{" + "serverId" + "}", - localVarApiClient.escapeString(serverId.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = {"application/json"}; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); - if (localVarContentType != null) { - localVarHeaderParams.put("Content-Type", localVarContentType); - } - - String[] localVarAuthNames = new String[] {}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call listUpdateSchedulesValidateBeforeCall( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - final ApiCallback _callback) - throws ApiException { - // verify the required parameter 'projectId' is set - if (projectId == null) { - throw new ApiException( - "Missing the required parameter 'projectId' when calling listUpdateSchedules(Async)"); - } - - // verify the required parameter 'serverId' is set - if (serverId == null) { - throw new ApiException( - "Missing the required parameter 'serverId' when calling listUpdateSchedules(Async)"); - } - - return listUpdateSchedulesCall(projectId, serverId, _callback); - } - - /** - * get list of update schedules - * - * @param projectId project id (required) - * @param serverId server id (required) - * @return GetUpdateSchedulesResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - * @http.response.details - * - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
200 schedule list response -
400 Bad Request -
401 Unauthorized -
404 Server not found -
- */ - public GetUpdateSchedulesResponse listUpdateSchedules( - @javax.annotation.Nonnull String projectId, @javax.annotation.Nonnull String serverId) - throws ApiException { - ApiResponse localVarResp = - listUpdateSchedulesWithHttpInfo(projectId, serverId); - return localVarResp.getData(); - } - - /** - * get list of update schedules - * - * @param projectId project id (required) - * @param serverId server id (required) - * @return ApiResponse<GetUpdateSchedulesResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - * @http.response.details - * - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
200 schedule list response -
400 Bad Request -
401 Unauthorized -
404 Server not found -
- */ - public ApiResponse listUpdateSchedulesWithHttpInfo( - @javax.annotation.Nonnull String projectId, @javax.annotation.Nonnull String serverId) - throws ApiException { - okhttp3.Call localVarCall = - listUpdateSchedulesValidateBeforeCall(projectId, serverId, null); - Type localVarReturnType = new TypeToken() {}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * get list of update schedules (asynchronously) - * - * @param projectId project id (required) - * @param serverId server id (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object - * @http.response.details - * - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
200 schedule list response -
400 Bad Request -
401 Unauthorized -
404 Server not found -
- */ - public okhttp3.Call listUpdateSchedulesAsync( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = - listUpdateSchedulesValidateBeforeCall(projectId, serverId, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } - - /** - * Build call for listUpdates - * - * @param projectId project id (required) - * @param serverId server id (required) - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details - * - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
200 updates list response -
400 Bad Request -
401 Unauthorized -
404 Server not found -
- */ - public okhttp3.Call listUpdatesCall( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - final ApiCallback _callback) - throws ApiException { - String basePath = null; - // Operation Servers - String[] localBasePaths = new String[] {}; - - // Determine Base Path to Use - if (localCustomBaseUrl != null) { - basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { - basePath = localBasePaths[localHostIndex]; - } else { - basePath = null; - } - - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = - "/v1/projects/{projectId}/servers/{serverId}/updates" - .replace( - "{" + "projectId" + "}", - localVarApiClient.escapeString(projectId.toString())) - .replace( - "{" + "serverId" + "}", - localVarApiClient.escapeString(serverId.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = {"application/json"}; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); - if (localVarContentType != null) { - localVarHeaderParams.put("Content-Type", localVarContentType); - } - - String[] localVarAuthNames = new String[] {}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call listUpdatesValidateBeforeCall( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - final ApiCallback _callback) - throws ApiException { - // verify the required parameter 'projectId' is set - if (projectId == null) { - throw new ApiException( - "Missing the required parameter 'projectId' when calling listUpdates(Async)"); - } - - // verify the required parameter 'serverId' is set - if (serverId == null) { - throw new ApiException( - "Missing the required parameter 'serverId' when calling listUpdates(Async)"); - } - - return listUpdatesCall(projectId, serverId, _callback); - } - - /** - * get list of updates - * - * @param projectId project id (required) - * @param serverId server id (required) - * @return GetUpdatesListResponse - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - * @http.response.details - * - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
200 updates list response -
400 Bad Request -
401 Unauthorized -
404 Server not found -
- */ - public GetUpdatesListResponse listUpdates( - @javax.annotation.Nonnull String projectId, @javax.annotation.Nonnull String serverId) - throws ApiException { - ApiResponse localVarResp = - listUpdatesWithHttpInfo(projectId, serverId); - return localVarResp.getData(); - } - - /** - * get list of updates - * - * @param projectId project id (required) - * @param serverId server id (required) - * @return ApiResponse<GetUpdatesListResponse> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - * @http.response.details - * - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
200 updates list response -
400 Bad Request -
401 Unauthorized -
404 Server not found -
- */ - public ApiResponse listUpdatesWithHttpInfo( - @javax.annotation.Nonnull String projectId, @javax.annotation.Nonnull String serverId) - throws ApiException { - okhttp3.Call localVarCall = listUpdatesValidateBeforeCall(projectId, serverId, null); - Type localVarReturnType = new TypeToken() {}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * get list of updates (asynchronously) - * - * @param projectId project id (required) - * @param serverId server id (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object - * @http.response.details - * - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
200 updates list response -
400 Bad Request -
401 Unauthorized -
404 Server not found -
- */ - public okhttp3.Call listUpdatesAsync( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = listUpdatesValidateBeforeCall(projectId, serverId, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } - - /** - * Build call for updateUpdateSchedule - * - * @param projectId project id (required) - * @param serverId server id (required) - * @param scheduleId update schedule id (required) - * @param updateUpdateSchedulePayload (optional) - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details - * - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
200 updated update schedule -
400 Bad Request -
401 Unauthorized -
404 Server | schedule not found -
- */ - public okhttp3.Call updateUpdateScheduleCall( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - @javax.annotation.Nonnull String scheduleId, - @javax.annotation.Nullable UpdateUpdateSchedulePayload updateUpdateSchedulePayload, - final ApiCallback _callback) - throws ApiException { - String basePath = null; - // Operation Servers - String[] localBasePaths = new String[] {}; - - // Determine Base Path to Use - if (localCustomBaseUrl != null) { - basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { - basePath = localBasePaths[localHostIndex]; - } else { - basePath = null; - } - - Object localVarPostBody = updateUpdateSchedulePayload; - - // create path and map variables - String localVarPath = - "/v1/projects/{projectId}/servers/{serverId}/update-schedules/{scheduleId}" - .replace( - "{" + "projectId" + "}", - localVarApiClient.escapeString(projectId.toString())) - .replace( - "{" + "serverId" + "}", - localVarApiClient.escapeString(serverId.toString())) - .replace( - "{" + "scheduleId" + "}", - localVarApiClient.escapeString(scheduleId.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = {"application/json"}; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = {"application/json"}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); - if (localVarContentType != null) { - localVarHeaderParams.put("Content-Type", localVarContentType); - } - - String[] localVarAuthNames = new String[] {}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "PUT", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call updateUpdateScheduleValidateBeforeCall( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - @javax.annotation.Nonnull String scheduleId, - @javax.annotation.Nullable UpdateUpdateSchedulePayload updateUpdateSchedulePayload, - final ApiCallback _callback) - throws ApiException { - // verify the required parameter 'projectId' is set - if (projectId == null) { - throw new ApiException( - "Missing the required parameter 'projectId' when calling updateUpdateSchedule(Async)"); - } - - // verify the required parameter 'serverId' is set - if (serverId == null) { - throw new ApiException( - "Missing the required parameter 'serverId' when calling updateUpdateSchedule(Async)"); - } - - // verify the required parameter 'scheduleId' is set - if (scheduleId == null) { - throw new ApiException( - "Missing the required parameter 'scheduleId' when calling updateUpdateSchedule(Async)"); - } - - return updateUpdateScheduleCall( - projectId, serverId, scheduleId, updateUpdateSchedulePayload, _callback); - } - - /** - * update update schedule - * - * @param projectId project id (required) - * @param serverId server id (required) - * @param scheduleId update schedule id (required) - * @param updateUpdateSchedulePayload (optional) - * @return UpdateSchedule - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - * @http.response.details - * - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
200 updated update schedule -
400 Bad Request -
401 Unauthorized -
404 Server | schedule not found -
- */ - public UpdateSchedule updateUpdateSchedule( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - @javax.annotation.Nonnull String scheduleId, - @javax.annotation.Nullable UpdateUpdateSchedulePayload updateUpdateSchedulePayload) - throws ApiException { - ApiResponse localVarResp = - updateUpdateScheduleWithHttpInfo( - projectId, serverId, scheduleId, updateUpdateSchedulePayload); - return localVarResp.getData(); - } - - /** - * update update schedule - * - * @param projectId project id (required) - * @param serverId server id (required) - * @param scheduleId update schedule id (required) - * @param updateUpdateSchedulePayload (optional) - * @return ApiResponse<UpdateSchedule> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body - * @http.response.details - * - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
200 updated update schedule -
400 Bad Request -
401 Unauthorized -
404 Server | schedule not found -
- */ - public ApiResponse updateUpdateScheduleWithHttpInfo( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - @javax.annotation.Nonnull String scheduleId, - @javax.annotation.Nullable UpdateUpdateSchedulePayload updateUpdateSchedulePayload) - throws ApiException { - okhttp3.Call localVarCall = - updateUpdateScheduleValidateBeforeCall( - projectId, serverId, scheduleId, updateUpdateSchedulePayload, null); - Type localVarReturnType = new TypeToken() {}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * update update schedule (asynchronously) - * - * @param projectId project id (required) - * @param serverId server id (required) - * @param scheduleId update schedule id (required) - * @param updateUpdateSchedulePayload (optional) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object - * @http.response.details - * - * - * - * - * - * - * - *
Response Details
Status Code Description Response Headers
200 updated update schedule -
400 Bad Request -
401 Unauthorized -
404 Server | schedule not found -
- */ - public okhttp3.Call updateUpdateScheduleAsync( - @javax.annotation.Nonnull String projectId, - @javax.annotation.Nonnull String serverId, - @javax.annotation.Nonnull String scheduleId, - @javax.annotation.Nullable UpdateUpdateSchedulePayload updateUpdateSchedulePayload, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = - updateUpdateScheduleValidateBeforeCall( - projectId, serverId, scheduleId, updateUpdateSchedulePayload, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } -} diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/api/ServerUpdateApi.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/api/ServerUpdateApi.java deleted file mode 100644 index 13be1c4f..00000000 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/api/ServerUpdateApi.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * STACKIT Server Update Management API - * API endpoints for Server Update Operations on STACKIT Servers. - * - * The version of the OpenAPI document: 1.0 - * Contact: support@stackit.de - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package cloud.stackit.sdk.serverupdate.v1api.api; - -import cloud.stackit.sdk.core.config.CoreConfiguration; -import java.io.IOException; -import okhttp3.OkHttpClient; - -public class ServerUpdateApi extends DefaultApi { - /** - * Basic constructor for ServerUpdateApi - * - *

For production use consider using the constructor with the OkHttpClient parameter. - * - * @throws IOException - */ - public ServerUpdateApi() throws IOException { - super(); - } - - /** - * Basic Constructor for ServerUpdateApi - * - *

For production use consider using the constructor with the OkHttpClient parameter. - * - * @param configuration your STACKIT SDK CoreConfiguration - * @throws IOException - */ - public ServerUpdateApi(CoreConfiguration configuration) throws IOException { - super(configuration); - } - - /** - * Constructor for ServerUpdateApi - * - * @param httpClient OkHttpClient object - * @throws IOException - */ - public ServerUpdateApi(OkHttpClient httpClient) throws IOException { - super(httpClient); - } - - /** - * Constructor for ServerUpdateApi - * - * @param httpClient OkHttpClient object - * @param configuration your STACKIT SDK CoreConfiguration - * @throws IOException - */ - public ServerUpdateApi(OkHttpClient httpClient, CoreConfiguration configuration) - throws IOException { - super(httpClient, configuration); - } -} diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/AbstractOpenApiSchema.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/AbstractOpenApiSchema.java deleted file mode 100644 index deacf090..00000000 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/AbstractOpenApiSchema.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * STACKIT Server Update Management API - * API endpoints for Server Update Operations on STACKIT Servers. - * - * The version of the OpenAPI document: 1.0 - * Contact: support@stackit.de - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package cloud.stackit.sdk.serverupdate.v1api.model; - -import java.util.Map; -import java.util.Objects; - -/** Abstract class for oneOf,anyOf schemas defined in OpenAPI spec */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - comments = "Generator version: 7.19.0") -public abstract class AbstractOpenApiSchema { - - // store the actual instance of the schema/object - private Object instance; - - // is nullable - private Boolean isNullable; - - // schema type (e.g. oneOf, anyOf) - private final String schemaType; - - public AbstractOpenApiSchema(String schemaType, Boolean isNullable) { - this.schemaType = schemaType; - this.isNullable = isNullable; - } - - /** - * Get the list of oneOf/anyOf composed schemas allowed to be stored in this object - * - * @return an instance of the actual schema/object - */ - public abstract Map> getSchemas(); - - /** - * Get the actual instance - * - * @return an instance of the actual schema/object - */ - // @JsonValue - public Object getActualInstance() { - return instance; - } - - /** - * Set the actual instance - * - * @param instance the actual instance of the schema/object - */ - public void setActualInstance(Object instance) { - this.instance = instance; - } - - /** - * Get the instant recursively when the schemas defined in oneOf/anyof happen to be oneOf/anyOf - * schema as well - * - * @return an instance of the actual schema/object - */ - public Object getActualInstanceRecursively() { - return getActualInstanceRecursively(this); - } - - private Object getActualInstanceRecursively(AbstractOpenApiSchema object) { - if (object.getActualInstance() == null) { - return null; - } else if (object.getActualInstance() instanceof AbstractOpenApiSchema) { - return getActualInstanceRecursively((AbstractOpenApiSchema) object.getActualInstance()); - } else { - return object.getActualInstance(); - } - } - - /** - * Get the schema type (e.g. anyOf, oneOf) - * - * @return the schema type - */ - public String getSchemaType() { - return schemaType; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ").append(getClass()).append(" {\n"); - sb.append(" instance: ").append(toIndentedString(instance)).append("\n"); - sb.append(" isNullable: ").append(toIndentedString(isNullable)).append("\n"); - sb.append(" schemaType: ").append(toIndentedString(schemaType)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - AbstractOpenApiSchema a = (AbstractOpenApiSchema) o; - return Objects.equals(this.instance, a.instance) - && Objects.equals(this.isNullable, a.isNullable) - && Objects.equals(this.schemaType, a.schemaType); - } - - @Override - public int hashCode() { - return Objects.hash(instance, isNullable, schemaType); - } - - /** - * Is nullable - * - * @return true if it's nullable - */ - public Boolean isNullable() { - if (Boolean.TRUE.equals(isNullable)) { - return Boolean.TRUE; - } else { - return Boolean.FALSE; - } - } -} diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/CreateUpdatePayload.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/CreateUpdatePayload.java deleted file mode 100644 index 10837e0d..00000000 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/CreateUpdatePayload.java +++ /dev/null @@ -1,333 +0,0 @@ -/* - * STACKIT Server Update Management API - * API endpoints for Server Update Operations on STACKIT Servers. - * - * The version of the OpenAPI document: 1.0 - * Contact: support@stackit.de - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package cloud.stackit.sdk.serverupdate.v1api.model; - -import cloud.stackit.sdk.serverupdate.v1api.JSON; -import com.google.gson.Gson; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; -import com.google.gson.reflect.TypeToken; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** CreateUpdatePayload */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - comments = "Generator version: 7.19.0") -public class CreateUpdatePayload { - public static final String SERIALIZED_NAME_BACKUP_BEFORE_UPDATE = "backupBeforeUpdate"; - - @SerializedName(SERIALIZED_NAME_BACKUP_BEFORE_UPDATE) - @javax.annotation.Nullable private Boolean backupBeforeUpdate; - - public static final String SERIALIZED_NAME_MAINTENANCE_WINDOW = "maintenanceWindow"; - - @SerializedName(SERIALIZED_NAME_MAINTENANCE_WINDOW) - @javax.annotation.Nonnull - private Integer maintenanceWindow; - - public CreateUpdatePayload() {} - - public CreateUpdatePayload backupBeforeUpdate( - @javax.annotation.Nullable Boolean backupBeforeUpdate) { - this.backupBeforeUpdate = backupBeforeUpdate; - return this; - } - - /** - * Get backupBeforeUpdate - * - * @return backupBeforeUpdate - */ - @javax.annotation.Nullable public Boolean getBackupBeforeUpdate() { - return backupBeforeUpdate; - } - - public void setBackupBeforeUpdate(@javax.annotation.Nullable Boolean backupBeforeUpdate) { - this.backupBeforeUpdate = backupBeforeUpdate; - } - - public CreateUpdatePayload maintenanceWindow( - @javax.annotation.Nonnull Integer maintenanceWindow) { - this.maintenanceWindow = maintenanceWindow; - return this; - } - - /** - * Get maintenanceWindow minimum: 1 maximum: 24 - * - * @return maintenanceWindow - */ - @javax.annotation.Nonnull - public Integer getMaintenanceWindow() { - return maintenanceWindow; - } - - public void setMaintenanceWindow(@javax.annotation.Nonnull Integer maintenanceWindow) { - this.maintenanceWindow = maintenanceWindow; - } - - /** - * A container for additional, undeclared properties. This is a holder for any undeclared - * properties as specified with the 'additionalProperties' keyword in the OAS document. - */ - private Map additionalProperties; - - /** - * Set the additional (undeclared) property with the specified name and value. If the property - * does not already exist, create it otherwise replace it. - * - * @param key name of the property - * @param value value of the property - * @return the CreateUpdatePayload instance itself - */ - public CreateUpdatePayload putAdditionalProperty(String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap(); - } - this.additionalProperties.put(key, value); - return this; - } - - /** - * Return the additional (undeclared) property. - * - * @return a map of objects - */ - public Map getAdditionalProperties() { - return additionalProperties; - } - - /** - * Return the additional (undeclared) property with the specified name. - * - * @param key name of the property - * @return an object - */ - public Object getAdditionalProperty(String key) { - if (this.additionalProperties == null) { - return null; - } - return this.additionalProperties.get(key); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - CreateUpdatePayload createUpdatePayload = (CreateUpdatePayload) o; - return Objects.equals(this.backupBeforeUpdate, createUpdatePayload.backupBeforeUpdate) - && Objects.equals(this.maintenanceWindow, createUpdatePayload.maintenanceWindow) - && Objects.equals( - this.additionalProperties, createUpdatePayload.additionalProperties); - } - - @Override - public int hashCode() { - return Objects.hash(backupBeforeUpdate, maintenanceWindow, additionalProperties); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateUpdatePayload {\n"); - sb.append(" backupBeforeUpdate: ") - .append(toIndentedString(backupBeforeUpdate)) - .append("\n"); - sb.append(" maintenanceWindow: ") - .append(toIndentedString(maintenanceWindow)) - .append("\n"); - sb.append(" additionalProperties: ") - .append(toIndentedString(additionalProperties)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = - new HashSet(Arrays.asList("backupBeforeUpdate", "maintenanceWindow")); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(Arrays.asList("maintenanceWindow")); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to CreateUpdatePayload - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!CreateUpdatePayload.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - java.util.Locale.ROOT, - "The required field(s) %s in CreateUpdatePayload is not found in the empty JSON string", - CreateUpdatePayload.openapiRequiredFields.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : CreateUpdatePayload.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException( - String.format( - java.util.Locale.ROOT, - "The required field `%s` is not found in the JSON string: %s", - requiredField, - jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateUpdatePayload.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateUpdatePayload' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(CreateUpdatePayload.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateUpdatePayload value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - obj.remove("additionalProperties"); - // serialize additional properties - if (value.getAdditionalProperties() != null) { - for (Map.Entry entry : - value.getAdditionalProperties().entrySet()) { - if (entry.getValue() instanceof String) - obj.addProperty(entry.getKey(), (String) entry.getValue()); - else if (entry.getValue() instanceof Number) - obj.addProperty(entry.getKey(), (Number) entry.getValue()); - else if (entry.getValue() instanceof Boolean) - obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); - else if (entry.getValue() instanceof Character) - obj.addProperty( - entry.getKey(), (Character) entry.getValue()); - else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } - } - } - } - elementAdapter.write(out, obj); - } - - @Override - public CreateUpdatePayload read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - CreateUpdatePayload instance = thisAdapter.fromJsonTree(jsonObj); - for (Map.Entry entry : jsonObj.entrySet()) { - if (!openapiFields.contains(entry.getKey())) { - if (entry.getValue().isJsonPrimitive()) { // primitive type - if (entry.getValue().getAsJsonPrimitive().isString()) - instance.putAdditionalProperty( - entry.getKey(), entry.getValue().getAsString()); - else if (entry.getValue().getAsJsonPrimitive().isNumber()) - instance.putAdditionalProperty( - entry.getKey(), entry.getValue().getAsNumber()); - else if (entry.getValue().getAsJsonPrimitive().isBoolean()) - instance.putAdditionalProperty( - entry.getKey(), - entry.getValue().getAsBoolean()); - else - throw new IllegalArgumentException( - String.format( - java.util.Locale.ROOT, - "The field `%s` has unknown primitive type. Value: %s", - entry.getKey(), - entry.getValue().toString())); - } else if (entry.getValue().isJsonArray()) { - instance.putAdditionalProperty( - entry.getKey(), - gson.fromJson(entry.getValue(), List.class)); - } else { // JSON object - instance.putAdditionalProperty( - entry.getKey(), - gson.fromJson(entry.getValue(), HashMap.class)); - } - } - } - return instance; - } - }.nullSafe(); - } - } - - /** - * Create an instance of CreateUpdatePayload given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateUpdatePayload - * @throws IOException if the JSON string is invalid with respect to CreateUpdatePayload - */ - public static CreateUpdatePayload fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateUpdatePayload.class); - } - - /** - * Convert an instance of CreateUpdatePayload to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/CreateUpdateSchedulePayload.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/CreateUpdateSchedulePayload.java deleted file mode 100644 index aec289b5..00000000 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/CreateUpdateSchedulePayload.java +++ /dev/null @@ -1,406 +0,0 @@ -/* - * STACKIT Server Update Management API - * API endpoints for Server Update Operations on STACKIT Servers. - * - * The version of the OpenAPI document: 1.0 - * Contact: support@stackit.de - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package cloud.stackit.sdk.serverupdate.v1api.model; - -import cloud.stackit.sdk.serverupdate.v1api.JSON; -import com.google.gson.Gson; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; -import com.google.gson.reflect.TypeToken; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** CreateUpdateSchedulePayload */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - comments = "Generator version: 7.19.0") -public class CreateUpdateSchedulePayload { - public static final String SERIALIZED_NAME_ENABLED = "enabled"; - - @SerializedName(SERIALIZED_NAME_ENABLED) - @javax.annotation.Nonnull - private Boolean enabled; - - public static final String SERIALIZED_NAME_MAINTENANCE_WINDOW = "maintenanceWindow"; - - @SerializedName(SERIALIZED_NAME_MAINTENANCE_WINDOW) - @javax.annotation.Nonnull - private Integer maintenanceWindow; - - public static final String SERIALIZED_NAME_NAME = "name"; - - @SerializedName(SERIALIZED_NAME_NAME) - @javax.annotation.Nonnull - private String name; - - public static final String SERIALIZED_NAME_RRULE = "rrule"; - - @SerializedName(SERIALIZED_NAME_RRULE) - @javax.annotation.Nonnull - private String rrule; - - public CreateUpdateSchedulePayload() {} - - public CreateUpdateSchedulePayload enabled(@javax.annotation.Nonnull Boolean enabled) { - this.enabled = enabled; - return this; - } - - /** - * Get enabled - * - * @return enabled - */ - @javax.annotation.Nonnull - public Boolean getEnabled() { - return enabled; - } - - public void setEnabled(@javax.annotation.Nonnull Boolean enabled) { - this.enabled = enabled; - } - - public CreateUpdateSchedulePayload maintenanceWindow( - @javax.annotation.Nonnull Integer maintenanceWindow) { - this.maintenanceWindow = maintenanceWindow; - return this; - } - - /** - * Get maintenanceWindow minimum: 1 maximum: 24 - * - * @return maintenanceWindow - */ - @javax.annotation.Nonnull - public Integer getMaintenanceWindow() { - return maintenanceWindow; - } - - public void setMaintenanceWindow(@javax.annotation.Nonnull Integer maintenanceWindow) { - this.maintenanceWindow = maintenanceWindow; - } - - public CreateUpdateSchedulePayload name(@javax.annotation.Nonnull String name) { - this.name = name; - return this; - } - - /** - * Get name - * - * @return name - */ - @javax.annotation.Nonnull - public String getName() { - return name; - } - - public void setName(@javax.annotation.Nonnull String name) { - this.name = name; - } - - public CreateUpdateSchedulePayload rrule(@javax.annotation.Nonnull String rrule) { - this.rrule = rrule; - return this; - } - - /** - * Get rrule - * - * @return rrule - */ - @javax.annotation.Nonnull - public String getRrule() { - return rrule; - } - - public void setRrule(@javax.annotation.Nonnull String rrule) { - this.rrule = rrule; - } - - /** - * A container for additional, undeclared properties. This is a holder for any undeclared - * properties as specified with the 'additionalProperties' keyword in the OAS document. - */ - private Map additionalProperties; - - /** - * Set the additional (undeclared) property with the specified name and value. If the property - * does not already exist, create it otherwise replace it. - * - * @param key name of the property - * @param value value of the property - * @return the CreateUpdateSchedulePayload instance itself - */ - public CreateUpdateSchedulePayload putAdditionalProperty(String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap(); - } - this.additionalProperties.put(key, value); - return this; - } - - /** - * Return the additional (undeclared) property. - * - * @return a map of objects - */ - public Map getAdditionalProperties() { - return additionalProperties; - } - - /** - * Return the additional (undeclared) property with the specified name. - * - * @param key name of the property - * @return an object - */ - public Object getAdditionalProperty(String key) { - if (this.additionalProperties == null) { - return null; - } - return this.additionalProperties.get(key); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - CreateUpdateSchedulePayload createUpdateSchedulePayload = (CreateUpdateSchedulePayload) o; - return Objects.equals(this.enabled, createUpdateSchedulePayload.enabled) - && Objects.equals( - this.maintenanceWindow, createUpdateSchedulePayload.maintenanceWindow) - && Objects.equals(this.name, createUpdateSchedulePayload.name) - && Objects.equals(this.rrule, createUpdateSchedulePayload.rrule) - && Objects.equals( - this.additionalProperties, - createUpdateSchedulePayload.additionalProperties); - } - - @Override - public int hashCode() { - return Objects.hash(enabled, maintenanceWindow, name, rrule, additionalProperties); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateUpdateSchedulePayload {\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - sb.append(" maintenanceWindow: ") - .append(toIndentedString(maintenanceWindow)) - .append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" rrule: ").append(toIndentedString(rrule)).append("\n"); - sb.append(" additionalProperties: ") - .append(toIndentedString(additionalProperties)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = - new HashSet(Arrays.asList("enabled", "maintenanceWindow", "name", "rrule")); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = - new HashSet(Arrays.asList("enabled", "maintenanceWindow", "name", "rrule")); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to - * CreateUpdateSchedulePayload - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!CreateUpdateSchedulePayload.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - java.util.Locale.ROOT, - "The required field(s) %s in CreateUpdateSchedulePayload is not found in the empty JSON string", - CreateUpdateSchedulePayload.openapiRequiredFields.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : CreateUpdateSchedulePayload.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException( - String.format( - java.util.Locale.ROOT, - "The required field `%s` is not found in the JSON string: %s", - requiredField, - jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (!jsonObj.get("name").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - java.util.Locale.ROOT, - "Expected the field `name` to be a primitive type in the JSON string but got `%s`", - jsonObj.get("name").toString())); - } - if (!jsonObj.get("rrule").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - java.util.Locale.ROOT, - "Expected the field `rrule` to be a primitive type in the JSON string but got `%s`", - jsonObj.get("rrule").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateUpdateSchedulePayload.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateUpdateSchedulePayload' and its - // subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(CreateUpdateSchedulePayload.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateUpdateSchedulePayload value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - obj.remove("additionalProperties"); - // serialize additional properties - if (value.getAdditionalProperties() != null) { - for (Map.Entry entry : - value.getAdditionalProperties().entrySet()) { - if (entry.getValue() instanceof String) - obj.addProperty(entry.getKey(), (String) entry.getValue()); - else if (entry.getValue() instanceof Number) - obj.addProperty(entry.getKey(), (Number) entry.getValue()); - else if (entry.getValue() instanceof Boolean) - obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); - else if (entry.getValue() instanceof Character) - obj.addProperty( - entry.getKey(), (Character) entry.getValue()); - else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } - } - } - } - elementAdapter.write(out, obj); - } - - @Override - public CreateUpdateSchedulePayload read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - CreateUpdateSchedulePayload instance = - thisAdapter.fromJsonTree(jsonObj); - for (Map.Entry entry : jsonObj.entrySet()) { - if (!openapiFields.contains(entry.getKey())) { - if (entry.getValue().isJsonPrimitive()) { // primitive type - if (entry.getValue().getAsJsonPrimitive().isString()) - instance.putAdditionalProperty( - entry.getKey(), entry.getValue().getAsString()); - else if (entry.getValue().getAsJsonPrimitive().isNumber()) - instance.putAdditionalProperty( - entry.getKey(), entry.getValue().getAsNumber()); - else if (entry.getValue().getAsJsonPrimitive().isBoolean()) - instance.putAdditionalProperty( - entry.getKey(), - entry.getValue().getAsBoolean()); - else - throw new IllegalArgumentException( - String.format( - java.util.Locale.ROOT, - "The field `%s` has unknown primitive type. Value: %s", - entry.getKey(), - entry.getValue().toString())); - } else if (entry.getValue().isJsonArray()) { - instance.putAdditionalProperty( - entry.getKey(), - gson.fromJson(entry.getValue(), List.class)); - } else { // JSON object - instance.putAdditionalProperty( - entry.getKey(), - gson.fromJson(entry.getValue(), HashMap.class)); - } - } - } - return instance; - } - }.nullSafe(); - } - } - - /** - * Create an instance of CreateUpdateSchedulePayload given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateUpdateSchedulePayload - * @throws IOException if the JSON string is invalid with respect to CreateUpdateSchedulePayload - */ - public static CreateUpdateSchedulePayload fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateUpdateSchedulePayload.class); - } - - /** - * Convert an instance of CreateUpdateSchedulePayload to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/EnableServicePayload.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/EnableServicePayload.java deleted file mode 100644 index 10618b61..00000000 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/EnableServicePayload.java +++ /dev/null @@ -1,296 +0,0 @@ -/* - * STACKIT Server Update Management API - * API endpoints for Server Update Operations on STACKIT Servers. - * - * The version of the OpenAPI document: 1.0 - * Contact: support@stackit.de - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package cloud.stackit.sdk.serverupdate.v1api.model; - -import cloud.stackit.sdk.serverupdate.v1api.JSON; -import com.google.gson.Gson; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; -import com.google.gson.reflect.TypeToken; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.UUID; - -/** EnableServicePayload */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - comments = "Generator version: 7.19.0") -public class EnableServicePayload { - public static final String SERIALIZED_NAME_UPDATE_POLICY_ID = "updatePolicyId"; - - @SerializedName(SERIALIZED_NAME_UPDATE_POLICY_ID) - @javax.annotation.Nullable private UUID updatePolicyId; - - public EnableServicePayload() {} - - public EnableServicePayload updatePolicyId(@javax.annotation.Nullable UUID updatePolicyId) { - this.updatePolicyId = updatePolicyId; - return this; - } - - /** - * Get updatePolicyId - * - * @return updatePolicyId - */ - @javax.annotation.Nullable public UUID getUpdatePolicyId() { - return updatePolicyId; - } - - public void setUpdatePolicyId(@javax.annotation.Nullable UUID updatePolicyId) { - this.updatePolicyId = updatePolicyId; - } - - /** - * A container for additional, undeclared properties. This is a holder for any undeclared - * properties as specified with the 'additionalProperties' keyword in the OAS document. - */ - private Map additionalProperties; - - /** - * Set the additional (undeclared) property with the specified name and value. If the property - * does not already exist, create it otherwise replace it. - * - * @param key name of the property - * @param value value of the property - * @return the EnableServicePayload instance itself - */ - public EnableServicePayload putAdditionalProperty(String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap(); - } - this.additionalProperties.put(key, value); - return this; - } - - /** - * Return the additional (undeclared) property. - * - * @return a map of objects - */ - public Map getAdditionalProperties() { - return additionalProperties; - } - - /** - * Return the additional (undeclared) property with the specified name. - * - * @param key name of the property - * @return an object - */ - public Object getAdditionalProperty(String key) { - if (this.additionalProperties == null) { - return null; - } - return this.additionalProperties.get(key); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - EnableServicePayload enableServicePayload = (EnableServicePayload) o; - return Objects.equals(this.updatePolicyId, enableServicePayload.updatePolicyId) - && Objects.equals( - this.additionalProperties, enableServicePayload.additionalProperties); - } - - @Override - public int hashCode() { - return Objects.hash(updatePolicyId, additionalProperties); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class EnableServicePayload {\n"); - sb.append(" updatePolicyId: ").append(toIndentedString(updatePolicyId)).append("\n"); - sb.append(" additionalProperties: ") - .append(toIndentedString(additionalProperties)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("updatePolicyId")); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(0); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to EnableServicePayload - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!EnableServicePayload.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - java.util.Locale.ROOT, - "The required field(s) %s in EnableServicePayload is not found in the empty JSON string", - EnableServicePayload.openapiRequiredFields.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("updatePolicyId") != null && !jsonObj.get("updatePolicyId").isJsonNull()) - && !jsonObj.get("updatePolicyId").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - java.util.Locale.ROOT, - "Expected the field `updatePolicyId` to be a primitive type in the JSON string but got `%s`", - jsonObj.get("updatePolicyId").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!EnableServicePayload.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'EnableServicePayload' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(EnableServicePayload.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, EnableServicePayload value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - obj.remove("additionalProperties"); - // serialize additional properties - if (value.getAdditionalProperties() != null) { - for (Map.Entry entry : - value.getAdditionalProperties().entrySet()) { - if (entry.getValue() instanceof String) - obj.addProperty(entry.getKey(), (String) entry.getValue()); - else if (entry.getValue() instanceof Number) - obj.addProperty(entry.getKey(), (Number) entry.getValue()); - else if (entry.getValue() instanceof Boolean) - obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); - else if (entry.getValue() instanceof Character) - obj.addProperty( - entry.getKey(), (Character) entry.getValue()); - else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } - } - } - } - elementAdapter.write(out, obj); - } - - @Override - public EnableServicePayload read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - EnableServicePayload instance = thisAdapter.fromJsonTree(jsonObj); - for (Map.Entry entry : jsonObj.entrySet()) { - if (!openapiFields.contains(entry.getKey())) { - if (entry.getValue().isJsonPrimitive()) { // primitive type - if (entry.getValue().getAsJsonPrimitive().isString()) - instance.putAdditionalProperty( - entry.getKey(), entry.getValue().getAsString()); - else if (entry.getValue().getAsJsonPrimitive().isNumber()) - instance.putAdditionalProperty( - entry.getKey(), entry.getValue().getAsNumber()); - else if (entry.getValue().getAsJsonPrimitive().isBoolean()) - instance.putAdditionalProperty( - entry.getKey(), - entry.getValue().getAsBoolean()); - else - throw new IllegalArgumentException( - String.format( - java.util.Locale.ROOT, - "The field `%s` has unknown primitive type. Value: %s", - entry.getKey(), - entry.getValue().toString())); - } else if (entry.getValue().isJsonArray()) { - instance.putAdditionalProperty( - entry.getKey(), - gson.fromJson(entry.getValue(), List.class)); - } else { // JSON object - instance.putAdditionalProperty( - entry.getKey(), - gson.fromJson(entry.getValue(), HashMap.class)); - } - } - } - return instance; - } - }.nullSafe(); - } - } - - /** - * Create an instance of EnableServicePayload given an JSON string - * - * @param jsonString JSON string - * @return An instance of EnableServicePayload - * @throws IOException if the JSON string is invalid with respect to EnableServicePayload - */ - public static EnableServicePayload fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, EnableServicePayload.class); - } - - /** - * Convert an instance of EnableServicePayload to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/EnableServiceResourcePayload.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/EnableServiceResourcePayload.java deleted file mode 100644 index 53b79510..00000000 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/EnableServiceResourcePayload.java +++ /dev/null @@ -1,304 +0,0 @@ -/* - * STACKIT Server Update Management API - * API endpoints for Server Update Operations on STACKIT Servers. - * - * The version of the OpenAPI document: 1.0 - * Contact: support@stackit.de - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package cloud.stackit.sdk.serverupdate.v1api.model; - -import cloud.stackit.sdk.serverupdate.v1api.JSON; -import com.google.gson.Gson; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; -import com.google.gson.reflect.TypeToken; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.UUID; - -/** EnableServiceResourcePayload */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - comments = "Generator version: 7.19.0") -public class EnableServiceResourcePayload { - public static final String SERIALIZED_NAME_UPDATE_POLICY_ID = "updatePolicyId"; - - @SerializedName(SERIALIZED_NAME_UPDATE_POLICY_ID) - @javax.annotation.Nullable private UUID updatePolicyId; - - public EnableServiceResourcePayload() {} - - public EnableServiceResourcePayload updatePolicyId( - @javax.annotation.Nullable UUID updatePolicyId) { - this.updatePolicyId = updatePolicyId; - return this; - } - - /** - * Get updatePolicyId - * - * @return updatePolicyId - */ - @javax.annotation.Nullable public UUID getUpdatePolicyId() { - return updatePolicyId; - } - - public void setUpdatePolicyId(@javax.annotation.Nullable UUID updatePolicyId) { - this.updatePolicyId = updatePolicyId; - } - - /** - * A container for additional, undeclared properties. This is a holder for any undeclared - * properties as specified with the 'additionalProperties' keyword in the OAS document. - */ - private Map additionalProperties; - - /** - * Set the additional (undeclared) property with the specified name and value. If the property - * does not already exist, create it otherwise replace it. - * - * @param key name of the property - * @param value value of the property - * @return the EnableServiceResourcePayload instance itself - */ - public EnableServiceResourcePayload putAdditionalProperty(String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap(); - } - this.additionalProperties.put(key, value); - return this; - } - - /** - * Return the additional (undeclared) property. - * - * @return a map of objects - */ - public Map getAdditionalProperties() { - return additionalProperties; - } - - /** - * Return the additional (undeclared) property with the specified name. - * - * @param key name of the property - * @return an object - */ - public Object getAdditionalProperty(String key) { - if (this.additionalProperties == null) { - return null; - } - return this.additionalProperties.get(key); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - EnableServiceResourcePayload enableServiceResourcePayload = - (EnableServiceResourcePayload) o; - return Objects.equals(this.updatePolicyId, enableServiceResourcePayload.updatePolicyId) - && Objects.equals( - this.additionalProperties, - enableServiceResourcePayload.additionalProperties); - } - - @Override - public int hashCode() { - return Objects.hash(updatePolicyId, additionalProperties); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class EnableServiceResourcePayload {\n"); - sb.append(" updatePolicyId: ").append(toIndentedString(updatePolicyId)).append("\n"); - sb.append(" additionalProperties: ") - .append(toIndentedString(additionalProperties)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("updatePolicyId")); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(0); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to - * EnableServiceResourcePayload - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!EnableServiceResourcePayload.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - java.util.Locale.ROOT, - "The required field(s) %s in EnableServiceResourcePayload is not found in the empty JSON string", - EnableServiceResourcePayload.openapiRequiredFields.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("updatePolicyId") != null && !jsonObj.get("updatePolicyId").isJsonNull()) - && !jsonObj.get("updatePolicyId").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - java.util.Locale.ROOT, - "Expected the field `updatePolicyId` to be a primitive type in the JSON string but got `%s`", - jsonObj.get("updatePolicyId").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!EnableServiceResourcePayload.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'EnableServiceResourcePayload' and its - // subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter( - this, TypeToken.get(EnableServiceResourcePayload.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, EnableServiceResourcePayload value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - obj.remove("additionalProperties"); - // serialize additional properties - if (value.getAdditionalProperties() != null) { - for (Map.Entry entry : - value.getAdditionalProperties().entrySet()) { - if (entry.getValue() instanceof String) - obj.addProperty(entry.getKey(), (String) entry.getValue()); - else if (entry.getValue() instanceof Number) - obj.addProperty(entry.getKey(), (Number) entry.getValue()); - else if (entry.getValue() instanceof Boolean) - obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); - else if (entry.getValue() instanceof Character) - obj.addProperty( - entry.getKey(), (Character) entry.getValue()); - else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } - } - } - } - elementAdapter.write(out, obj); - } - - @Override - public EnableServiceResourcePayload read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - EnableServiceResourcePayload instance = - thisAdapter.fromJsonTree(jsonObj); - for (Map.Entry entry : jsonObj.entrySet()) { - if (!openapiFields.contains(entry.getKey())) { - if (entry.getValue().isJsonPrimitive()) { // primitive type - if (entry.getValue().getAsJsonPrimitive().isString()) - instance.putAdditionalProperty( - entry.getKey(), entry.getValue().getAsString()); - else if (entry.getValue().getAsJsonPrimitive().isNumber()) - instance.putAdditionalProperty( - entry.getKey(), entry.getValue().getAsNumber()); - else if (entry.getValue().getAsJsonPrimitive().isBoolean()) - instance.putAdditionalProperty( - entry.getKey(), - entry.getValue().getAsBoolean()); - else - throw new IllegalArgumentException( - String.format( - java.util.Locale.ROOT, - "The field `%s` has unknown primitive type. Value: %s", - entry.getKey(), - entry.getValue().toString())); - } else if (entry.getValue().isJsonArray()) { - instance.putAdditionalProperty( - entry.getKey(), - gson.fromJson(entry.getValue(), List.class)); - } else { // JSON object - instance.putAdditionalProperty( - entry.getKey(), - gson.fromJson(entry.getValue(), HashMap.class)); - } - } - } - return instance; - } - }.nullSafe(); - } - } - - /** - * Create an instance of EnableServiceResourcePayload given an JSON string - * - * @param jsonString JSON string - * @return An instance of EnableServiceResourcePayload - * @throws IOException if the JSON string is invalid with respect to - * EnableServiceResourcePayload - */ - public static EnableServiceResourcePayload fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, EnableServiceResourcePayload.class); - } - - /** - * Convert an instance of EnableServiceResourcePayload to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/GetUpdatePoliciesResponse.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/GetUpdatePoliciesResponse.java deleted file mode 100644 index a2514640..00000000 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/GetUpdatePoliciesResponse.java +++ /dev/null @@ -1,317 +0,0 @@ -/* - * STACKIT Server Update Management API - * API endpoints for Server Update Operations on STACKIT Servers. - * - * The version of the OpenAPI document: 1.0 - * Contact: support@stackit.de - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package cloud.stackit.sdk.serverupdate.v1api.model; - -import cloud.stackit.sdk.serverupdate.v1api.JSON; -import com.google.gson.Gson; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; -import com.google.gson.reflect.TypeToken; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** GetUpdatePoliciesResponse */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - comments = "Generator version: 7.19.0") -public class GetUpdatePoliciesResponse { - public static final String SERIALIZED_NAME_ITEMS = "items"; - - @SerializedName(SERIALIZED_NAME_ITEMS) - @javax.annotation.Nullable private List items = new ArrayList<>(); - - public GetUpdatePoliciesResponse() {} - - public GetUpdatePoliciesResponse items(@javax.annotation.Nullable List items) { - this.items = items; - return this; - } - - public GetUpdatePoliciesResponse addItemsItem(UpdatePolicy itemsItem) { - if (this.items == null) { - this.items = new ArrayList<>(); - } - this.items.add(itemsItem); - return this; - } - - /** - * Get items - * - * @return items - */ - @javax.annotation.Nullable public List getItems() { - return items; - } - - public void setItems(@javax.annotation.Nullable List items) { - this.items = items; - } - - /** - * A container for additional, undeclared properties. This is a holder for any undeclared - * properties as specified with the 'additionalProperties' keyword in the OAS document. - */ - private Map additionalProperties; - - /** - * Set the additional (undeclared) property with the specified name and value. If the property - * does not already exist, create it otherwise replace it. - * - * @param key name of the property - * @param value value of the property - * @return the GetUpdatePoliciesResponse instance itself - */ - public GetUpdatePoliciesResponse putAdditionalProperty(String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap(); - } - this.additionalProperties.put(key, value); - return this; - } - - /** - * Return the additional (undeclared) property. - * - * @return a map of objects - */ - public Map getAdditionalProperties() { - return additionalProperties; - } - - /** - * Return the additional (undeclared) property with the specified name. - * - * @param key name of the property - * @return an object - */ - public Object getAdditionalProperty(String key) { - if (this.additionalProperties == null) { - return null; - } - return this.additionalProperties.get(key); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - GetUpdatePoliciesResponse getUpdatePoliciesResponse = (GetUpdatePoliciesResponse) o; - return Objects.equals(this.items, getUpdatePoliciesResponse.items) - && Objects.equals( - this.additionalProperties, getUpdatePoliciesResponse.additionalProperties); - } - - @Override - public int hashCode() { - return Objects.hash(items, additionalProperties); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetUpdatePoliciesResponse {\n"); - sb.append(" items: ").append(toIndentedString(items)).append("\n"); - sb.append(" additionalProperties: ") - .append(toIndentedString(additionalProperties)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("items")); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(0); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to GetUpdatePoliciesResponse - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!GetUpdatePoliciesResponse.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - java.util.Locale.ROOT, - "The required field(s) %s in GetUpdatePoliciesResponse is not found in the empty JSON string", - GetUpdatePoliciesResponse.openapiRequiredFields.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (jsonObj.get("items") != null && !jsonObj.get("items").isJsonNull()) { - JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); - if (jsonArrayitems != null) { - // ensure the json data is an array - if (!jsonObj.get("items").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - java.util.Locale.ROOT, - "Expected the field `items` to be an array in the JSON string but got `%s`", - jsonObj.get("items").toString())); - } - - // validate the optional field `items` (array) - for (int i = 0; i < jsonArrayitems.size(); i++) { - UpdatePolicy.validateJsonElement(jsonArrayitems.get(i)); - } - ; - } - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetUpdatePoliciesResponse.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetUpdatePoliciesResponse' and its - // subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(GetUpdatePoliciesResponse.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, GetUpdatePoliciesResponse value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - obj.remove("additionalProperties"); - // serialize additional properties - if (value.getAdditionalProperties() != null) { - for (Map.Entry entry : - value.getAdditionalProperties().entrySet()) { - if (entry.getValue() instanceof String) - obj.addProperty(entry.getKey(), (String) entry.getValue()); - else if (entry.getValue() instanceof Number) - obj.addProperty(entry.getKey(), (Number) entry.getValue()); - else if (entry.getValue() instanceof Boolean) - obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); - else if (entry.getValue() instanceof Character) - obj.addProperty( - entry.getKey(), (Character) entry.getValue()); - else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } - } - } - } - elementAdapter.write(out, obj); - } - - @Override - public GetUpdatePoliciesResponse read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - GetUpdatePoliciesResponse instance = thisAdapter.fromJsonTree(jsonObj); - for (Map.Entry entry : jsonObj.entrySet()) { - if (!openapiFields.contains(entry.getKey())) { - if (entry.getValue().isJsonPrimitive()) { // primitive type - if (entry.getValue().getAsJsonPrimitive().isString()) - instance.putAdditionalProperty( - entry.getKey(), entry.getValue().getAsString()); - else if (entry.getValue().getAsJsonPrimitive().isNumber()) - instance.putAdditionalProperty( - entry.getKey(), entry.getValue().getAsNumber()); - else if (entry.getValue().getAsJsonPrimitive().isBoolean()) - instance.putAdditionalProperty( - entry.getKey(), - entry.getValue().getAsBoolean()); - else - throw new IllegalArgumentException( - String.format( - java.util.Locale.ROOT, - "The field `%s` has unknown primitive type. Value: %s", - entry.getKey(), - entry.getValue().toString())); - } else if (entry.getValue().isJsonArray()) { - instance.putAdditionalProperty( - entry.getKey(), - gson.fromJson(entry.getValue(), List.class)); - } else { // JSON object - instance.putAdditionalProperty( - entry.getKey(), - gson.fromJson(entry.getValue(), HashMap.class)); - } - } - } - return instance; - } - }.nullSafe(); - } - } - - /** - * Create an instance of GetUpdatePoliciesResponse given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetUpdatePoliciesResponse - * @throws IOException if the JSON string is invalid with respect to GetUpdatePoliciesResponse - */ - public static GetUpdatePoliciesResponse fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetUpdatePoliciesResponse.class); - } - - /** - * Convert an instance of GetUpdatePoliciesResponse to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/GetUpdateSchedulesResponse.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/GetUpdateSchedulesResponse.java deleted file mode 100644 index 4e283ee0..00000000 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/GetUpdateSchedulesResponse.java +++ /dev/null @@ -1,317 +0,0 @@ -/* - * STACKIT Server Update Management API - * API endpoints for Server Update Operations on STACKIT Servers. - * - * The version of the OpenAPI document: 1.0 - * Contact: support@stackit.de - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package cloud.stackit.sdk.serverupdate.v1api.model; - -import cloud.stackit.sdk.serverupdate.v1api.JSON; -import com.google.gson.Gson; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; -import com.google.gson.reflect.TypeToken; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** GetUpdateSchedulesResponse */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - comments = "Generator version: 7.19.0") -public class GetUpdateSchedulesResponse { - public static final String SERIALIZED_NAME_ITEMS = "items"; - - @SerializedName(SERIALIZED_NAME_ITEMS) - @javax.annotation.Nullable private List items = new ArrayList<>(); - - public GetUpdateSchedulesResponse() {} - - public GetUpdateSchedulesResponse items(@javax.annotation.Nullable List items) { - this.items = items; - return this; - } - - public GetUpdateSchedulesResponse addItemsItem(UpdateSchedule itemsItem) { - if (this.items == null) { - this.items = new ArrayList<>(); - } - this.items.add(itemsItem); - return this; - } - - /** - * Get items - * - * @return items - */ - @javax.annotation.Nullable public List getItems() { - return items; - } - - public void setItems(@javax.annotation.Nullable List items) { - this.items = items; - } - - /** - * A container for additional, undeclared properties. This is a holder for any undeclared - * properties as specified with the 'additionalProperties' keyword in the OAS document. - */ - private Map additionalProperties; - - /** - * Set the additional (undeclared) property with the specified name and value. If the property - * does not already exist, create it otherwise replace it. - * - * @param key name of the property - * @param value value of the property - * @return the GetUpdateSchedulesResponse instance itself - */ - public GetUpdateSchedulesResponse putAdditionalProperty(String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap(); - } - this.additionalProperties.put(key, value); - return this; - } - - /** - * Return the additional (undeclared) property. - * - * @return a map of objects - */ - public Map getAdditionalProperties() { - return additionalProperties; - } - - /** - * Return the additional (undeclared) property with the specified name. - * - * @param key name of the property - * @return an object - */ - public Object getAdditionalProperty(String key) { - if (this.additionalProperties == null) { - return null; - } - return this.additionalProperties.get(key); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - GetUpdateSchedulesResponse getUpdateSchedulesResponse = (GetUpdateSchedulesResponse) o; - return Objects.equals(this.items, getUpdateSchedulesResponse.items) - && Objects.equals( - this.additionalProperties, getUpdateSchedulesResponse.additionalProperties); - } - - @Override - public int hashCode() { - return Objects.hash(items, additionalProperties); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetUpdateSchedulesResponse {\n"); - sb.append(" items: ").append(toIndentedString(items)).append("\n"); - sb.append(" additionalProperties: ") - .append(toIndentedString(additionalProperties)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("items")); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(0); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to GetUpdateSchedulesResponse - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!GetUpdateSchedulesResponse.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - java.util.Locale.ROOT, - "The required field(s) %s in GetUpdateSchedulesResponse is not found in the empty JSON string", - GetUpdateSchedulesResponse.openapiRequiredFields.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (jsonObj.get("items") != null && !jsonObj.get("items").isJsonNull()) { - JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); - if (jsonArrayitems != null) { - // ensure the json data is an array - if (!jsonObj.get("items").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - java.util.Locale.ROOT, - "Expected the field `items` to be an array in the JSON string but got `%s`", - jsonObj.get("items").toString())); - } - - // validate the optional field `items` (array) - for (int i = 0; i < jsonArrayitems.size(); i++) { - UpdateSchedule.validateJsonElement(jsonArrayitems.get(i)); - } - ; - } - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetUpdateSchedulesResponse.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetUpdateSchedulesResponse' and its - // subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(GetUpdateSchedulesResponse.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, GetUpdateSchedulesResponse value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - obj.remove("additionalProperties"); - // serialize additional properties - if (value.getAdditionalProperties() != null) { - for (Map.Entry entry : - value.getAdditionalProperties().entrySet()) { - if (entry.getValue() instanceof String) - obj.addProperty(entry.getKey(), (String) entry.getValue()); - else if (entry.getValue() instanceof Number) - obj.addProperty(entry.getKey(), (Number) entry.getValue()); - else if (entry.getValue() instanceof Boolean) - obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); - else if (entry.getValue() instanceof Character) - obj.addProperty( - entry.getKey(), (Character) entry.getValue()); - else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } - } - } - } - elementAdapter.write(out, obj); - } - - @Override - public GetUpdateSchedulesResponse read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - GetUpdateSchedulesResponse instance = thisAdapter.fromJsonTree(jsonObj); - for (Map.Entry entry : jsonObj.entrySet()) { - if (!openapiFields.contains(entry.getKey())) { - if (entry.getValue().isJsonPrimitive()) { // primitive type - if (entry.getValue().getAsJsonPrimitive().isString()) - instance.putAdditionalProperty( - entry.getKey(), entry.getValue().getAsString()); - else if (entry.getValue().getAsJsonPrimitive().isNumber()) - instance.putAdditionalProperty( - entry.getKey(), entry.getValue().getAsNumber()); - else if (entry.getValue().getAsJsonPrimitive().isBoolean()) - instance.putAdditionalProperty( - entry.getKey(), - entry.getValue().getAsBoolean()); - else - throw new IllegalArgumentException( - String.format( - java.util.Locale.ROOT, - "The field `%s` has unknown primitive type. Value: %s", - entry.getKey(), - entry.getValue().toString())); - } else if (entry.getValue().isJsonArray()) { - instance.putAdditionalProperty( - entry.getKey(), - gson.fromJson(entry.getValue(), List.class)); - } else { // JSON object - instance.putAdditionalProperty( - entry.getKey(), - gson.fromJson(entry.getValue(), HashMap.class)); - } - } - } - return instance; - } - }.nullSafe(); - } - } - - /** - * Create an instance of GetUpdateSchedulesResponse given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetUpdateSchedulesResponse - * @throws IOException if the JSON string is invalid with respect to GetUpdateSchedulesResponse - */ - public static GetUpdateSchedulesResponse fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetUpdateSchedulesResponse.class); - } - - /** - * Convert an instance of GetUpdateSchedulesResponse to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/GetUpdateServiceResponse.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/GetUpdateServiceResponse.java deleted file mode 100644 index 21ab2e73..00000000 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/GetUpdateServiceResponse.java +++ /dev/null @@ -1,288 +0,0 @@ -/* - * STACKIT Server Update Management API - * API endpoints for Server Update Operations on STACKIT Servers. - * - * The version of the OpenAPI document: 1.0 - * Contact: support@stackit.de - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package cloud.stackit.sdk.serverupdate.v1api.model; - -import cloud.stackit.sdk.serverupdate.v1api.JSON; -import com.google.gson.Gson; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; -import com.google.gson.reflect.TypeToken; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** GetUpdateServiceResponse */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - comments = "Generator version: 7.19.0") -public class GetUpdateServiceResponse { - public static final String SERIALIZED_NAME_ENABLED = "enabled"; - - @SerializedName(SERIALIZED_NAME_ENABLED) - @javax.annotation.Nullable private Boolean enabled; - - public GetUpdateServiceResponse() {} - - public GetUpdateServiceResponse enabled(@javax.annotation.Nullable Boolean enabled) { - this.enabled = enabled; - return this; - } - - /** - * Get enabled - * - * @return enabled - */ - @javax.annotation.Nullable public Boolean getEnabled() { - return enabled; - } - - public void setEnabled(@javax.annotation.Nullable Boolean enabled) { - this.enabled = enabled; - } - - /** - * A container for additional, undeclared properties. This is a holder for any undeclared - * properties as specified with the 'additionalProperties' keyword in the OAS document. - */ - private Map additionalProperties; - - /** - * Set the additional (undeclared) property with the specified name and value. If the property - * does not already exist, create it otherwise replace it. - * - * @param key name of the property - * @param value value of the property - * @return the GetUpdateServiceResponse instance itself - */ - public GetUpdateServiceResponse putAdditionalProperty(String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap(); - } - this.additionalProperties.put(key, value); - return this; - } - - /** - * Return the additional (undeclared) property. - * - * @return a map of objects - */ - public Map getAdditionalProperties() { - return additionalProperties; - } - - /** - * Return the additional (undeclared) property with the specified name. - * - * @param key name of the property - * @return an object - */ - public Object getAdditionalProperty(String key) { - if (this.additionalProperties == null) { - return null; - } - return this.additionalProperties.get(key); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - GetUpdateServiceResponse getUpdateServiceResponse = (GetUpdateServiceResponse) o; - return Objects.equals(this.enabled, getUpdateServiceResponse.enabled) - && Objects.equals( - this.additionalProperties, getUpdateServiceResponse.additionalProperties); - } - - @Override - public int hashCode() { - return Objects.hash(enabled, additionalProperties); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetUpdateServiceResponse {\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - sb.append(" additionalProperties: ") - .append(toIndentedString(additionalProperties)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("enabled")); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(0); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to GetUpdateServiceResponse - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!GetUpdateServiceResponse.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - java.util.Locale.ROOT, - "The required field(s) %s in GetUpdateServiceResponse is not found in the empty JSON string", - GetUpdateServiceResponse.openapiRequiredFields.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetUpdateServiceResponse.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetUpdateServiceResponse' and its - // subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(GetUpdateServiceResponse.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, GetUpdateServiceResponse value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - obj.remove("additionalProperties"); - // serialize additional properties - if (value.getAdditionalProperties() != null) { - for (Map.Entry entry : - value.getAdditionalProperties().entrySet()) { - if (entry.getValue() instanceof String) - obj.addProperty(entry.getKey(), (String) entry.getValue()); - else if (entry.getValue() instanceof Number) - obj.addProperty(entry.getKey(), (Number) entry.getValue()); - else if (entry.getValue() instanceof Boolean) - obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); - else if (entry.getValue() instanceof Character) - obj.addProperty( - entry.getKey(), (Character) entry.getValue()); - else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } - } - } - } - elementAdapter.write(out, obj); - } - - @Override - public GetUpdateServiceResponse read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - GetUpdateServiceResponse instance = thisAdapter.fromJsonTree(jsonObj); - for (Map.Entry entry : jsonObj.entrySet()) { - if (!openapiFields.contains(entry.getKey())) { - if (entry.getValue().isJsonPrimitive()) { // primitive type - if (entry.getValue().getAsJsonPrimitive().isString()) - instance.putAdditionalProperty( - entry.getKey(), entry.getValue().getAsString()); - else if (entry.getValue().getAsJsonPrimitive().isNumber()) - instance.putAdditionalProperty( - entry.getKey(), entry.getValue().getAsNumber()); - else if (entry.getValue().getAsJsonPrimitive().isBoolean()) - instance.putAdditionalProperty( - entry.getKey(), - entry.getValue().getAsBoolean()); - else - throw new IllegalArgumentException( - String.format( - java.util.Locale.ROOT, - "The field `%s` has unknown primitive type. Value: %s", - entry.getKey(), - entry.getValue().toString())); - } else if (entry.getValue().isJsonArray()) { - instance.putAdditionalProperty( - entry.getKey(), - gson.fromJson(entry.getValue(), List.class)); - } else { // JSON object - instance.putAdditionalProperty( - entry.getKey(), - gson.fromJson(entry.getValue(), HashMap.class)); - } - } - } - return instance; - } - }.nullSafe(); - } - } - - /** - * Create an instance of GetUpdateServiceResponse given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetUpdateServiceResponse - * @throws IOException if the JSON string is invalid with respect to GetUpdateServiceResponse - */ - public static GetUpdateServiceResponse fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetUpdateServiceResponse.class); - } - - /** - * Convert an instance of GetUpdateServiceResponse to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/GetUpdatesListResponse.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/GetUpdatesListResponse.java deleted file mode 100644 index b0dc33eb..00000000 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/GetUpdatesListResponse.java +++ /dev/null @@ -1,316 +0,0 @@ -/* - * STACKIT Server Update Management API - * API endpoints for Server Update Operations on STACKIT Servers. - * - * The version of the OpenAPI document: 1.0 - * Contact: support@stackit.de - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package cloud.stackit.sdk.serverupdate.v1api.model; - -import cloud.stackit.sdk.serverupdate.v1api.JSON; -import com.google.gson.Gson; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; -import com.google.gson.reflect.TypeToken; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** GetUpdatesListResponse */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - comments = "Generator version: 7.19.0") -public class GetUpdatesListResponse { - public static final String SERIALIZED_NAME_ITEMS = "items"; - - @SerializedName(SERIALIZED_NAME_ITEMS) - @javax.annotation.Nullable private List items = new ArrayList<>(); - - public GetUpdatesListResponse() {} - - public GetUpdatesListResponse items(@javax.annotation.Nullable List items) { - this.items = items; - return this; - } - - public GetUpdatesListResponse addItemsItem(Update itemsItem) { - if (this.items == null) { - this.items = new ArrayList<>(); - } - this.items.add(itemsItem); - return this; - } - - /** - * Get items - * - * @return items - */ - @javax.annotation.Nullable public List getItems() { - return items; - } - - public void setItems(@javax.annotation.Nullable List items) { - this.items = items; - } - - /** - * A container for additional, undeclared properties. This is a holder for any undeclared - * properties as specified with the 'additionalProperties' keyword in the OAS document. - */ - private Map additionalProperties; - - /** - * Set the additional (undeclared) property with the specified name and value. If the property - * does not already exist, create it otherwise replace it. - * - * @param key name of the property - * @param value value of the property - * @return the GetUpdatesListResponse instance itself - */ - public GetUpdatesListResponse putAdditionalProperty(String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap(); - } - this.additionalProperties.put(key, value); - return this; - } - - /** - * Return the additional (undeclared) property. - * - * @return a map of objects - */ - public Map getAdditionalProperties() { - return additionalProperties; - } - - /** - * Return the additional (undeclared) property with the specified name. - * - * @param key name of the property - * @return an object - */ - public Object getAdditionalProperty(String key) { - if (this.additionalProperties == null) { - return null; - } - return this.additionalProperties.get(key); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - GetUpdatesListResponse getUpdatesListResponse = (GetUpdatesListResponse) o; - return Objects.equals(this.items, getUpdatesListResponse.items) - && Objects.equals( - this.additionalProperties, getUpdatesListResponse.additionalProperties); - } - - @Override - public int hashCode() { - return Objects.hash(items, additionalProperties); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GetUpdatesListResponse {\n"); - sb.append(" items: ").append(toIndentedString(items)).append("\n"); - sb.append(" additionalProperties: ") - .append(toIndentedString(additionalProperties)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("items")); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(0); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to GetUpdatesListResponse - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!GetUpdatesListResponse.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - java.util.Locale.ROOT, - "The required field(s) %s in GetUpdatesListResponse is not found in the empty JSON string", - GetUpdatesListResponse.openapiRequiredFields.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (jsonObj.get("items") != null && !jsonObj.get("items").isJsonNull()) { - JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); - if (jsonArrayitems != null) { - // ensure the json data is an array - if (!jsonObj.get("items").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - java.util.Locale.ROOT, - "Expected the field `items` to be an array in the JSON string but got `%s`", - jsonObj.get("items").toString())); - } - - // validate the optional field `items` (array) - for (int i = 0; i < jsonArrayitems.size(); i++) { - Update.validateJsonElement(jsonArrayitems.get(i)); - } - ; - } - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GetUpdatesListResponse.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GetUpdatesListResponse' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(GetUpdatesListResponse.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, GetUpdatesListResponse value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - obj.remove("additionalProperties"); - // serialize additional properties - if (value.getAdditionalProperties() != null) { - for (Map.Entry entry : - value.getAdditionalProperties().entrySet()) { - if (entry.getValue() instanceof String) - obj.addProperty(entry.getKey(), (String) entry.getValue()); - else if (entry.getValue() instanceof Number) - obj.addProperty(entry.getKey(), (Number) entry.getValue()); - else if (entry.getValue() instanceof Boolean) - obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); - else if (entry.getValue() instanceof Character) - obj.addProperty( - entry.getKey(), (Character) entry.getValue()); - else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } - } - } - } - elementAdapter.write(out, obj); - } - - @Override - public GetUpdatesListResponse read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - GetUpdatesListResponse instance = thisAdapter.fromJsonTree(jsonObj); - for (Map.Entry entry : jsonObj.entrySet()) { - if (!openapiFields.contains(entry.getKey())) { - if (entry.getValue().isJsonPrimitive()) { // primitive type - if (entry.getValue().getAsJsonPrimitive().isString()) - instance.putAdditionalProperty( - entry.getKey(), entry.getValue().getAsString()); - else if (entry.getValue().getAsJsonPrimitive().isNumber()) - instance.putAdditionalProperty( - entry.getKey(), entry.getValue().getAsNumber()); - else if (entry.getValue().getAsJsonPrimitive().isBoolean()) - instance.putAdditionalProperty( - entry.getKey(), - entry.getValue().getAsBoolean()); - else - throw new IllegalArgumentException( - String.format( - java.util.Locale.ROOT, - "The field `%s` has unknown primitive type. Value: %s", - entry.getKey(), - entry.getValue().toString())); - } else if (entry.getValue().isJsonArray()) { - instance.putAdditionalProperty( - entry.getKey(), - gson.fromJson(entry.getValue(), List.class)); - } else { // JSON object - instance.putAdditionalProperty( - entry.getKey(), - gson.fromJson(entry.getValue(), HashMap.class)); - } - } - } - return instance; - } - }.nullSafe(); - } - } - - /** - * Create an instance of GetUpdatesListResponse given an JSON string - * - * @param jsonString JSON string - * @return An instance of GetUpdatesListResponse - * @throws IOException if the JSON string is invalid with respect to GetUpdatesListResponse - */ - public static GetUpdatesListResponse fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GetUpdatesListResponse.class); - } - - /** - * Convert an instance of GetUpdatesListResponse to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/Update.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/Update.java deleted file mode 100644 index 54298533..00000000 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/Update.java +++ /dev/null @@ -1,500 +0,0 @@ -/* - * STACKIT Server Update Management API - * API endpoints for Server Update Operations on STACKIT Servers. - * - * The version of the OpenAPI document: 1.0 - * Contact: support@stackit.de - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package cloud.stackit.sdk.serverupdate.v1api.model; - -import cloud.stackit.sdk.serverupdate.v1api.JSON; -import com.google.gson.Gson; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; -import com.google.gson.reflect.TypeToken; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** Update */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - comments = "Generator version: 7.19.0") -public class Update { - public static final String SERIALIZED_NAME_END_DATE = "endDate"; - - @SerializedName(SERIALIZED_NAME_END_DATE) - @javax.annotation.Nullable private String endDate; - - public static final String SERIALIZED_NAME_FAIL_REASON = "failReason"; - - @SerializedName(SERIALIZED_NAME_FAIL_REASON) - @javax.annotation.Nullable private String failReason; - - public static final String SERIALIZED_NAME_FAILED_UPDATES = "failedUpdates"; - - @SerializedName(SERIALIZED_NAME_FAILED_UPDATES) - @javax.annotation.Nullable private Integer failedUpdates; - - public static final String SERIALIZED_NAME_ID = "id"; - - @SerializedName(SERIALIZED_NAME_ID) - @javax.annotation.Nonnull - private Integer id; - - public static final String SERIALIZED_NAME_INSTALLED_UPDATES = "installedUpdates"; - - @SerializedName(SERIALIZED_NAME_INSTALLED_UPDATES) - @javax.annotation.Nullable private Integer installedUpdates; - - public static final String SERIALIZED_NAME_START_DATE = "startDate"; - - @SerializedName(SERIALIZED_NAME_START_DATE) - @javax.annotation.Nonnull - private String startDate; - - public static final String SERIALIZED_NAME_STATUS = "status"; - - @SerializedName(SERIALIZED_NAME_STATUS) - @javax.annotation.Nonnull - private String status; - - public Update() {} - - public Update endDate(@javax.annotation.Nullable String endDate) { - this.endDate = endDate; - return this; - } - - /** - * Get endDate - * - * @return endDate - */ - @javax.annotation.Nullable public String getEndDate() { - return endDate; - } - - public void setEndDate(@javax.annotation.Nullable String endDate) { - this.endDate = endDate; - } - - public Update failReason(@javax.annotation.Nullable String failReason) { - this.failReason = failReason; - return this; - } - - /** - * Get failReason - * - * @return failReason - */ - @javax.annotation.Nullable public String getFailReason() { - return failReason; - } - - public void setFailReason(@javax.annotation.Nullable String failReason) { - this.failReason = failReason; - } - - public Update failedUpdates(@javax.annotation.Nullable Integer failedUpdates) { - this.failedUpdates = failedUpdates; - return this; - } - - /** - * Get failedUpdates - * - * @return failedUpdates - */ - @javax.annotation.Nullable public Integer getFailedUpdates() { - return failedUpdates; - } - - public void setFailedUpdates(@javax.annotation.Nullable Integer failedUpdates) { - this.failedUpdates = failedUpdates; - } - - public Update id(@javax.annotation.Nonnull Integer id) { - this.id = id; - return this; - } - - /** - * Get id - * - * @return id - */ - @javax.annotation.Nonnull - public Integer getId() { - return id; - } - - public void setId(@javax.annotation.Nonnull Integer id) { - this.id = id; - } - - public Update installedUpdates(@javax.annotation.Nullable Integer installedUpdates) { - this.installedUpdates = installedUpdates; - return this; - } - - /** - * Get installedUpdates - * - * @return installedUpdates - */ - @javax.annotation.Nullable public Integer getInstalledUpdates() { - return installedUpdates; - } - - public void setInstalledUpdates(@javax.annotation.Nullable Integer installedUpdates) { - this.installedUpdates = installedUpdates; - } - - public Update startDate(@javax.annotation.Nonnull String startDate) { - this.startDate = startDate; - return this; - } - - /** - * Get startDate - * - * @return startDate - */ - @javax.annotation.Nonnull - public String getStartDate() { - return startDate; - } - - public void setStartDate(@javax.annotation.Nonnull String startDate) { - this.startDate = startDate; - } - - public Update status(@javax.annotation.Nonnull String status) { - this.status = status; - return this; - } - - /** - * Get status - * - * @return status - */ - @javax.annotation.Nonnull - public String getStatus() { - return status; - } - - public void setStatus(@javax.annotation.Nonnull String status) { - this.status = status; - } - - /** - * A container for additional, undeclared properties. This is a holder for any undeclared - * properties as specified with the 'additionalProperties' keyword in the OAS document. - */ - private Map additionalProperties; - - /** - * Set the additional (undeclared) property with the specified name and value. If the property - * does not already exist, create it otherwise replace it. - * - * @param key name of the property - * @param value value of the property - * @return the Update instance itself - */ - public Update putAdditionalProperty(String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap(); - } - this.additionalProperties.put(key, value); - return this; - } - - /** - * Return the additional (undeclared) property. - * - * @return a map of objects - */ - public Map getAdditionalProperties() { - return additionalProperties; - } - - /** - * Return the additional (undeclared) property with the specified name. - * - * @param key name of the property - * @return an object - */ - public Object getAdditionalProperty(String key) { - if (this.additionalProperties == null) { - return null; - } - return this.additionalProperties.get(key); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Update update = (Update) o; - return Objects.equals(this.endDate, update.endDate) - && Objects.equals(this.failReason, update.failReason) - && Objects.equals(this.failedUpdates, update.failedUpdates) - && Objects.equals(this.id, update.id) - && Objects.equals(this.installedUpdates, update.installedUpdates) - && Objects.equals(this.startDate, update.startDate) - && Objects.equals(this.status, update.status) - && Objects.equals(this.additionalProperties, update.additionalProperties); - } - - @Override - public int hashCode() { - return Objects.hash( - endDate, - failReason, - failedUpdates, - id, - installedUpdates, - startDate, - status, - additionalProperties); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Update {\n"); - sb.append(" endDate: ").append(toIndentedString(endDate)).append("\n"); - sb.append(" failReason: ").append(toIndentedString(failReason)).append("\n"); - sb.append(" failedUpdates: ").append(toIndentedString(failedUpdates)).append("\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" installedUpdates: ").append(toIndentedString(installedUpdates)).append("\n"); - sb.append(" startDate: ").append(toIndentedString(startDate)).append("\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append(" additionalProperties: ") - .append(toIndentedString(additionalProperties)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = - new HashSet( - Arrays.asList( - "endDate", - "failReason", - "failedUpdates", - "id", - "installedUpdates", - "startDate", - "status")); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(Arrays.asList("id", "startDate", "status")); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to Update - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!Update.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - java.util.Locale.ROOT, - "The required field(s) %s in Update is not found in the empty JSON string", - Update.openapiRequiredFields.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : Update.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException( - String.format( - java.util.Locale.ROOT, - "The required field `%s` is not found in the JSON string: %s", - requiredField, - jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("endDate") != null && !jsonObj.get("endDate").isJsonNull()) - && !jsonObj.get("endDate").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - java.util.Locale.ROOT, - "Expected the field `endDate` to be a primitive type in the JSON string but got `%s`", - jsonObj.get("endDate").toString())); - } - if ((jsonObj.get("failReason") != null && !jsonObj.get("failReason").isJsonNull()) - && !jsonObj.get("failReason").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - java.util.Locale.ROOT, - "Expected the field `failReason` to be a primitive type in the JSON string but got `%s`", - jsonObj.get("failReason").toString())); - } - if (!jsonObj.get("startDate").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - java.util.Locale.ROOT, - "Expected the field `startDate` to be a primitive type in the JSON string but got `%s`", - jsonObj.get("startDate").toString())); - } - if (!jsonObj.get("status").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - java.util.Locale.ROOT, - "Expected the field `status` to be a primitive type in the JSON string but got `%s`", - jsonObj.get("status").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!Update.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Update' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(Update.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, Update value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - obj.remove("additionalProperties"); - // serialize additional properties - if (value.getAdditionalProperties() != null) { - for (Map.Entry entry : - value.getAdditionalProperties().entrySet()) { - if (entry.getValue() instanceof String) - obj.addProperty(entry.getKey(), (String) entry.getValue()); - else if (entry.getValue() instanceof Number) - obj.addProperty(entry.getKey(), (Number) entry.getValue()); - else if (entry.getValue() instanceof Boolean) - obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); - else if (entry.getValue() instanceof Character) - obj.addProperty( - entry.getKey(), (Character) entry.getValue()); - else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } - } - } - } - elementAdapter.write(out, obj); - } - - @Override - public Update read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - Update instance = thisAdapter.fromJsonTree(jsonObj); - for (Map.Entry entry : jsonObj.entrySet()) { - if (!openapiFields.contains(entry.getKey())) { - if (entry.getValue().isJsonPrimitive()) { // primitive type - if (entry.getValue().getAsJsonPrimitive().isString()) - instance.putAdditionalProperty( - entry.getKey(), entry.getValue().getAsString()); - else if (entry.getValue().getAsJsonPrimitive().isNumber()) - instance.putAdditionalProperty( - entry.getKey(), entry.getValue().getAsNumber()); - else if (entry.getValue().getAsJsonPrimitive().isBoolean()) - instance.putAdditionalProperty( - entry.getKey(), - entry.getValue().getAsBoolean()); - else - throw new IllegalArgumentException( - String.format( - java.util.Locale.ROOT, - "The field `%s` has unknown primitive type. Value: %s", - entry.getKey(), - entry.getValue().toString())); - } else if (entry.getValue().isJsonArray()) { - instance.putAdditionalProperty( - entry.getKey(), - gson.fromJson(entry.getValue(), List.class)); - } else { // JSON object - instance.putAdditionalProperty( - entry.getKey(), - gson.fromJson(entry.getValue(), HashMap.class)); - } - } - } - return instance; - } - }.nullSafe(); - } - } - - /** - * Create an instance of Update given an JSON string - * - * @param jsonString JSON string - * @return An instance of Update - * @throws IOException if the JSON string is invalid with respect to Update - */ - public static Update fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, Update.class); - } - - /** - * Convert an instance of Update to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/UpdatePolicy.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/UpdatePolicy.java deleted file mode 100644 index 04ab8522..00000000 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/UpdatePolicy.java +++ /dev/null @@ -1,486 +0,0 @@ -/* - * STACKIT Server Update Management API - * API endpoints for Server Update Operations on STACKIT Servers. - * - * The version of the OpenAPI document: 1.0 - * Contact: support@stackit.de - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package cloud.stackit.sdk.serverupdate.v1api.model; - -import cloud.stackit.sdk.serverupdate.v1api.JSON; -import com.google.gson.Gson; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; -import com.google.gson.reflect.TypeToken; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** UpdatePolicy */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - comments = "Generator version: 7.19.0") -public class UpdatePolicy { - public static final String SERIALIZED_NAME_DEFAULT = "default"; - - @SerializedName(SERIALIZED_NAME_DEFAULT) - @javax.annotation.Nullable private Boolean _default; - - public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - - @SerializedName(SERIALIZED_NAME_DESCRIPTION) - @javax.annotation.Nullable private String description; - - public static final String SERIALIZED_NAME_ENABLED = "enabled"; - - @SerializedName(SERIALIZED_NAME_ENABLED) - @javax.annotation.Nullable private Boolean enabled; - - public static final String SERIALIZED_NAME_ID = "id"; - - @SerializedName(SERIALIZED_NAME_ID) - @javax.annotation.Nullable private String id; - - public static final String SERIALIZED_NAME_MAINTENANCE_WINDOW = "maintenanceWindow"; - - @SerializedName(SERIALIZED_NAME_MAINTENANCE_WINDOW) - @javax.annotation.Nullable private Integer maintenanceWindow; - - public static final String SERIALIZED_NAME_NAME = "name"; - - @SerializedName(SERIALIZED_NAME_NAME) - @javax.annotation.Nullable private String name; - - public static final String SERIALIZED_NAME_RRULE = "rrule"; - - @SerializedName(SERIALIZED_NAME_RRULE) - @javax.annotation.Nullable private String rrule; - - public UpdatePolicy() {} - - public UpdatePolicy _default(@javax.annotation.Nullable Boolean _default) { - this._default = _default; - return this; - } - - /** - * Get _default - * - * @return _default - */ - @javax.annotation.Nullable public Boolean getDefault() { - return _default; - } - - public void setDefault(@javax.annotation.Nullable Boolean _default) { - this._default = _default; - } - - public UpdatePolicy description(@javax.annotation.Nullable String description) { - this.description = description; - return this; - } - - /** - * Get description - * - * @return description - */ - @javax.annotation.Nullable public String getDescription() { - return description; - } - - public void setDescription(@javax.annotation.Nullable String description) { - this.description = description; - } - - public UpdatePolicy enabled(@javax.annotation.Nullable Boolean enabled) { - this.enabled = enabled; - return this; - } - - /** - * Get enabled - * - * @return enabled - */ - @javax.annotation.Nullable public Boolean getEnabled() { - return enabled; - } - - public void setEnabled(@javax.annotation.Nullable Boolean enabled) { - this.enabled = enabled; - } - - public UpdatePolicy id(@javax.annotation.Nullable String id) { - this.id = id; - return this; - } - - /** - * Get id - * - * @return id - */ - @javax.annotation.Nullable public String getId() { - return id; - } - - public void setId(@javax.annotation.Nullable String id) { - this.id = id; - } - - public UpdatePolicy maintenanceWindow(@javax.annotation.Nullable Integer maintenanceWindow) { - this.maintenanceWindow = maintenanceWindow; - return this; - } - - /** - * Get maintenanceWindow - * - * @return maintenanceWindow - */ - @javax.annotation.Nullable public Integer getMaintenanceWindow() { - return maintenanceWindow; - } - - public void setMaintenanceWindow(@javax.annotation.Nullable Integer maintenanceWindow) { - this.maintenanceWindow = maintenanceWindow; - } - - public UpdatePolicy name(@javax.annotation.Nullable String name) { - this.name = name; - return this; - } - - /** - * Get name - * - * @return name - */ - @javax.annotation.Nullable public String getName() { - return name; - } - - public void setName(@javax.annotation.Nullable String name) { - this.name = name; - } - - public UpdatePolicy rrule(@javax.annotation.Nullable String rrule) { - this.rrule = rrule; - return this; - } - - /** - * Get rrule - * - * @return rrule - */ - @javax.annotation.Nullable public String getRrule() { - return rrule; - } - - public void setRrule(@javax.annotation.Nullable String rrule) { - this.rrule = rrule; - } - - /** - * A container for additional, undeclared properties. This is a holder for any undeclared - * properties as specified with the 'additionalProperties' keyword in the OAS document. - */ - private Map additionalProperties; - - /** - * Set the additional (undeclared) property with the specified name and value. If the property - * does not already exist, create it otherwise replace it. - * - * @param key name of the property - * @param value value of the property - * @return the UpdatePolicy instance itself - */ - public UpdatePolicy putAdditionalProperty(String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap(); - } - this.additionalProperties.put(key, value); - return this; - } - - /** - * Return the additional (undeclared) property. - * - * @return a map of objects - */ - public Map getAdditionalProperties() { - return additionalProperties; - } - - /** - * Return the additional (undeclared) property with the specified name. - * - * @param key name of the property - * @return an object - */ - public Object getAdditionalProperty(String key) { - if (this.additionalProperties == null) { - return null; - } - return this.additionalProperties.get(key); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - UpdatePolicy updatePolicy = (UpdatePolicy) o; - return Objects.equals(this._default, updatePolicy._default) - && Objects.equals(this.description, updatePolicy.description) - && Objects.equals(this.enabled, updatePolicy.enabled) - && Objects.equals(this.id, updatePolicy.id) - && Objects.equals(this.maintenanceWindow, updatePolicy.maintenanceWindow) - && Objects.equals(this.name, updatePolicy.name) - && Objects.equals(this.rrule, updatePolicy.rrule) - && Objects.equals(this.additionalProperties, updatePolicy.additionalProperties); - } - - @Override - public int hashCode() { - return Objects.hash( - _default, - description, - enabled, - id, - maintenanceWindow, - name, - rrule, - additionalProperties); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdatePolicy {\n"); - sb.append(" _default: ").append(toIndentedString(_default)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" maintenanceWindow: ") - .append(toIndentedString(maintenanceWindow)) - .append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" rrule: ").append(toIndentedString(rrule)).append("\n"); - sb.append(" additionalProperties: ") - .append(toIndentedString(additionalProperties)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = - new HashSet( - Arrays.asList( - "default", - "description", - "enabled", - "id", - "maintenanceWindow", - "name", - "rrule")); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(0); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to UpdatePolicy - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!UpdatePolicy.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - java.util.Locale.ROOT, - "The required field(s) %s in UpdatePolicy is not found in the empty JSON string", - UpdatePolicy.openapiRequiredFields.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) - && !jsonObj.get("description").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - java.util.Locale.ROOT, - "Expected the field `description` to be a primitive type in the JSON string but got `%s`", - jsonObj.get("description").toString())); - } - if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) - && !jsonObj.get("id").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - java.util.Locale.ROOT, - "Expected the field `id` to be a primitive type in the JSON string but got `%s`", - jsonObj.get("id").toString())); - } - if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) - && !jsonObj.get("name").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - java.util.Locale.ROOT, - "Expected the field `name` to be a primitive type in the JSON string but got `%s`", - jsonObj.get("name").toString())); - } - if ((jsonObj.get("rrule") != null && !jsonObj.get("rrule").isJsonNull()) - && !jsonObj.get("rrule").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - java.util.Locale.ROOT, - "Expected the field `rrule` to be a primitive type in the JSON string but got `%s`", - jsonObj.get("rrule").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UpdatePolicy.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdatePolicy' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(UpdatePolicy.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdatePolicy value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - obj.remove("additionalProperties"); - // serialize additional properties - if (value.getAdditionalProperties() != null) { - for (Map.Entry entry : - value.getAdditionalProperties().entrySet()) { - if (entry.getValue() instanceof String) - obj.addProperty(entry.getKey(), (String) entry.getValue()); - else if (entry.getValue() instanceof Number) - obj.addProperty(entry.getKey(), (Number) entry.getValue()); - else if (entry.getValue() instanceof Boolean) - obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); - else if (entry.getValue() instanceof Character) - obj.addProperty( - entry.getKey(), (Character) entry.getValue()); - else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } - } - } - } - elementAdapter.write(out, obj); - } - - @Override - public UpdatePolicy read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - UpdatePolicy instance = thisAdapter.fromJsonTree(jsonObj); - for (Map.Entry entry : jsonObj.entrySet()) { - if (!openapiFields.contains(entry.getKey())) { - if (entry.getValue().isJsonPrimitive()) { // primitive type - if (entry.getValue().getAsJsonPrimitive().isString()) - instance.putAdditionalProperty( - entry.getKey(), entry.getValue().getAsString()); - else if (entry.getValue().getAsJsonPrimitive().isNumber()) - instance.putAdditionalProperty( - entry.getKey(), entry.getValue().getAsNumber()); - else if (entry.getValue().getAsJsonPrimitive().isBoolean()) - instance.putAdditionalProperty( - entry.getKey(), - entry.getValue().getAsBoolean()); - else - throw new IllegalArgumentException( - String.format( - java.util.Locale.ROOT, - "The field `%s` has unknown primitive type. Value: %s", - entry.getKey(), - entry.getValue().toString())); - } else if (entry.getValue().isJsonArray()) { - instance.putAdditionalProperty( - entry.getKey(), - gson.fromJson(entry.getValue(), List.class)); - } else { // JSON object - instance.putAdditionalProperty( - entry.getKey(), - gson.fromJson(entry.getValue(), HashMap.class)); - } - } - } - return instance; - } - }.nullSafe(); - } - } - - /** - * Create an instance of UpdatePolicy given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdatePolicy - * @throws IOException if the JSON string is invalid with respect to UpdatePolicy - */ - public static UpdatePolicy fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdatePolicy.class); - } - - /** - * Convert an instance of UpdatePolicy to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/UpdateSchedule.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/UpdateSchedule.java deleted file mode 100644 index fb213c75..00000000 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/UpdateSchedule.java +++ /dev/null @@ -1,427 +0,0 @@ -/* - * STACKIT Server Update Management API - * API endpoints for Server Update Operations on STACKIT Servers. - * - * The version of the OpenAPI document: 1.0 - * Contact: support@stackit.de - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package cloud.stackit.sdk.serverupdate.v1api.model; - -import cloud.stackit.sdk.serverupdate.v1api.JSON; -import com.google.gson.Gson; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; -import com.google.gson.reflect.TypeToken; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** UpdateSchedule */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - comments = "Generator version: 7.19.0") -public class UpdateSchedule { - public static final String SERIALIZED_NAME_ENABLED = "enabled"; - - @SerializedName(SERIALIZED_NAME_ENABLED) - @javax.annotation.Nonnull - private Boolean enabled; - - public static final String SERIALIZED_NAME_MAINTENANCE_WINDOW = "maintenanceWindow"; - - @SerializedName(SERIALIZED_NAME_MAINTENANCE_WINDOW) - @javax.annotation.Nonnull - private Integer maintenanceWindow; - - public static final String SERIALIZED_NAME_NAME = "name"; - - @SerializedName(SERIALIZED_NAME_NAME) - @javax.annotation.Nonnull - private String name; - - public static final String SERIALIZED_NAME_RRULE = "rrule"; - - @SerializedName(SERIALIZED_NAME_RRULE) - @javax.annotation.Nonnull - private String rrule; - - public static final String SERIALIZED_NAME_ID = "id"; - - @SerializedName(SERIALIZED_NAME_ID) - @javax.annotation.Nonnull - private Integer id; - - public UpdateSchedule() {} - - public UpdateSchedule enabled(@javax.annotation.Nonnull Boolean enabled) { - this.enabled = enabled; - return this; - } - - /** - * Get enabled - * - * @return enabled - */ - @javax.annotation.Nonnull - public Boolean getEnabled() { - return enabled; - } - - public void setEnabled(@javax.annotation.Nonnull Boolean enabled) { - this.enabled = enabled; - } - - public UpdateSchedule maintenanceWindow(@javax.annotation.Nonnull Integer maintenanceWindow) { - this.maintenanceWindow = maintenanceWindow; - return this; - } - - /** - * Get maintenanceWindow minimum: 1 maximum: 24 - * - * @return maintenanceWindow - */ - @javax.annotation.Nonnull - public Integer getMaintenanceWindow() { - return maintenanceWindow; - } - - public void setMaintenanceWindow(@javax.annotation.Nonnull Integer maintenanceWindow) { - this.maintenanceWindow = maintenanceWindow; - } - - public UpdateSchedule name(@javax.annotation.Nonnull String name) { - this.name = name; - return this; - } - - /** - * Get name - * - * @return name - */ - @javax.annotation.Nonnull - public String getName() { - return name; - } - - public void setName(@javax.annotation.Nonnull String name) { - this.name = name; - } - - public UpdateSchedule rrule(@javax.annotation.Nonnull String rrule) { - this.rrule = rrule; - return this; - } - - /** - * Get rrule - * - * @return rrule - */ - @javax.annotation.Nonnull - public String getRrule() { - return rrule; - } - - public void setRrule(@javax.annotation.Nonnull String rrule) { - this.rrule = rrule; - } - - public UpdateSchedule id(@javax.annotation.Nonnull Integer id) { - this.id = id; - return this; - } - - /** - * Get id - * - * @return id - */ - @javax.annotation.Nonnull - public Integer getId() { - return id; - } - - public void setId(@javax.annotation.Nonnull Integer id) { - this.id = id; - } - - /** - * A container for additional, undeclared properties. This is a holder for any undeclared - * properties as specified with the 'additionalProperties' keyword in the OAS document. - */ - private Map additionalProperties; - - /** - * Set the additional (undeclared) property with the specified name and value. If the property - * does not already exist, create it otherwise replace it. - * - * @param key name of the property - * @param value value of the property - * @return the UpdateSchedule instance itself - */ - public UpdateSchedule putAdditionalProperty(String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap(); - } - this.additionalProperties.put(key, value); - return this; - } - - /** - * Return the additional (undeclared) property. - * - * @return a map of objects - */ - public Map getAdditionalProperties() { - return additionalProperties; - } - - /** - * Return the additional (undeclared) property with the specified name. - * - * @param key name of the property - * @return an object - */ - public Object getAdditionalProperty(String key) { - if (this.additionalProperties == null) { - return null; - } - return this.additionalProperties.get(key); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - UpdateSchedule updateSchedule = (UpdateSchedule) o; - return Objects.equals(this.enabled, updateSchedule.enabled) - && Objects.equals(this.maintenanceWindow, updateSchedule.maintenanceWindow) - && Objects.equals(this.name, updateSchedule.name) - && Objects.equals(this.rrule, updateSchedule.rrule) - && Objects.equals(this.id, updateSchedule.id) - && Objects.equals(this.additionalProperties, updateSchedule.additionalProperties); - } - - @Override - public int hashCode() { - return Objects.hash(enabled, maintenanceWindow, name, rrule, id, additionalProperties); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateSchedule {\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - sb.append(" maintenanceWindow: ") - .append(toIndentedString(maintenanceWindow)) - .append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" rrule: ").append(toIndentedString(rrule)).append("\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" additionalProperties: ") - .append(toIndentedString(additionalProperties)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = - new HashSet( - Arrays.asList("enabled", "maintenanceWindow", "name", "rrule", "id")); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = - new HashSet( - Arrays.asList("enabled", "maintenanceWindow", "name", "rrule", "id")); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to UpdateSchedule - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!UpdateSchedule.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - java.util.Locale.ROOT, - "The required field(s) %s in UpdateSchedule is not found in the empty JSON string", - UpdateSchedule.openapiRequiredFields.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : UpdateSchedule.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException( - String.format( - java.util.Locale.ROOT, - "The required field `%s` is not found in the JSON string: %s", - requiredField, - jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (!jsonObj.get("name").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - java.util.Locale.ROOT, - "Expected the field `name` to be a primitive type in the JSON string but got `%s`", - jsonObj.get("name").toString())); - } - if (!jsonObj.get("rrule").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - java.util.Locale.ROOT, - "Expected the field `rrule` to be a primitive type in the JSON string but got `%s`", - jsonObj.get("rrule").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UpdateSchedule.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateSchedule' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(UpdateSchedule.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdateSchedule value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - obj.remove("additionalProperties"); - // serialize additional properties - if (value.getAdditionalProperties() != null) { - for (Map.Entry entry : - value.getAdditionalProperties().entrySet()) { - if (entry.getValue() instanceof String) - obj.addProperty(entry.getKey(), (String) entry.getValue()); - else if (entry.getValue() instanceof Number) - obj.addProperty(entry.getKey(), (Number) entry.getValue()); - else if (entry.getValue() instanceof Boolean) - obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); - else if (entry.getValue() instanceof Character) - obj.addProperty( - entry.getKey(), (Character) entry.getValue()); - else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } - } - } - } - elementAdapter.write(out, obj); - } - - @Override - public UpdateSchedule read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - UpdateSchedule instance = thisAdapter.fromJsonTree(jsonObj); - for (Map.Entry entry : jsonObj.entrySet()) { - if (!openapiFields.contains(entry.getKey())) { - if (entry.getValue().isJsonPrimitive()) { // primitive type - if (entry.getValue().getAsJsonPrimitive().isString()) - instance.putAdditionalProperty( - entry.getKey(), entry.getValue().getAsString()); - else if (entry.getValue().getAsJsonPrimitive().isNumber()) - instance.putAdditionalProperty( - entry.getKey(), entry.getValue().getAsNumber()); - else if (entry.getValue().getAsJsonPrimitive().isBoolean()) - instance.putAdditionalProperty( - entry.getKey(), - entry.getValue().getAsBoolean()); - else - throw new IllegalArgumentException( - String.format( - java.util.Locale.ROOT, - "The field `%s` has unknown primitive type. Value: %s", - entry.getKey(), - entry.getValue().toString())); - } else if (entry.getValue().isJsonArray()) { - instance.putAdditionalProperty( - entry.getKey(), - gson.fromJson(entry.getValue(), List.class)); - } else { // JSON object - instance.putAdditionalProperty( - entry.getKey(), - gson.fromJson(entry.getValue(), HashMap.class)); - } - } - } - return instance; - } - }.nullSafe(); - } - } - - /** - * Create an instance of UpdateSchedule given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateSchedule - * @throws IOException if the JSON string is invalid with respect to UpdateSchedule - */ - public static UpdateSchedule fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateSchedule.class); - } - - /** - * Convert an instance of UpdateSchedule to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/UpdateScheduleCreateRequest.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/UpdateScheduleCreateRequest.java deleted file mode 100644 index a4729b7b..00000000 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/UpdateScheduleCreateRequest.java +++ /dev/null @@ -1,406 +0,0 @@ -/* - * STACKIT Server Update Management API - * API endpoints for Server Update Operations on STACKIT Servers. - * - * The version of the OpenAPI document: 1.0 - * Contact: support@stackit.de - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package cloud.stackit.sdk.serverupdate.v1api.model; - -import cloud.stackit.sdk.serverupdate.v1api.JSON; -import com.google.gson.Gson; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; -import com.google.gson.reflect.TypeToken; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** UpdateScheduleCreateRequest */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - comments = "Generator version: 7.19.0") -public class UpdateScheduleCreateRequest { - public static final String SERIALIZED_NAME_ENABLED = "enabled"; - - @SerializedName(SERIALIZED_NAME_ENABLED) - @javax.annotation.Nonnull - private Boolean enabled; - - public static final String SERIALIZED_NAME_MAINTENANCE_WINDOW = "maintenanceWindow"; - - @SerializedName(SERIALIZED_NAME_MAINTENANCE_WINDOW) - @javax.annotation.Nonnull - private Integer maintenanceWindow; - - public static final String SERIALIZED_NAME_NAME = "name"; - - @SerializedName(SERIALIZED_NAME_NAME) - @javax.annotation.Nonnull - private String name; - - public static final String SERIALIZED_NAME_RRULE = "rrule"; - - @SerializedName(SERIALIZED_NAME_RRULE) - @javax.annotation.Nonnull - private String rrule; - - public UpdateScheduleCreateRequest() {} - - public UpdateScheduleCreateRequest enabled(@javax.annotation.Nonnull Boolean enabled) { - this.enabled = enabled; - return this; - } - - /** - * Get enabled - * - * @return enabled - */ - @javax.annotation.Nonnull - public Boolean getEnabled() { - return enabled; - } - - public void setEnabled(@javax.annotation.Nonnull Boolean enabled) { - this.enabled = enabled; - } - - public UpdateScheduleCreateRequest maintenanceWindow( - @javax.annotation.Nonnull Integer maintenanceWindow) { - this.maintenanceWindow = maintenanceWindow; - return this; - } - - /** - * Get maintenanceWindow minimum: 1 maximum: 24 - * - * @return maintenanceWindow - */ - @javax.annotation.Nonnull - public Integer getMaintenanceWindow() { - return maintenanceWindow; - } - - public void setMaintenanceWindow(@javax.annotation.Nonnull Integer maintenanceWindow) { - this.maintenanceWindow = maintenanceWindow; - } - - public UpdateScheduleCreateRequest name(@javax.annotation.Nonnull String name) { - this.name = name; - return this; - } - - /** - * Get name - * - * @return name - */ - @javax.annotation.Nonnull - public String getName() { - return name; - } - - public void setName(@javax.annotation.Nonnull String name) { - this.name = name; - } - - public UpdateScheduleCreateRequest rrule(@javax.annotation.Nonnull String rrule) { - this.rrule = rrule; - return this; - } - - /** - * Get rrule - * - * @return rrule - */ - @javax.annotation.Nonnull - public String getRrule() { - return rrule; - } - - public void setRrule(@javax.annotation.Nonnull String rrule) { - this.rrule = rrule; - } - - /** - * A container for additional, undeclared properties. This is a holder for any undeclared - * properties as specified with the 'additionalProperties' keyword in the OAS document. - */ - private Map additionalProperties; - - /** - * Set the additional (undeclared) property with the specified name and value. If the property - * does not already exist, create it otherwise replace it. - * - * @param key name of the property - * @param value value of the property - * @return the UpdateScheduleCreateRequest instance itself - */ - public UpdateScheduleCreateRequest putAdditionalProperty(String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap(); - } - this.additionalProperties.put(key, value); - return this; - } - - /** - * Return the additional (undeclared) property. - * - * @return a map of objects - */ - public Map getAdditionalProperties() { - return additionalProperties; - } - - /** - * Return the additional (undeclared) property with the specified name. - * - * @param key name of the property - * @return an object - */ - public Object getAdditionalProperty(String key) { - if (this.additionalProperties == null) { - return null; - } - return this.additionalProperties.get(key); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - UpdateScheduleCreateRequest updateScheduleCreateRequest = (UpdateScheduleCreateRequest) o; - return Objects.equals(this.enabled, updateScheduleCreateRequest.enabled) - && Objects.equals( - this.maintenanceWindow, updateScheduleCreateRequest.maintenanceWindow) - && Objects.equals(this.name, updateScheduleCreateRequest.name) - && Objects.equals(this.rrule, updateScheduleCreateRequest.rrule) - && Objects.equals( - this.additionalProperties, - updateScheduleCreateRequest.additionalProperties); - } - - @Override - public int hashCode() { - return Objects.hash(enabled, maintenanceWindow, name, rrule, additionalProperties); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateScheduleCreateRequest {\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - sb.append(" maintenanceWindow: ") - .append(toIndentedString(maintenanceWindow)) - .append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" rrule: ").append(toIndentedString(rrule)).append("\n"); - sb.append(" additionalProperties: ") - .append(toIndentedString(additionalProperties)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = - new HashSet(Arrays.asList("enabled", "maintenanceWindow", "name", "rrule")); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = - new HashSet(Arrays.asList("enabled", "maintenanceWindow", "name", "rrule")); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to - * UpdateScheduleCreateRequest - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!UpdateScheduleCreateRequest.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - java.util.Locale.ROOT, - "The required field(s) %s in UpdateScheduleCreateRequest is not found in the empty JSON string", - UpdateScheduleCreateRequest.openapiRequiredFields.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : UpdateScheduleCreateRequest.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException( - String.format( - java.util.Locale.ROOT, - "The required field `%s` is not found in the JSON string: %s", - requiredField, - jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (!jsonObj.get("name").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - java.util.Locale.ROOT, - "Expected the field `name` to be a primitive type in the JSON string but got `%s`", - jsonObj.get("name").toString())); - } - if (!jsonObj.get("rrule").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - java.util.Locale.ROOT, - "Expected the field `rrule` to be a primitive type in the JSON string but got `%s`", - jsonObj.get("rrule").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UpdateScheduleCreateRequest.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateScheduleCreateRequest' and its - // subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(UpdateScheduleCreateRequest.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdateScheduleCreateRequest value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - obj.remove("additionalProperties"); - // serialize additional properties - if (value.getAdditionalProperties() != null) { - for (Map.Entry entry : - value.getAdditionalProperties().entrySet()) { - if (entry.getValue() instanceof String) - obj.addProperty(entry.getKey(), (String) entry.getValue()); - else if (entry.getValue() instanceof Number) - obj.addProperty(entry.getKey(), (Number) entry.getValue()); - else if (entry.getValue() instanceof Boolean) - obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); - else if (entry.getValue() instanceof Character) - obj.addProperty( - entry.getKey(), (Character) entry.getValue()); - else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } - } - } - } - elementAdapter.write(out, obj); - } - - @Override - public UpdateScheduleCreateRequest read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - UpdateScheduleCreateRequest instance = - thisAdapter.fromJsonTree(jsonObj); - for (Map.Entry entry : jsonObj.entrySet()) { - if (!openapiFields.contains(entry.getKey())) { - if (entry.getValue().isJsonPrimitive()) { // primitive type - if (entry.getValue().getAsJsonPrimitive().isString()) - instance.putAdditionalProperty( - entry.getKey(), entry.getValue().getAsString()); - else if (entry.getValue().getAsJsonPrimitive().isNumber()) - instance.putAdditionalProperty( - entry.getKey(), entry.getValue().getAsNumber()); - else if (entry.getValue().getAsJsonPrimitive().isBoolean()) - instance.putAdditionalProperty( - entry.getKey(), - entry.getValue().getAsBoolean()); - else - throw new IllegalArgumentException( - String.format( - java.util.Locale.ROOT, - "The field `%s` has unknown primitive type. Value: %s", - entry.getKey(), - entry.getValue().toString())); - } else if (entry.getValue().isJsonArray()) { - instance.putAdditionalProperty( - entry.getKey(), - gson.fromJson(entry.getValue(), List.class)); - } else { // JSON object - instance.putAdditionalProperty( - entry.getKey(), - gson.fromJson(entry.getValue(), HashMap.class)); - } - } - } - return instance; - } - }.nullSafe(); - } - } - - /** - * Create an instance of UpdateScheduleCreateRequest given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateScheduleCreateRequest - * @throws IOException if the JSON string is invalid with respect to UpdateScheduleCreateRequest - */ - public static UpdateScheduleCreateRequest fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateScheduleCreateRequest.class); - } - - /** - * Convert an instance of UpdateScheduleCreateRequest to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} diff --git a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/UpdateUpdateSchedulePayload.java b/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/UpdateUpdateSchedulePayload.java deleted file mode 100644 index 18b8787e..00000000 --- a/services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/model/UpdateUpdateSchedulePayload.java +++ /dev/null @@ -1,406 +0,0 @@ -/* - * STACKIT Server Update Management API - * API endpoints for Server Update Operations on STACKIT Servers. - * - * The version of the OpenAPI document: 1.0 - * Contact: support@stackit.de - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package cloud.stackit.sdk.serverupdate.v1api.model; - -import cloud.stackit.sdk.serverupdate.v1api.JSON; -import com.google.gson.Gson; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; -import com.google.gson.reflect.TypeToken; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** UpdateUpdateSchedulePayload */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - comments = "Generator version: 7.19.0") -public class UpdateUpdateSchedulePayload { - public static final String SERIALIZED_NAME_ENABLED = "enabled"; - - @SerializedName(SERIALIZED_NAME_ENABLED) - @javax.annotation.Nonnull - private Boolean enabled; - - public static final String SERIALIZED_NAME_MAINTENANCE_WINDOW = "maintenanceWindow"; - - @SerializedName(SERIALIZED_NAME_MAINTENANCE_WINDOW) - @javax.annotation.Nonnull - private Integer maintenanceWindow; - - public static final String SERIALIZED_NAME_NAME = "name"; - - @SerializedName(SERIALIZED_NAME_NAME) - @javax.annotation.Nonnull - private String name; - - public static final String SERIALIZED_NAME_RRULE = "rrule"; - - @SerializedName(SERIALIZED_NAME_RRULE) - @javax.annotation.Nonnull - private String rrule; - - public UpdateUpdateSchedulePayload() {} - - public UpdateUpdateSchedulePayload enabled(@javax.annotation.Nonnull Boolean enabled) { - this.enabled = enabled; - return this; - } - - /** - * Get enabled - * - * @return enabled - */ - @javax.annotation.Nonnull - public Boolean getEnabled() { - return enabled; - } - - public void setEnabled(@javax.annotation.Nonnull Boolean enabled) { - this.enabled = enabled; - } - - public UpdateUpdateSchedulePayload maintenanceWindow( - @javax.annotation.Nonnull Integer maintenanceWindow) { - this.maintenanceWindow = maintenanceWindow; - return this; - } - - /** - * Get maintenanceWindow minimum: 1 maximum: 24 - * - * @return maintenanceWindow - */ - @javax.annotation.Nonnull - public Integer getMaintenanceWindow() { - return maintenanceWindow; - } - - public void setMaintenanceWindow(@javax.annotation.Nonnull Integer maintenanceWindow) { - this.maintenanceWindow = maintenanceWindow; - } - - public UpdateUpdateSchedulePayload name(@javax.annotation.Nonnull String name) { - this.name = name; - return this; - } - - /** - * Get name - * - * @return name - */ - @javax.annotation.Nonnull - public String getName() { - return name; - } - - public void setName(@javax.annotation.Nonnull String name) { - this.name = name; - } - - public UpdateUpdateSchedulePayload rrule(@javax.annotation.Nonnull String rrule) { - this.rrule = rrule; - return this; - } - - /** - * Get rrule - * - * @return rrule - */ - @javax.annotation.Nonnull - public String getRrule() { - return rrule; - } - - public void setRrule(@javax.annotation.Nonnull String rrule) { - this.rrule = rrule; - } - - /** - * A container for additional, undeclared properties. This is a holder for any undeclared - * properties as specified with the 'additionalProperties' keyword in the OAS document. - */ - private Map additionalProperties; - - /** - * Set the additional (undeclared) property with the specified name and value. If the property - * does not already exist, create it otherwise replace it. - * - * @param key name of the property - * @param value value of the property - * @return the UpdateUpdateSchedulePayload instance itself - */ - public UpdateUpdateSchedulePayload putAdditionalProperty(String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap(); - } - this.additionalProperties.put(key, value); - return this; - } - - /** - * Return the additional (undeclared) property. - * - * @return a map of objects - */ - public Map getAdditionalProperties() { - return additionalProperties; - } - - /** - * Return the additional (undeclared) property with the specified name. - * - * @param key name of the property - * @return an object - */ - public Object getAdditionalProperty(String key) { - if (this.additionalProperties == null) { - return null; - } - return this.additionalProperties.get(key); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - UpdateUpdateSchedulePayload updateUpdateSchedulePayload = (UpdateUpdateSchedulePayload) o; - return Objects.equals(this.enabled, updateUpdateSchedulePayload.enabled) - && Objects.equals( - this.maintenanceWindow, updateUpdateSchedulePayload.maintenanceWindow) - && Objects.equals(this.name, updateUpdateSchedulePayload.name) - && Objects.equals(this.rrule, updateUpdateSchedulePayload.rrule) - && Objects.equals( - this.additionalProperties, - updateUpdateSchedulePayload.additionalProperties); - } - - @Override - public int hashCode() { - return Objects.hash(enabled, maintenanceWindow, name, rrule, additionalProperties); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateUpdateSchedulePayload {\n"); - sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); - sb.append(" maintenanceWindow: ") - .append(toIndentedString(maintenanceWindow)) - .append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" rrule: ").append(toIndentedString(rrule)).append("\n"); - sb.append(" additionalProperties: ") - .append(toIndentedString(additionalProperties)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = - new HashSet(Arrays.asList("enabled", "maintenanceWindow", "name", "rrule")); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = - new HashSet(Arrays.asList("enabled", "maintenanceWindow", "name", "rrule")); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to - * UpdateUpdateSchedulePayload - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!UpdateUpdateSchedulePayload.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - java.util.Locale.ROOT, - "The required field(s) %s in UpdateUpdateSchedulePayload is not found in the empty JSON string", - UpdateUpdateSchedulePayload.openapiRequiredFields.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : UpdateUpdateSchedulePayload.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException( - String.format( - java.util.Locale.ROOT, - "The required field `%s` is not found in the JSON string: %s", - requiredField, - jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (!jsonObj.get("name").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - java.util.Locale.ROOT, - "Expected the field `name` to be a primitive type in the JSON string but got `%s`", - jsonObj.get("name").toString())); - } - if (!jsonObj.get("rrule").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - java.util.Locale.ROOT, - "Expected the field `rrule` to be a primitive type in the JSON string but got `%s`", - jsonObj.get("rrule").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UpdateUpdateSchedulePayload.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateUpdateSchedulePayload' and its - // subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(UpdateUpdateSchedulePayload.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdateUpdateSchedulePayload value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - obj.remove("additionalProperties"); - // serialize additional properties - if (value.getAdditionalProperties() != null) { - for (Map.Entry entry : - value.getAdditionalProperties().entrySet()) { - if (entry.getValue() instanceof String) - obj.addProperty(entry.getKey(), (String) entry.getValue()); - else if (entry.getValue() instanceof Number) - obj.addProperty(entry.getKey(), (Number) entry.getValue()); - else if (entry.getValue() instanceof Boolean) - obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); - else if (entry.getValue() instanceof Character) - obj.addProperty( - entry.getKey(), (Character) entry.getValue()); - else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } - } - } - } - elementAdapter.write(out, obj); - } - - @Override - public UpdateUpdateSchedulePayload read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - UpdateUpdateSchedulePayload instance = - thisAdapter.fromJsonTree(jsonObj); - for (Map.Entry entry : jsonObj.entrySet()) { - if (!openapiFields.contains(entry.getKey())) { - if (entry.getValue().isJsonPrimitive()) { // primitive type - if (entry.getValue().getAsJsonPrimitive().isString()) - instance.putAdditionalProperty( - entry.getKey(), entry.getValue().getAsString()); - else if (entry.getValue().getAsJsonPrimitive().isNumber()) - instance.putAdditionalProperty( - entry.getKey(), entry.getValue().getAsNumber()); - else if (entry.getValue().getAsJsonPrimitive().isBoolean()) - instance.putAdditionalProperty( - entry.getKey(), - entry.getValue().getAsBoolean()); - else - throw new IllegalArgumentException( - String.format( - java.util.Locale.ROOT, - "The field `%s` has unknown primitive type. Value: %s", - entry.getKey(), - entry.getValue().toString())); - } else if (entry.getValue().isJsonArray()) { - instance.putAdditionalProperty( - entry.getKey(), - gson.fromJson(entry.getValue(), List.class)); - } else { // JSON object - instance.putAdditionalProperty( - entry.getKey(), - gson.fromJson(entry.getValue(), HashMap.class)); - } - } - } - return instance; - } - }.nullSafe(); - } - } - - /** - * Create an instance of UpdateUpdateSchedulePayload given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateUpdateSchedulePayload - * @throws IOException if the JSON string is invalid with respect to UpdateUpdateSchedulePayload - */ - public static UpdateUpdateSchedulePayload fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateUpdateSchedulePayload.class); - } - - /** - * Convert an instance of UpdateUpdateSchedulePayload to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} diff --git a/services/serverupdate/src/test/java/cloud/stackit/sdk/serverupdate/v2api/api/DefaultApiTest.java b/services/serverupdate/src/test/java/cloud/stackit/sdk/serverupdate/api/DefaultApiTest.java similarity index 97% rename from services/serverupdate/src/test/java/cloud/stackit/sdk/serverupdate/v2api/api/DefaultApiTest.java rename to services/serverupdate/src/test/java/cloud/stackit/sdk/serverupdate/api/DefaultApiTest.java index 70f04947..be770f94 100644 --- a/services/serverupdate/src/test/java/cloud/stackit/sdk/serverupdate/v2api/api/DefaultApiTest.java +++ b/services/serverupdate/src/test/java/cloud/stackit/sdk/serverupdate/api/DefaultApiTest.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.serverupdate.v2api; +package cloud.stackit.sdk.serverupdate; import cloud.stackit.sdk.core.KeyFlowAuthenticator; import cloud.stackit.sdk.core.auth.SetupAuth; diff --git a/services/serverupdate/src/test/java/cloud/stackit/sdk/serverupdate/v2api/api/ServerUpdateApiTest.java b/services/serverupdate/src/test/java/cloud/stackit/sdk/serverupdate/api/ServerUpdateApiTest.java similarity index 97% rename from services/serverupdate/src/test/java/cloud/stackit/sdk/serverupdate/v2api/api/ServerUpdateApiTest.java rename to services/serverupdate/src/test/java/cloud/stackit/sdk/serverupdate/api/ServerUpdateApiTest.java index fb126100..e9c9b507 100644 --- a/services/serverupdate/src/test/java/cloud/stackit/sdk/serverupdate/v2api/api/ServerUpdateApiTest.java +++ b/services/serverupdate/src/test/java/cloud/stackit/sdk/serverupdate/api/ServerUpdateApiTest.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.serverupdate.v2api.api; +package cloud.stackit.sdk.serverupdate.api; import cloud.stackit.sdk.core.KeyFlowAuthenticator; import cloud.stackit.sdk.core.auth.SetupAuth; diff --git a/services/serverupdate/src/test/java/cloud/stackit/sdk/serverupdate/v1api/api/DefaultApiTest.java b/services/serverupdate/src/test/java/cloud/stackit/sdk/serverupdate/v1api/api/DefaultApiTest.java deleted file mode 100644 index 3b3ec06a..00000000 --- a/services/serverupdate/src/test/java/cloud/stackit/sdk/serverupdate/v1api/api/DefaultApiTest.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * STACKIT Server Update Management API - * API endpoints for Server Update Operations on STACKIT Servers. - * - * The version of the OpenAPI document: 1.0 - * Contact: support@stackit.de - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package cloud.stackit.sdk.serverupdate.v1api; - -import cloud.stackit.sdk.core.KeyFlowAuthenticator; -import cloud.stackit.sdk.core.auth.SetupAuth; -import cloud.stackit.sdk.core.config.CoreConfiguration; -import cloud.stackit.sdk.core.utils.TestUtils; -import java.io.IOException; -import okhttp3.Authenticator; -import okhttp3.OkHttpClient; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -public class DefaultApiTest { - @Test - public void TestCustomHttpClient() throws IOException { - // before - CoreConfiguration conf = - new CoreConfiguration().serviceAccountKey(TestUtils.MOCK_SERVICE_ACCOUNT_KEY); - - // when - OkHttpClient httpClient = new OkHttpClient(); - ApiClient apiClient = new ApiClient(httpClient, conf); - - // then - Assertions.assertEquals(httpClient, apiClient.getHttpClient()); - // make sure the http client object is exactly the same object - Assertions.assertSame(httpClient, apiClient.getHttpClient()); - } - - @Test - public void TestNoCustomHttpClient() throws IOException { - // before - CoreConfiguration conf = - new CoreConfiguration().serviceAccountKey(TestUtils.MOCK_SERVICE_ACCOUNT_KEY); - - // when - ApiClient apiClient = new ApiClient(conf); - - // then - /* - * verify a fresh OkHttpClient got created which will have the auth header set - * by the {@link cloud.stackit.sdk.core.KeyFlowAuthenticator} - */ - OkHttpClient httpClient = new OkHttpClient(); - Authenticator authenticator = - new KeyFlowAuthenticator(httpClient, conf, SetupAuth.setupKeyFlow(conf)); - httpClient = httpClient.newBuilder().authenticator(authenticator).build(); - - Assertions.assertNotNull(apiClient.getHttpClient()); - Assertions.assertEquals( - httpClient.authenticator().getClass(), - apiClient.getHttpClient().authenticator().getClass()); - } -} diff --git a/services/serverupdate/src/test/java/cloud/stackit/sdk/serverupdate/v1api/api/ServerUpdateApiTest.java b/services/serverupdate/src/test/java/cloud/stackit/sdk/serverupdate/v1api/api/ServerUpdateApiTest.java deleted file mode 100644 index 0a1bcc9e..00000000 --- a/services/serverupdate/src/test/java/cloud/stackit/sdk/serverupdate/v1api/api/ServerUpdateApiTest.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * STACKIT Server Update Management API - * API endpoints for Server Update Operations on STACKIT Servers. - * - * The version of the OpenAPI document: 1.0 - * Contact: support@stackit.de - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package cloud.stackit.sdk.serverupdate.v1api.api; - -import cloud.stackit.sdk.core.KeyFlowAuthenticator; -import cloud.stackit.sdk.core.auth.SetupAuth; -import cloud.stackit.sdk.core.config.CoreConfiguration; -import cloud.stackit.sdk.core.utils.TestUtils; -import java.io.IOException; -import okhttp3.Authenticator; -import okhttp3.OkHttpClient; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -/** API tests for ServerUpdateApi */ -public class ServerUpdateApiTest { - @Test - public void TestCustomHttpClient() throws IOException { - // before - CoreConfiguration conf = - new CoreConfiguration().serviceAccountKey(TestUtils.MOCK_SERVICE_ACCOUNT_KEY); - - // when - OkHttpClient httpClient = new OkHttpClient(); - ServerUpdateApi api = new ServerUpdateApi(httpClient); - - // then - Assertions.assertEquals(httpClient, api.getApiClient().getHttpClient()); - // make sure the http client object is exactly the same object - Assertions.assertSame(httpClient, api.getApiClient().getHttpClient()); - } - - @Test - public void TestNoCustomHttpClient() throws IOException { - // before - CoreConfiguration conf = - new CoreConfiguration().serviceAccountKey(TestUtils.MOCK_SERVICE_ACCOUNT_KEY); - - // when - ServerUpdateApi api = new ServerUpdateApi(conf); - - // then - /* - * verify a fresh OkHttpClient got created which will have the auth header set - * by the {@link cloud.stackit.sdk.core.KeyFlowAuthenticator} - */ - OkHttpClient httpClient = new OkHttpClient(); - Authenticator authenticator = - new KeyFlowAuthenticator(httpClient, conf, SetupAuth.setupKeyFlow(conf)); - httpClient = httpClient.newBuilder().authenticator(authenticator).build(); - - Assertions.assertNotNull(api.getApiClient().getHttpClient()); - Assertions.assertEquals( - httpClient.authenticator().getClass(), - api.getApiClient().getHttpClient().authenticator().getClass()); - } -}