From 7887a3b82e3603bb863f85679b7b9b1309fda82f Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Mon, 28 Sep 2026 10:13:31 +0000 Subject: [PATCH] Generate objectstorage --- services/objectstorage/oas_commit | 2 +- .../stackit/sdk/objectstorage/v1api/JSON.java | 3 + .../objectstorage/v1api/api/DefaultApi.java | 200 ++++++++++++ .../v1api/model/ProjectStatus.java | 39 ++- .../v1api/model/UpdateServicePayload.java | 307 ++++++++++++++++++ .../stackit/sdk/objectstorage/v2api/JSON.java | 3 + .../objectstorage/v2api/api/DefaultApi.java | 218 +++++++++++++ .../v2api/model/ProjectStatus.java | 39 ++- .../v2api/model/UpdateServicePayload.java | 307 ++++++++++++++++++ 9 files changed, 1111 insertions(+), 7 deletions(-) create mode 100644 services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/UpdateServicePayload.java create mode 100644 services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/UpdateServicePayload.java diff --git a/services/objectstorage/oas_commit b/services/objectstorage/oas_commit index cdd59cce..1c32adf8 100644 --- a/services/objectstorage/oas_commit +++ b/services/objectstorage/oas_commit @@ -1 +1 @@ -404d55ddc0cbde39bb4bbc0a3792ea8a56cc58fa +108892dfd80781dc159e5e5420c41ef480de9d84 diff --git a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/JSON.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/JSON.java index e66e5543..d190e8f8 100644 --- a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/JSON.java +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/JSON.java @@ -175,6 +175,9 @@ private static Class getClassByDiscriminator( gsonBuilder.registerTypeAdapterFactory( new cloud.stackit.sdk.objectstorage.v1api.model.SetDefaultRetentionPayload .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.objectstorage.v1api.model.UpdateServicePayload + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( new cloud.stackit.sdk.objectstorage.v1api.model.ValidationError .CustomTypeAdapterFactory()); diff --git a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/api/DefaultApi.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/api/DefaultApi.java index f9c62808..c68a9c79 100644 --- a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/api/DefaultApi.java +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/api/DefaultApi.java @@ -36,6 +36,7 @@ import cloud.stackit.sdk.objectstorage.v1api.model.ListCredentialsGroupsResponse; import cloud.stackit.sdk.objectstorage.v1api.model.ProjectStatus; import cloud.stackit.sdk.objectstorage.v1api.model.SetDefaultRetentionPayload; +import cloud.stackit.sdk.objectstorage.v1api.model.UpdateServicePayload; import com.google.gson.reflect.TypeToken; import java.io.IOException; import java.lang.reflect.Type; @@ -3939,4 +3940,203 @@ public okhttp3.Call setDefaultRetentionAsync( localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + + /** + * Build call for updateService + * + * @param projectId STACKIT project ID (required) + * @param updateServicePayload (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 Successful Response -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Validation Error -
429 Too Many Requests -
500 Internal Server Error -
+ */ + public okhttp3.Call updateServiceCall( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull UpdateServicePayload updateServicePayload, + 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 = updateServicePayload; + + // create path and map variables + String localVarPath = + "/v1/project/{projectId}" + .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 = {"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 updateServiceValidateBeforeCall( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull UpdateServicePayload updateServicePayload, + 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 updateService(Async)"); + } + + // verify the required parameter 'updateServicePayload' is set + if (updateServicePayload == null) { + throw new ApiException( + "Missing the required parameter 'updateServicePayload' when calling updateService(Async)"); + } + + return updateServiceCall(projectId, updateServicePayload, _callback); + } + + /** + * Update Project Update project details. + * + * @param projectId STACKIT project ID (required) + * @param updateServicePayload (required) + * @return ProjectStatus + * @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 Successful Response -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Validation Error -
429 Too Many Requests -
500 Internal Server Error -
+ */ + public ProjectStatus updateService( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull UpdateServicePayload updateServicePayload) + throws ApiException { + ApiResponse localVarResp = + updateServiceWithHttpInfo(projectId, updateServicePayload); + return localVarResp.getData(); + } + + /** + * Update Project Update project details. + * + * @param projectId STACKIT project ID (required) + * @param updateServicePayload (required) + * @return ApiResponse<ProjectStatus> + * @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 Successful Response -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Validation Error -
429 Too Many Requests -
500 Internal Server Error -
+ */ + public ApiResponse updateServiceWithHttpInfo( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull UpdateServicePayload updateServicePayload) + throws ApiException { + okhttp3.Call localVarCall = + updateServiceValidateBeforeCall(projectId, updateServicePayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update Project (asynchronously) Update project details. + * + * @param projectId STACKIT project ID (required) + * @param updateServicePayload (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 Successful Response -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Validation Error -
429 Too Many Requests -
500 Internal Server Error -
+ */ + public okhttp3.Call updateServiceAsync( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull UpdateServicePayload updateServicePayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + updateServiceValidateBeforeCall(projectId, updateServicePayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } } diff --git a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/ProjectStatus.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/ProjectStatus.java index ee9b09dd..2fb97827 100644 --- a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/ProjectStatus.java +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/ProjectStatus.java @@ -33,6 +33,11 @@ /** ProjectStatus */ @javax.annotation.Generated(value = "JavaGenerator", comments = "Generator version: 7.19.0") public class ProjectStatus { + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Map labels = new HashMap<>(); + public static final String SERIALIZED_NAME_PROJECT = "project"; @SerializedName(SERIALIZED_NAME_PROJECT) @@ -47,6 +52,32 @@ public class ProjectStatus { public ProjectStatus() {} + public ProjectStatus labels(@javax.annotation.Nullable Map labels) { + this.labels = labels; + return this; + } + + public ProjectStatus putLabelsItem(String key, String labelsItem) { + if (this.labels == null) { + this.labels = new HashMap<>(); + } + this.labels.put(key, labelsItem); + return this; + } + + /** + * Project labels + * + * @return labels + */ + @javax.annotation.Nullable public Map getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Map labels) { + this.labels = labels; + } + public ProjectStatus project(@javax.annotation.Nonnull String project) { this.project = project; return this; @@ -138,20 +169,22 @@ public boolean equals(Object o) { return false; } ProjectStatus projectStatus = (ProjectStatus) o; - return Objects.equals(this.project, projectStatus.project) + return Objects.equals(this.labels, projectStatus.labels) + && Objects.equals(this.project, projectStatus.project) && Objects.equals(this.scope, projectStatus.scope) && Objects.equals(this.additionalProperties, projectStatus.additionalProperties); } @Override public int hashCode() { - return Objects.hash(project, scope, additionalProperties); + return Objects.hash(labels, project, scope, additionalProperties); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ProjectStatus {\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); sb.append(" project: ").append(toIndentedString(project)).append("\n"); sb.append(" scope: ").append(toIndentedString(scope)).append("\n"); sb.append(" additionalProperties: ") @@ -177,7 +210,7 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("project", "scope")); + openapiFields = new HashSet(Arrays.asList("labels", "project", "scope")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(Arrays.asList("project", "scope")); diff --git a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/UpdateServicePayload.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/UpdateServicePayload.java new file mode 100644 index 00000000..c4f70e70 --- /dev/null +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/UpdateServicePayload.java @@ -0,0 +1,307 @@ +/* + * STACKIT Object Storage API + * STACKIT API to manage the Object Storage + * + * The version of the OpenAPI document: 1.1.0 + * + * + * 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.objectstorage.v1api.model; + +import cloud.stackit.sdk.objectstorage.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; + +/** UpdateServicePayload */ +@javax.annotation.Generated(value = "JavaGenerator", comments = "Generator version: 7.19.0") +public class UpdateServicePayload { + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nonnull + private Map labels = new HashMap<>(); + + public UpdateServicePayload() {} + + public UpdateServicePayload labels(@javax.annotation.Nonnull Map labels) { + this.labels = labels; + return this; + } + + public UpdateServicePayload putLabelsItem(String key, String labelsItem) { + if (this.labels == null) { + this.labels = new HashMap<>(); + } + this.labels.put(key, labelsItem); + return this; + } + + /** + * Project labels + * + * @return labels + */ + @javax.annotation.Nonnull + public Map getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nonnull Map labels) { + this.labels = labels; + } + + /** + * 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 UpdateServicePayload instance itself + */ + public UpdateServicePayload 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; + } + UpdateServicePayload updateServicePayload = (UpdateServicePayload) o; + return Objects.equals(this.labels, updateServicePayload.labels) + && Objects.equals( + this.additionalProperties, updateServicePayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(labels, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateServicePayload {\n"); + sb.append(" labels: ").append(toIndentedString(labels)).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("labels")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("labels")); + } + + /** + * 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 UpdateServicePayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateServicePayload.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 UpdateServicePayload is not found in the empty JSON string", + UpdateServicePayload.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateServicePayload.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 (!UpdateServicePayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateServicePayload' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateServicePayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateServicePayload 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 UpdateServicePayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateServicePayload 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 UpdateServicePayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateServicePayload + * @throws IOException if the JSON string is invalid with respect to UpdateServicePayload + */ + public static UpdateServicePayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateServicePayload.class); + } + + /** + * Convert an instance of UpdateServicePayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/JSON.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/JSON.java index 6e02fb0d..15a17385 100644 --- a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/JSON.java +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/JSON.java @@ -175,6 +175,9 @@ private static Class getClassByDiscriminator( gsonBuilder.registerTypeAdapterFactory( new cloud.stackit.sdk.objectstorage.v2api.model.SetDefaultRetentionPayload .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.objectstorage.v2api.model.UpdateServicePayload + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( new cloud.stackit.sdk.objectstorage.v2api.model.ValidationError .CustomTypeAdapterFactory()); diff --git a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/api/DefaultApi.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/api/DefaultApi.java index 3557ecfb..8d5470d4 100644 --- a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/api/DefaultApi.java +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/api/DefaultApi.java @@ -36,6 +36,7 @@ import cloud.stackit.sdk.objectstorage.v2api.model.ListCredentialsGroupsResponse; import cloud.stackit.sdk.objectstorage.v2api.model.ProjectStatus; import cloud.stackit.sdk.objectstorage.v2api.model.SetDefaultRetentionPayload; +import cloud.stackit.sdk.objectstorage.v2api.model.UpdateServicePayload; import com.google.gson.reflect.TypeToken; import java.io.IOException; import java.lang.reflect.Type; @@ -4350,4 +4351,221 @@ public okhttp3.Call setDefaultRetentionAsync( localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + + /** + * Build call for updateService + * + * @param projectId STACKIT project ID (required) + * @param region STACKIT Region (required) + * @param updateServicePayload (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 Successful Response -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Validation Error -
429 Too Many Requests -
500 Internal Server Error -
+ */ + public okhttp3.Call updateServiceCall( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UpdateServicePayload updateServicePayload, + 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 = updateServicePayload; + + // create path and map variables + String localVarPath = + "/v2/project/{projectId}/regions/{region}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.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 updateServiceValidateBeforeCall( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UpdateServicePayload updateServicePayload, + 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 updateService(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling updateService(Async)"); + } + + // verify the required parameter 'updateServicePayload' is set + if (updateServicePayload == null) { + throw new ApiException( + "Missing the required parameter 'updateServicePayload' when calling updateService(Async)"); + } + + return updateServiceCall(projectId, region, updateServicePayload, _callback); + } + + /** + * Update Project Update project details. + * + * @param projectId STACKIT project ID (required) + * @param region STACKIT Region (required) + * @param updateServicePayload (required) + * @return ProjectStatus + * @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 Successful Response -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Validation Error -
429 Too Many Requests -
500 Internal Server Error -
+ */ + public ProjectStatus updateService( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UpdateServicePayload updateServicePayload) + throws ApiException { + ApiResponse localVarResp = + updateServiceWithHttpInfo(projectId, region, updateServicePayload); + return localVarResp.getData(); + } + + /** + * Update Project Update project details. + * + * @param projectId STACKIT project ID (required) + * @param region STACKIT Region (required) + * @param updateServicePayload (required) + * @return ApiResponse<ProjectStatus> + * @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 Successful Response -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Validation Error -
429 Too Many Requests -
500 Internal Server Error -
+ */ + public ApiResponse updateServiceWithHttpInfo( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UpdateServicePayload updateServicePayload) + throws ApiException { + okhttp3.Call localVarCall = + updateServiceValidateBeforeCall(projectId, region, updateServicePayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update Project (asynchronously) Update project details. + * + * @param projectId STACKIT project ID (required) + * @param region STACKIT Region (required) + * @param updateServicePayload (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 Successful Response -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Validation Error -
429 Too Many Requests -
500 Internal Server Error -
+ */ + public okhttp3.Call updateServiceAsync( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UpdateServicePayload updateServicePayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + updateServiceValidateBeforeCall(projectId, region, updateServicePayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } } diff --git a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/ProjectStatus.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/ProjectStatus.java index 7c5a2b44..6b57779f 100644 --- a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/ProjectStatus.java +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/ProjectStatus.java @@ -33,6 +33,11 @@ /** ProjectStatus */ @javax.annotation.Generated(value = "JavaGenerator", comments = "Generator version: 7.19.0") public class ProjectStatus { + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Map labels = new HashMap<>(); + public static final String SERIALIZED_NAME_PROJECT = "project"; @SerializedName(SERIALIZED_NAME_PROJECT) @@ -47,6 +52,32 @@ public class ProjectStatus { public ProjectStatus() {} + public ProjectStatus labels(@javax.annotation.Nullable Map labels) { + this.labels = labels; + return this; + } + + public ProjectStatus putLabelsItem(String key, String labelsItem) { + if (this.labels == null) { + this.labels = new HashMap<>(); + } + this.labels.put(key, labelsItem); + return this; + } + + /** + * Project labels + * + * @return labels + */ + @javax.annotation.Nullable public Map getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Map labels) { + this.labels = labels; + } + public ProjectStatus project(@javax.annotation.Nonnull String project) { this.project = project; return this; @@ -138,20 +169,22 @@ public boolean equals(Object o) { return false; } ProjectStatus projectStatus = (ProjectStatus) o; - return Objects.equals(this.project, projectStatus.project) + return Objects.equals(this.labels, projectStatus.labels) + && Objects.equals(this.project, projectStatus.project) && Objects.equals(this.scope, projectStatus.scope) && Objects.equals(this.additionalProperties, projectStatus.additionalProperties); } @Override public int hashCode() { - return Objects.hash(project, scope, additionalProperties); + return Objects.hash(labels, project, scope, additionalProperties); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ProjectStatus {\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); sb.append(" project: ").append(toIndentedString(project)).append("\n"); sb.append(" scope: ").append(toIndentedString(scope)).append("\n"); sb.append(" additionalProperties: ") @@ -177,7 +210,7 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("project", "scope")); + openapiFields = new HashSet(Arrays.asList("labels", "project", "scope")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(Arrays.asList("project", "scope")); diff --git a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/UpdateServicePayload.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/UpdateServicePayload.java new file mode 100644 index 00000000..b0bce701 --- /dev/null +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/UpdateServicePayload.java @@ -0,0 +1,307 @@ +/* + * STACKIT Object Storage API + * STACKIT API to manage the Object Storage + * + * The version of the OpenAPI document: 2.0.1 + * + * + * 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.objectstorage.v2api.model; + +import cloud.stackit.sdk.objectstorage.v2api.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; + +/** UpdateServicePayload */ +@javax.annotation.Generated(value = "JavaGenerator", comments = "Generator version: 7.19.0") +public class UpdateServicePayload { + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nonnull + private Map labels = new HashMap<>(); + + public UpdateServicePayload() {} + + public UpdateServicePayload labels(@javax.annotation.Nonnull Map labels) { + this.labels = labels; + return this; + } + + public UpdateServicePayload putLabelsItem(String key, String labelsItem) { + if (this.labels == null) { + this.labels = new HashMap<>(); + } + this.labels.put(key, labelsItem); + return this; + } + + /** + * Project labels + * + * @return labels + */ + @javax.annotation.Nonnull + public Map getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nonnull Map labels) { + this.labels = labels; + } + + /** + * 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 UpdateServicePayload instance itself + */ + public UpdateServicePayload 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; + } + UpdateServicePayload updateServicePayload = (UpdateServicePayload) o; + return Objects.equals(this.labels, updateServicePayload.labels) + && Objects.equals( + this.additionalProperties, updateServicePayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(labels, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateServicePayload {\n"); + sb.append(" labels: ").append(toIndentedString(labels)).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("labels")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("labels")); + } + + /** + * 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 UpdateServicePayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateServicePayload.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 UpdateServicePayload is not found in the empty JSON string", + UpdateServicePayload.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateServicePayload.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 (!UpdateServicePayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateServicePayload' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateServicePayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateServicePayload 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 UpdateServicePayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateServicePayload 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 UpdateServicePayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateServicePayload + * @throws IOException if the JSON string is invalid with respect to UpdateServicePayload + */ + public static UpdateServicePayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateServicePayload.class); + } + + /** + * Convert an instance of UpdateServicePayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +}