From 8eef06622cb964f7ddb3707427d4ff8f2656baff Mon Sep 17 00:00:00 2001 From: Ruben Hoenle Date: Fri, 24 Apr 2026 14:21:26 +0200 Subject: [PATCH 1/3] feat(objectstorage): add multi API version support relates to STACKITSDK-421 --- services/objectstorage/README.md | 6 - .../sdk/objectstorage/v1api/ApiCallback.java | 60 + .../sdk/objectstorage/v1api/ApiClient.java | 1601 +++++++ .../sdk/objectstorage/v1api/ApiResponse.java | 73 + .../v1api/GzipRequestInterceptor.java | 87 + .../stackit/sdk/objectstorage/v1api/JSON.java | 501 +++ .../stackit/sdk/objectstorage/v1api/Pair.java | 38 + .../v1api/ProgressRequestBody.java | 71 + .../v1api/ProgressResponseBody.java | 68 + .../v1api/ServerConfiguration.java | 79 + .../objectstorage/v1api/ServerVariable.java | 37 + .../sdk/objectstorage/v1api/StringUtil.java | 83 + .../objectstorage/v1api/api/DefaultApi.java | 3890 +++++++++++++++++ .../v1api/api/ObjectStorageApi.java | 64 + .../v1api/model/AbstractOpenApiSchema.java | 145 + .../objectstorage/v1api/model/AccessKey.java | 375 ++ .../sdk/objectstorage/v1api/model/Bucket.java | 459 ++ .../v1api/model/ComplianceLockResponse.java | 336 ++ .../v1api/model/CreateAccessKeyPayload.java | 288 ++ .../v1api/model/CreateAccessKeyResponse.java | 503 +++ .../v1api/model/CreateBucketResponse.java | 342 ++ .../model/CreateCredentialsGroupPayload.java | 316 ++ .../model/CreateCredentialsGroupResponse.java | 347 ++ .../v1api/model/CredentialsGroup.java | 380 ++ .../v1api/model/CredentialsGroupExtended.java | 418 ++ .../v1api/model/DefaultRetentionResponse.java | 400 ++ .../v1api/model/DeleteAccessKeyResponse.java | 343 ++ .../v1api/model/DeleteBucketResponse.java | 342 ++ .../model/DeleteCredentialsGroupResponse.java | 354 ++ .../model/DeleteDefaultRetentionResponse.java | 350 ++ .../v1api/model/DetailedError.java | 340 ++ .../v1api/model/ErrorMessage.java | 324 ++ .../v1api/model/GetBucketResponse.java | 337 ++ .../model/GetCredentialsGroupResponse.java | 343 ++ .../v1api/model/HTTPValidationError.java | 316 ++ .../v1api/model/ListAccessKeysResponse.java | 360 ++ .../v1api/model/ListBucketsResponse.java | 360 ++ .../model/ListCredentialsGroupsResponse.java | 374 ++ .../v1api/model/LocationInner.java | 301 ++ .../v1api/model/ProjectScope.java | 76 + .../v1api/model/ProjectStatus.java | 335 ++ .../v1api/model/RetentionMode.java | 73 + .../model/SetDefaultRetentionPayload.java | 331 ++ .../v1api/model/ValidationError.java | 393 ++ .../{ => v2api}/ApiCallback.java | 2 +- .../objectstorage/{ => v2api}/ApiClient.java | 12 +- .../{ => v2api}/ApiResponse.java | 2 +- .../{ => v2api}/GzipRequestInterceptor.java | 2 +- .../sdk/objectstorage/{ => v2api}/JSON.java | 61 +- .../sdk/objectstorage/{ => v2api}/Pair.java | 2 +- .../{ => v2api}/ProgressRequestBody.java | 2 +- .../{ => v2api}/ProgressResponseBody.java | 2 +- .../{ => v2api}/ServerConfiguration.java | 2 +- .../{ => v2api}/ServerVariable.java | 2 +- .../objectstorage/{ => v2api}/StringUtil.java | 2 +- .../{ => v2api}/api/DefaultApi.java | 46 +- .../{ => v2api}/api/ObjectStorageApi.java | 4 +- .../model/AbstractOpenApiSchema.java | 2 +- .../{ => v2api}/model/AccessKey.java | 4 +- .../{ => v2api}/model/Bucket.java | 4 +- .../model/ComplianceLockResponse.java | 4 +- .../model/CreateAccessKeyPayload.java | 4 +- .../model/CreateAccessKeyResponse.java | 4 +- .../model/CreateBucketResponse.java | 4 +- .../model/CreateCredentialsGroupPayload.java | 4 +- .../model/CreateCredentialsGroupResponse.java | 4 +- .../{ => v2api}/model/CredentialsGroup.java | 4 +- .../model/CredentialsGroupExtended.java | 4 +- .../model/DefaultRetentionResponse.java | 4 +- .../model/DeleteAccessKeyResponse.java | 4 +- .../model/DeleteBucketResponse.java | 4 +- .../model/DeleteCredentialsGroupResponse.java | 4 +- .../model/DeleteDefaultRetentionResponse.java | 4 +- .../{ => v2api}/model/DetailedError.java | 4 +- .../{ => v2api}/model/ErrorMessage.java | 4 +- .../{ => v2api}/model/GetBucketResponse.java | 4 +- .../model/GetCredentialsGroupResponse.java | 4 +- .../model/HTTPValidationError.java | 4 +- .../model/ListAccessKeysResponse.java | 4 +- .../model/ListBucketsResponse.java | 4 +- .../model/ListCredentialsGroupsResponse.java | 4 +- .../{ => v2api}/model/LocationInner.java | 4 +- .../{ => v2api}/model/ProjectScope.java | 2 +- .../{ => v2api}/model/ProjectStatus.java | 4 +- .../{ => v2api}/model/RetentionMode.java | 2 +- .../model/SetDefaultRetentionPayload.java | 4 +- .../{ => v2api}/model/ValidationError.java | 4 +- .../v1api/api/DefaultApiTest.java | 66 + .../v1api/api/ObjectStorageApiTest.java | 67 + .../{ => v2api}/api/DefaultApiTest.java | 2 +- .../{ => v2api}/api/ObjectStorageApiTest.java | 2 +- 91 files changed, 16878 insertions(+), 133 deletions(-) create mode 100644 services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/ApiCallback.java create mode 100644 services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/ApiClient.java create mode 100644 services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/ApiResponse.java create mode 100644 services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/GzipRequestInterceptor.java create mode 100644 services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/JSON.java create mode 100644 services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/Pair.java create mode 100644 services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/ProgressRequestBody.java create mode 100644 services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/ProgressResponseBody.java create mode 100644 services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/ServerConfiguration.java create mode 100644 services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/ServerVariable.java create mode 100644 services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/StringUtil.java create mode 100644 services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/api/DefaultApi.java create mode 100644 services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/api/ObjectStorageApi.java create mode 100644 services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/AbstractOpenApiSchema.java create mode 100644 services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/AccessKey.java create mode 100644 services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/Bucket.java create mode 100644 services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/ComplianceLockResponse.java create mode 100644 services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/CreateAccessKeyPayload.java create mode 100644 services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/CreateAccessKeyResponse.java create mode 100644 services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/CreateBucketResponse.java create mode 100644 services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/CreateCredentialsGroupPayload.java create mode 100644 services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/CreateCredentialsGroupResponse.java create mode 100644 services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/CredentialsGroup.java create mode 100644 services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/CredentialsGroupExtended.java create mode 100644 services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/DefaultRetentionResponse.java create mode 100644 services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/DeleteAccessKeyResponse.java create mode 100644 services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/DeleteBucketResponse.java create mode 100644 services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/DeleteCredentialsGroupResponse.java create mode 100644 services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/DeleteDefaultRetentionResponse.java create mode 100644 services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/DetailedError.java create mode 100644 services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/ErrorMessage.java create mode 100644 services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/GetBucketResponse.java create mode 100644 services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/GetCredentialsGroupResponse.java create mode 100644 services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/HTTPValidationError.java create mode 100644 services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/ListAccessKeysResponse.java create mode 100644 services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/ListBucketsResponse.java create mode 100644 services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/ListCredentialsGroupsResponse.java create mode 100644 services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/LocationInner.java create mode 100644 services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/ProjectScope.java create mode 100644 services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/ProjectStatus.java create mode 100644 services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/RetentionMode.java create mode 100644 services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/SetDefaultRetentionPayload.java create mode 100644 services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/ValidationError.java rename services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/{ => v2api}/ApiCallback.java (97%) rename services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/{ => v2api}/ApiClient.java (99%) rename services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/{ => v2api}/ApiResponse.java (97%) rename services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/{ => v2api}/GzipRequestInterceptor.java (97%) rename services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/{ => v2api}/JSON.java (85%) rename services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/{ => v2api}/Pair.java (94%) rename services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/{ => v2api}/ProgressRequestBody.java (97%) rename services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/{ => v2api}/ProgressResponseBody.java (97%) rename services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/{ => v2api}/ServerConfiguration.java (97%) rename services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/{ => v2api}/ServerVariable.java (96%) rename services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/{ => v2api}/StringUtil.java (97%) rename services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/{ => v2api}/api/DefaultApi.java (99%) rename services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/{ => v2api}/api/ObjectStorageApi.java (93%) rename services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/{ => v2api}/model/AbstractOpenApiSchema.java (98%) rename services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/{ => v2api}/model/AccessKey.java (99%) rename services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/{ => v2api}/model/Bucket.java (99%) rename services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/{ => v2api}/model/ComplianceLockResponse.java (99%) rename services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/{ => v2api}/model/CreateAccessKeyPayload.java (98%) rename services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/{ => v2api}/model/CreateAccessKeyResponse.java (99%) rename services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/{ => v2api}/model/CreateBucketResponse.java (99%) rename services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/{ => v2api}/model/CreateCredentialsGroupPayload.java (99%) rename services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/{ => v2api}/model/CreateCredentialsGroupResponse.java (99%) rename services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/{ => v2api}/model/CredentialsGroup.java (99%) rename services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/{ => v2api}/model/CredentialsGroupExtended.java (99%) rename services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/{ => v2api}/model/DefaultRetentionResponse.java (99%) rename services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/{ => v2api}/model/DeleteAccessKeyResponse.java (99%) rename services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/{ => v2api}/model/DeleteBucketResponse.java (99%) rename services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/{ => v2api}/model/DeleteCredentialsGroupResponse.java (99%) rename services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/{ => v2api}/model/DeleteDefaultRetentionResponse.java (99%) rename services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/{ => v2api}/model/DetailedError.java (99%) rename services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/{ => v2api}/model/ErrorMessage.java (99%) rename services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/{ => v2api}/model/GetBucketResponse.java (99%) rename services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/{ => v2api}/model/GetCredentialsGroupResponse.java (99%) rename services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/{ => v2api}/model/HTTPValidationError.java (99%) rename services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/{ => v2api}/model/ListAccessKeysResponse.java (99%) rename services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/{ => v2api}/model/ListBucketsResponse.java (99%) rename services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/{ => v2api}/model/ListCredentialsGroupsResponse.java (99%) rename services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/{ => v2api}/model/LocationInner.java (98%) rename services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/{ => v2api}/model/ProjectScope.java (97%) rename services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/{ => v2api}/model/ProjectStatus.java (99%) rename services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/{ => v2api}/model/RetentionMode.java (97%) rename services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/{ => v2api}/model/SetDefaultRetentionPayload.java (99%) rename services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/{ => v2api}/model/ValidationError.java (99%) create mode 100644 services/objectstorage/src/test/java/cloud/stackit/sdk/objectstorage/v1api/api/DefaultApiTest.java create mode 100644 services/objectstorage/src/test/java/cloud/stackit/sdk/objectstorage/v1api/api/ObjectStorageApiTest.java rename services/objectstorage/src/test/java/cloud/stackit/sdk/objectstorage/{ => v2api}/api/DefaultApiTest.java (97%) rename services/objectstorage/src/test/java/cloud/stackit/sdk/objectstorage/{ => v2api}/api/ObjectStorageApiTest.java (97%) diff --git a/services/objectstorage/README.md b/services/objectstorage/README.md index d87e345c..acb18aed 100644 --- a/services/objectstorage/README.md +++ b/services/objectstorage/README.md @@ -1,11 +1,5 @@ # STACKIT Java SDK for STACKIT Object Storage API -- API version: 2.0.1 - -STACKIT API to manage the Object Storage - - - 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/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/ApiCallback.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/ApiCallback.java new file mode 100644 index 00000000..11907dd7 --- /dev/null +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/ApiCallback.java @@ -0,0 +1,60 @@ +/* + * 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; + +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/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/ApiClient.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/ApiClient.java new file mode 100644 index 00000000..2f35bec9 --- /dev/null +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/ApiClient.java @@ -0,0 +1,1601 @@ +/* + * 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; + +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://object-storage.api.eu01.stackit.cloud"; + protected List servers = + new ArrayList( + Arrays.asList( + new ServerConfiguration( + "https://object-storage.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/objectstorage"); + } + + /** + * Get base path + * + * @return Base path + */ + public String getBasePath() { + return basePath; + } + + /** + * Set base path + * + * @param basePath Base path of the URL (e.g https://object-storage.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.objectstorage.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.objectstorage.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.objectstorage.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.objectstorage.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.objectstorage.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/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/ApiResponse.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/ApiResponse.java new file mode 100644 index 00000000..0e3cec48 --- /dev/null +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/ApiResponse.java @@ -0,0 +1,73 @@ +/* + * 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; + +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/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/GzipRequestInterceptor.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/GzipRequestInterceptor.java new file mode 100644 index 00000000..470ded7e --- /dev/null +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/GzipRequestInterceptor.java @@ -0,0 +1,87 @@ +/* + * 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; + +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/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/JSON.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/JSON.java new file mode 100644 index 00000000..128e4896 --- /dev/null +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/JSON.java @@ -0,0 +1,501 @@ +/* + * 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; + +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.objectstorage.v1api.model.AccessKey + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.objectstorage.v1api.model.Bucket.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.objectstorage.v1api.model.ComplianceLockResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.objectstorage.v1api.model.CreateAccessKeyPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.objectstorage.v1api.model.CreateAccessKeyResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.objectstorage.v1api.model.CreateBucketResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.objectstorage.v1api.model.CreateCredentialsGroupPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.objectstorage.v1api.model.CreateCredentialsGroupResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.objectstorage.v1api.model.CredentialsGroup + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.objectstorage.v1api.model.CredentialsGroupExtended + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.objectstorage.v1api.model.DefaultRetentionResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.objectstorage.v1api.model.DeleteAccessKeyResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.objectstorage.v1api.model.DeleteBucketResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.objectstorage.v1api.model.DeleteCredentialsGroupResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.objectstorage.v1api.model.DeleteDefaultRetentionResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.objectstorage.v1api.model.DetailedError + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.objectstorage.v1api.model.ErrorMessage + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.objectstorage.v1api.model.GetBucketResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.objectstorage.v1api.model.GetCredentialsGroupResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.objectstorage.v1api.model.HTTPValidationError + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.objectstorage.v1api.model.ListAccessKeysResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.objectstorage.v1api.model.ListBucketsResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.objectstorage.v1api.model.ListCredentialsGroupsResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.objectstorage.v1api.model.LocationInner + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.objectstorage.v1api.model.ProjectStatus + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.objectstorage.v1api.model.SetDefaultRetentionPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.objectstorage.v1api.model.ValidationError + .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/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/Pair.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/Pair.java new file mode 100644 index 00000000..96540972 --- /dev/null +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/Pair.java @@ -0,0 +1,38 @@ +/* + * 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; + +@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/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/ProgressRequestBody.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/ProgressRequestBody.java new file mode 100644 index 00000000..8310cf14 --- /dev/null +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/ProgressRequestBody.java @@ -0,0 +1,71 @@ +/* + * 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; + +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/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/ProgressResponseBody.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/ProgressResponseBody.java new file mode 100644 index 00000000..61c71ba7 --- /dev/null +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/ProgressResponseBody.java @@ -0,0 +1,68 @@ +/* + * 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; + +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/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/ServerConfiguration.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/ServerConfiguration.java new file mode 100644 index 00000000..60a7fbb2 --- /dev/null +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/ServerConfiguration.java @@ -0,0 +1,79 @@ +/* + * 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; + +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/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/ServerVariable.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/ServerVariable.java new file mode 100644 index 00000000..9d265014 --- /dev/null +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/ServerVariable.java @@ -0,0 +1,37 @@ +/* + * 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; + +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/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/StringUtil.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/StringUtil.java new file mode 100644 index 00000000..f54dca38 --- /dev/null +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/StringUtil.java @@ -0,0 +1,83 @@ +/* + * 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; + +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/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 new file mode 100644 index 00000000..0b70dbe9 --- /dev/null +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/api/DefaultApi.java @@ -0,0 +1,3890 @@ +/* + * 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.api; + +import cloud.stackit.sdk.core.config.CoreConfiguration; +import cloud.stackit.sdk.core.exception.ApiException; +import cloud.stackit.sdk.objectstorage.v1api.ApiCallback; +import cloud.stackit.sdk.objectstorage.v1api.ApiClient; +import cloud.stackit.sdk.objectstorage.v1api.ApiResponse; +import cloud.stackit.sdk.objectstorage.v1api.Pair; +import cloud.stackit.sdk.objectstorage.v1api.model.ComplianceLockResponse; +import cloud.stackit.sdk.objectstorage.v1api.model.CreateAccessKeyPayload; +import cloud.stackit.sdk.objectstorage.v1api.model.CreateAccessKeyResponse; +import cloud.stackit.sdk.objectstorage.v1api.model.CreateBucketResponse; +import cloud.stackit.sdk.objectstorage.v1api.model.CreateCredentialsGroupPayload; +import cloud.stackit.sdk.objectstorage.v1api.model.CreateCredentialsGroupResponse; +import cloud.stackit.sdk.objectstorage.v1api.model.DefaultRetentionResponse; +import cloud.stackit.sdk.objectstorage.v1api.model.DeleteAccessKeyResponse; +import cloud.stackit.sdk.objectstorage.v1api.model.DeleteBucketResponse; +import cloud.stackit.sdk.objectstorage.v1api.model.DeleteCredentialsGroupResponse; +import cloud.stackit.sdk.objectstorage.v1api.model.DeleteDefaultRetentionResponse; +import cloud.stackit.sdk.objectstorage.v1api.model.GetBucketResponse; +import cloud.stackit.sdk.objectstorage.v1api.model.GetCredentialsGroupResponse; +import cloud.stackit.sdk.objectstorage.v1api.model.ListAccessKeysResponse; +import cloud.stackit.sdk.objectstorage.v1api.model.ListBucketsResponse; +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 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 createAccessKey + * + * @param projectId STACKIT project ID (required) + * @param createAccessKeyPayload (required) + * @param credentialsGroup (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 Successful Response -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Validation Error -
500 Internal Server Error -
+ */ + public okhttp3.Call createAccessKeyCall( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull CreateAccessKeyPayload createAccessKeyPayload, + @javax.annotation.Nullable String credentialsGroup, + 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 = createAccessKeyPayload; + + // create path and map variables + String localVarPath = + "/v1/project/{projectId}/access-key" + .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(); + + if (credentialsGroup != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("credentials-group", credentialsGroup)); + } + + 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 createAccessKeyValidateBeforeCall( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull CreateAccessKeyPayload createAccessKeyPayload, + @javax.annotation.Nullable String credentialsGroup, + 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 createAccessKey(Async)"); + } + + // verify the required parameter 'createAccessKeyPayload' is set + if (createAccessKeyPayload == null) { + throw new ApiException( + "Missing the required parameter 'createAccessKeyPayload' when calling createAccessKey(Async)"); + } + + return createAccessKeyCall(projectId, createAccessKeyPayload, credentialsGroup, _callback); + } + + /** + * Create Access Key Create an access key for the given project. + * + * @param projectId STACKIT project ID (required) + * @param createAccessKeyPayload (required) + * @param credentialsGroup (optional) + * @return CreateAccessKeyResponse + * @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 Successful Response -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Validation Error -
500 Internal Server Error -
+ */ + public CreateAccessKeyResponse createAccessKey( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull CreateAccessKeyPayload createAccessKeyPayload, + @javax.annotation.Nullable String credentialsGroup) + throws ApiException { + ApiResponse localVarResp = + createAccessKeyWithHttpInfo(projectId, createAccessKeyPayload, credentialsGroup); + return localVarResp.getData(); + } + + /** + * Create Access Key Create an access key for the given project. + * + * @param projectId STACKIT project ID (required) + * @param createAccessKeyPayload (required) + * @param credentialsGroup (optional) + * @return ApiResponse<CreateAccessKeyResponse> + * @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 Successful Response -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Validation Error -
500 Internal Server Error -
+ */ + public ApiResponse createAccessKeyWithHttpInfo( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull CreateAccessKeyPayload createAccessKeyPayload, + @javax.annotation.Nullable String credentialsGroup) + throws ApiException { + okhttp3.Call localVarCall = + createAccessKeyValidateBeforeCall( + projectId, createAccessKeyPayload, credentialsGroup, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create Access Key (asynchronously) Create an access key for the given project. + * + * @param projectId STACKIT project ID (required) + * @param createAccessKeyPayload (required) + * @param credentialsGroup (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 Successful Response -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Validation Error -
500 Internal Server Error -
+ */ + public okhttp3.Call createAccessKeyAsync( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull CreateAccessKeyPayload createAccessKeyPayload, + @javax.annotation.Nullable String credentialsGroup, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createAccessKeyValidateBeforeCall( + projectId, createAccessKeyPayload, credentialsGroup, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for createBucket + * + * @param projectId STACKIT project ID (required) + * @param bucketName The name has to be dns-conform. (required) + * @param objectLockEnabled Enable S3 Object Lock on this bucket. Can only be set at creation + * time. Requires an active project-level compliance lock. (optional, default to false) + * @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 Successful Response -
401 Unauthorized -
404 Not Found -
409 Conflict -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call createBucketCall( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String bucketName, + @javax.annotation.Nullable Boolean objectLockEnabled, + 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/project/{projectId}/bucket/{bucketName}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "bucketName" + "}", + localVarApiClient.escapeString(bucketName.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (objectLockEnabled != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("objectLockEnabled", objectLockEnabled)); + } + + 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, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createBucketValidateBeforeCall( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String bucketName, + @javax.annotation.Nullable Boolean objectLockEnabled, + 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 createBucket(Async)"); + } + + // verify the required parameter 'bucketName' is set + if (bucketName == null) { + throw new ApiException( + "Missing the required parameter 'bucketName' when calling createBucket(Async)"); + } + + return createBucketCall(projectId, bucketName, objectLockEnabled, _callback); + } + + /** + * Create Bucket Create a bucket for the given project. Bucket with the same name cannot already + * exists in the object storage + * + * @param projectId STACKIT project ID (required) + * @param bucketName The name has to be dns-conform. (required) + * @param objectLockEnabled Enable S3 Object Lock on this bucket. Can only be set at creation + * time. Requires an active project-level compliance lock. (optional, default to false) + * @return CreateBucketResponse + * @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 Successful Response -
401 Unauthorized -
404 Not Found -
409 Conflict -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public CreateBucketResponse createBucket( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String bucketName, + @javax.annotation.Nullable Boolean objectLockEnabled) + throws ApiException { + ApiResponse localVarResp = + createBucketWithHttpInfo(projectId, bucketName, objectLockEnabled); + return localVarResp.getData(); + } + + /** + * Create Bucket Create a bucket for the given project. Bucket with the same name cannot already + * exists in the object storage + * + * @param projectId STACKIT project ID (required) + * @param bucketName The name has to be dns-conform. (required) + * @param objectLockEnabled Enable S3 Object Lock on this bucket. Can only be set at creation + * time. Requires an active project-level compliance lock. (optional, default to false) + * @return ApiResponse<CreateBucketResponse> + * @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 Successful Response -
401 Unauthorized -
404 Not Found -
409 Conflict -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public ApiResponse createBucketWithHttpInfo( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String bucketName, + @javax.annotation.Nullable Boolean objectLockEnabled) + throws ApiException { + okhttp3.Call localVarCall = + createBucketValidateBeforeCall(projectId, bucketName, objectLockEnabled, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create Bucket (asynchronously) Create a bucket for the given project. Bucket with the same + * name cannot already exists in the object storage + * + * @param projectId STACKIT project ID (required) + * @param bucketName The name has to be dns-conform. (required) + * @param objectLockEnabled Enable S3 Object Lock on this bucket. Can only be set at creation + * time. Requires an active project-level compliance lock. (optional, default to false) + * @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 Successful Response -
401 Unauthorized -
404 Not Found -
409 Conflict -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call createBucketAsync( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String bucketName, + @javax.annotation.Nullable Boolean objectLockEnabled, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createBucketValidateBeforeCall(projectId, bucketName, objectLockEnabled, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for createComplianceLock + * + * @param projectId STACKIT 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
201 Successful Response -
404 Not Found -
409 Conflict -
500 Internal Server Error -
+ */ + public okhttp3.Call createComplianceLockCall( + @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/project/{projectId}/compliance-lock" + .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, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createComplianceLockValidateBeforeCall( + @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 createComplianceLock(Async)"); + } + + return createComplianceLockCall(projectId, _callback); + } + + /** + * Create Compliance Lock Enable compliance lock for a project. + * + * @param projectId STACKIT project ID (required) + * @return ComplianceLockResponse + * @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 Successful Response -
404 Not Found -
409 Conflict -
500 Internal Server Error -
+ */ + public ComplianceLockResponse createComplianceLock(@javax.annotation.Nonnull String projectId) + throws ApiException { + ApiResponse localVarResp = + createComplianceLockWithHttpInfo(projectId); + return localVarResp.getData(); + } + + /** + * Create Compliance Lock Enable compliance lock for a project. + * + * @param projectId STACKIT project ID (required) + * @return ApiResponse<ComplianceLockResponse> + * @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 Successful Response -
404 Not Found -
409 Conflict -
500 Internal Server Error -
+ */ + public ApiResponse createComplianceLockWithHttpInfo( + @javax.annotation.Nonnull String projectId) throws ApiException { + okhttp3.Call localVarCall = createComplianceLockValidateBeforeCall(projectId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create Compliance Lock (asynchronously) Enable compliance lock for a project. + * + * @param projectId STACKIT 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
201 Successful Response -
404 Not Found -
409 Conflict -
500 Internal Server Error -
+ */ + public okhttp3.Call createComplianceLockAsync( + @javax.annotation.Nonnull String projectId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = createComplianceLockValidateBeforeCall(projectId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for createCredentialsGroup + * + * @param projectId STACKIT project ID (required) + * @param createCredentialsGroupPayload (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
201 Successful Response -
401 Unauthorized -
403 Forbidden -
404 Not Found -
409 Conflict -
422 Validation Error -
500 Internal Server Error -
+ */ + public okhttp3.Call createCredentialsGroupCall( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull CreateCredentialsGroupPayload createCredentialsGroupPayload, + 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 = createCredentialsGroupPayload; + + // create path and map variables + String localVarPath = + "/v1/project/{projectId}/credentials-group" + .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, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createCredentialsGroupValidateBeforeCall( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull CreateCredentialsGroupPayload createCredentialsGroupPayload, + 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 createCredentialsGroup(Async)"); + } + + // verify the required parameter 'createCredentialsGroupPayload' is set + if (createCredentialsGroupPayload == null) { + throw new ApiException( + "Missing the required parameter 'createCredentialsGroupPayload' when calling createCredentialsGroup(Async)"); + } + + return createCredentialsGroupCall(projectId, createCredentialsGroupPayload, _callback); + } + + /** + * Create Credentials Group + * + * @param projectId STACKIT project ID (required) + * @param createCredentialsGroupPayload (required) + * @return CreateCredentialsGroupResponse + * @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 Successful Response -
401 Unauthorized -
403 Forbidden -
404 Not Found -
409 Conflict -
422 Validation Error -
500 Internal Server Error -
+ */ + public CreateCredentialsGroupResponse createCredentialsGroup( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull CreateCredentialsGroupPayload createCredentialsGroupPayload) + throws ApiException { + ApiResponse localVarResp = + createCredentialsGroupWithHttpInfo(projectId, createCredentialsGroupPayload); + return localVarResp.getData(); + } + + /** + * Create Credentials Group + * + * @param projectId STACKIT project ID (required) + * @param createCredentialsGroupPayload (required) + * @return ApiResponse<CreateCredentialsGroupResponse> + * @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 Successful Response -
401 Unauthorized -
403 Forbidden -
404 Not Found -
409 Conflict -
422 Validation Error -
500 Internal Server Error -
+ */ + public ApiResponse createCredentialsGroupWithHttpInfo( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull CreateCredentialsGroupPayload createCredentialsGroupPayload) + throws ApiException { + okhttp3.Call localVarCall = + createCredentialsGroupValidateBeforeCall( + projectId, createCredentialsGroupPayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create Credentials Group (asynchronously) + * + * @param projectId STACKIT project ID (required) + * @param createCredentialsGroupPayload (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
201 Successful Response -
401 Unauthorized -
403 Forbidden -
404 Not Found -
409 Conflict -
422 Validation Error -
500 Internal Server Error -
+ */ + public okhttp3.Call createCredentialsGroupAsync( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull CreateCredentialsGroupPayload createCredentialsGroupPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createCredentialsGroupValidateBeforeCall( + projectId, createCredentialsGroupPayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for deleteAccessKey + * + * @param projectId STACKIT project ID (required) + * @param keyId Object storage access key (required) + * @param credentialsGroup (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 Successful Response -
307 Temporary Redirect -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Validation Error -
500 Internal Server Error -
+ */ + public okhttp3.Call deleteAccessKeyCall( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String keyId, + @javax.annotation.Nullable String credentialsGroup, + 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/project/{projectId}/access-key/{keyId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "keyId" + "}", + localVarApiClient.escapeString(keyId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (credentialsGroup != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("credentials-group", credentialsGroup)); + } + + 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, + "DELETE", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteAccessKeyValidateBeforeCall( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String keyId, + @javax.annotation.Nullable String credentialsGroup, + 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 deleteAccessKey(Async)"); + } + + // verify the required parameter 'keyId' is set + if (keyId == null) { + throw new ApiException( + "Missing the required parameter 'keyId' when calling deleteAccessKey(Async)"); + } + + return deleteAccessKeyCall(projectId, keyId, credentialsGroup, _callback); + } + + /** + * Delete Access Key Delete an access key from the given project. + * + * @param projectId STACKIT project ID (required) + * @param keyId Object storage access key (required) + * @param credentialsGroup (optional) + * @return DeleteAccessKeyResponse + * @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 -
307 Temporary Redirect -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Validation Error -
500 Internal Server Error -
+ */ + public DeleteAccessKeyResponse deleteAccessKey( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String keyId, + @javax.annotation.Nullable String credentialsGroup) + throws ApiException { + ApiResponse localVarResp = + deleteAccessKeyWithHttpInfo(projectId, keyId, credentialsGroup); + return localVarResp.getData(); + } + + /** + * Delete Access Key Delete an access key from the given project. + * + * @param projectId STACKIT project ID (required) + * @param keyId Object storage access key (required) + * @param credentialsGroup (optional) + * @return ApiResponse<DeleteAccessKeyResponse> + * @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 -
307 Temporary Redirect -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Validation Error -
500 Internal Server Error -
+ */ + public ApiResponse deleteAccessKeyWithHttpInfo( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String keyId, + @javax.annotation.Nullable String credentialsGroup) + throws ApiException { + okhttp3.Call localVarCall = + deleteAccessKeyValidateBeforeCall(projectId, keyId, credentialsGroup, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Delete Access Key (asynchronously) Delete an access key from the given project. + * + * @param projectId STACKIT project ID (required) + * @param keyId Object storage access key (required) + * @param credentialsGroup (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 Successful Response -
307 Temporary Redirect -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Validation Error -
500 Internal Server Error -
+ */ + public okhttp3.Call deleteAccessKeyAsync( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String keyId, + @javax.annotation.Nullable String credentialsGroup, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + deleteAccessKeyValidateBeforeCall(projectId, keyId, credentialsGroup, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for deleteBucket + * + * @param projectId STACKIT project ID (required) + * @param bucketName The name has to be dns-conform. (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 -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call deleteBucketCall( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String bucketName, + 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/project/{projectId}/bucket/{bucketName}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "bucketName" + "}", + localVarApiClient.escapeString(bucketName.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, + "DELETE", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteBucketValidateBeforeCall( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String bucketName, + 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 deleteBucket(Async)"); + } + + // verify the required parameter 'bucketName' is set + if (bucketName == null) { + throw new ApiException( + "Missing the required parameter 'bucketName' when calling deleteBucket(Async)"); + } + + return deleteBucketCall(projectId, bucketName, _callback); + } + + /** + * Delete Bucket Delete a bucket from the given project. + * + * @param projectId STACKIT project ID (required) + * @param bucketName The name has to be dns-conform. (required) + * @return DeleteBucketResponse + * @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 -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public DeleteBucketResponse deleteBucket( + @javax.annotation.Nonnull String projectId, @javax.annotation.Nonnull String bucketName) + throws ApiException { + ApiResponse localVarResp = + deleteBucketWithHttpInfo(projectId, bucketName); + return localVarResp.getData(); + } + + /** + * Delete Bucket Delete a bucket from the given project. + * + * @param projectId STACKIT project ID (required) + * @param bucketName The name has to be dns-conform. (required) + * @return ApiResponse<DeleteBucketResponse> + * @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 -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public ApiResponse deleteBucketWithHttpInfo( + @javax.annotation.Nonnull String projectId, @javax.annotation.Nonnull String bucketName) + throws ApiException { + okhttp3.Call localVarCall = deleteBucketValidateBeforeCall(projectId, bucketName, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Delete Bucket (asynchronously) Delete a bucket from the given project. + * + * @param projectId STACKIT project ID (required) + * @param bucketName The name has to be dns-conform. (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 -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call deleteBucketAsync( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String bucketName, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + deleteBucketValidateBeforeCall(projectId, bucketName, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for deleteComplianceLock + * + * @param projectId STACKIT 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 Successful Response -
404 Not Found -
409 Conflict -
500 Internal Server Error -
+ */ + public okhttp3.Call deleteComplianceLockCall( + @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/project/{projectId}/compliance-lock" + .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, + "DELETE", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteComplianceLockValidateBeforeCall( + @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 deleteComplianceLock(Async)"); + } + + return deleteComplianceLockCall(projectId, _callback); + } + + /** + * Delete Compliance Lock Remove compliance lock from a project. + * + * @param projectId STACKIT project ID (required) + * @return ComplianceLockResponse + * @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 -
404 Not Found -
409 Conflict -
500 Internal Server Error -
+ */ + public ComplianceLockResponse deleteComplianceLock(@javax.annotation.Nonnull String projectId) + throws ApiException { + ApiResponse localVarResp = + deleteComplianceLockWithHttpInfo(projectId); + return localVarResp.getData(); + } + + /** + * Delete Compliance Lock Remove compliance lock from a project. + * + * @param projectId STACKIT project ID (required) + * @return ApiResponse<ComplianceLockResponse> + * @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 -
404 Not Found -
409 Conflict -
500 Internal Server Error -
+ */ + public ApiResponse deleteComplianceLockWithHttpInfo( + @javax.annotation.Nonnull String projectId) throws ApiException { + okhttp3.Call localVarCall = deleteComplianceLockValidateBeforeCall(projectId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Delete Compliance Lock (asynchronously) Remove compliance lock from a project. + * + * @param projectId STACKIT 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 Successful Response -
404 Not Found -
409 Conflict -
500 Internal Server Error -
+ */ + public okhttp3.Call deleteComplianceLockAsync( + @javax.annotation.Nonnull String projectId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = deleteComplianceLockValidateBeforeCall(projectId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for deleteCredentialsGroup + * + * @param projectId STACKIT project ID (required) + * @param groupId Id of the credentials group (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 -
404 Not Found -
422 Validation Error -
500 Internal Server Error -
+ */ + public okhttp3.Call deleteCredentialsGroupCall( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String groupId, + 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/project/{projectId}/credentials-group/{groupId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "groupId" + "}", + localVarApiClient.escapeString(groupId.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, + "DELETE", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteCredentialsGroupValidateBeforeCall( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String groupId, + 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 deleteCredentialsGroup(Async)"); + } + + // verify the required parameter 'groupId' is set + if (groupId == null) { + throw new ApiException( + "Missing the required parameter 'groupId' when calling deleteCredentialsGroup(Async)"); + } + + return deleteCredentialsGroupCall(projectId, groupId, _callback); + } + + /** + * Delete Credentials Group Delete a credentials group inside a project if the project exists + * and no valid access keys are left in the group. + * + * @param projectId STACKIT project ID (required) + * @param groupId Id of the credentials group (required) + * @return DeleteCredentialsGroupResponse + * @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 -
404 Not Found -
422 Validation Error -
500 Internal Server Error -
+ */ + public DeleteCredentialsGroupResponse deleteCredentialsGroup( + @javax.annotation.Nonnull String projectId, @javax.annotation.Nonnull String groupId) + throws ApiException { + ApiResponse localVarResp = + deleteCredentialsGroupWithHttpInfo(projectId, groupId); + return localVarResp.getData(); + } + + /** + * Delete Credentials Group Delete a credentials group inside a project if the project exists + * and no valid access keys are left in the group. + * + * @param projectId STACKIT project ID (required) + * @param groupId Id of the credentials group (required) + * @return ApiResponse<DeleteCredentialsGroupResponse> + * @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 -
404 Not Found -
422 Validation Error -
500 Internal Server Error -
+ */ + public ApiResponse deleteCredentialsGroupWithHttpInfo( + @javax.annotation.Nonnull String projectId, @javax.annotation.Nonnull String groupId) + throws ApiException { + okhttp3.Call localVarCall = + deleteCredentialsGroupValidateBeforeCall(projectId, groupId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Delete Credentials Group (asynchronously) Delete a credentials group inside a project if the + * project exists and no valid access keys are left in the group. + * + * @param projectId STACKIT project ID (required) + * @param groupId Id of the credentials group (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 -
404 Not Found -
422 Validation Error -
500 Internal Server Error -
+ */ + public okhttp3.Call deleteCredentialsGroupAsync( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String groupId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + deleteCredentialsGroupValidateBeforeCall(projectId, groupId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for deleteDefaultRetention + * + * @param projectId STACKIT project ID (required) + * @param bucketName The name has to be dns-conform. (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 -
404 Not Found -
409 Conflict -
500 Internal Server Error -
+ */ + public okhttp3.Call deleteDefaultRetentionCall( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String bucketName, + 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/project/{projectId}/bucket/{bucketName}/default-retention" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "bucketName" + "}", + localVarApiClient.escapeString(bucketName.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, + "DELETE", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteDefaultRetentionValidateBeforeCall( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String bucketName, + 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 deleteDefaultRetention(Async)"); + } + + // verify the required parameter 'bucketName' is set + if (bucketName == null) { + throw new ApiException( + "Missing the required parameter 'bucketName' when calling deleteDefaultRetention(Async)"); + } + + return deleteDefaultRetentionCall(projectId, bucketName, _callback); + } + + /** + * Delete Default Retention Remove the default retention from a bucket. Object Lock itself + * remains enabled. + * + * @param projectId STACKIT project ID (required) + * @param bucketName The name has to be dns-conform. (required) + * @return DeleteDefaultRetentionResponse + * @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 -
404 Not Found -
409 Conflict -
500 Internal Server Error -
+ */ + public DeleteDefaultRetentionResponse deleteDefaultRetention( + @javax.annotation.Nonnull String projectId, @javax.annotation.Nonnull String bucketName) + throws ApiException { + ApiResponse localVarResp = + deleteDefaultRetentionWithHttpInfo(projectId, bucketName); + return localVarResp.getData(); + } + + /** + * Delete Default Retention Remove the default retention from a bucket. Object Lock itself + * remains enabled. + * + * @param projectId STACKIT project ID (required) + * @param bucketName The name has to be dns-conform. (required) + * @return ApiResponse<DeleteDefaultRetentionResponse> + * @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 -
404 Not Found -
409 Conflict -
500 Internal Server Error -
+ */ + public ApiResponse deleteDefaultRetentionWithHttpInfo( + @javax.annotation.Nonnull String projectId, @javax.annotation.Nonnull String bucketName) + throws ApiException { + okhttp3.Call localVarCall = + deleteDefaultRetentionValidateBeforeCall(projectId, bucketName, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Delete Default Retention (asynchronously) Remove the default retention from a bucket. Object + * Lock itself remains enabled. + * + * @param projectId STACKIT project ID (required) + * @param bucketName The name has to be dns-conform. (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 -
404 Not Found -
409 Conflict -
500 Internal Server Error -
+ */ + public okhttp3.Call deleteDefaultRetentionAsync( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String bucketName, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + deleteDefaultRetentionValidateBeforeCall(projectId, bucketName, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for disableService + * + * @param projectId STACKIT 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 Successful Response -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
409 Conflict -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call disableServiceCall( + @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/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 = {}; + 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 disableServiceValidateBeforeCall( + @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 disableService(Async)"); + } + + return disableServiceCall(projectId, _callback); + } + + /** + * Delete Project Delete the given project + * + * @param projectId STACKIT project ID (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 -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
409 Conflict -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public ProjectStatus disableService(@javax.annotation.Nonnull String projectId) + throws ApiException { + ApiResponse localVarResp = disableServiceWithHttpInfo(projectId); + return localVarResp.getData(); + } + + /** + * Delete Project Delete the given project + * + * @param projectId STACKIT project ID (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 -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
409 Conflict -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public ApiResponse disableServiceWithHttpInfo( + @javax.annotation.Nonnull String projectId) throws ApiException { + okhttp3.Call localVarCall = disableServiceValidateBeforeCall(projectId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Delete Project (asynchronously) Delete the given project + * + * @param projectId STACKIT 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 Successful Response -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
409 Conflict -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call disableServiceAsync( + @javax.annotation.Nonnull String projectId, final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = disableServiceValidateBeforeCall(projectId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for enableService + * + * @param projectId STACKIT 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 OK -
201 Successful Response -
401 Unauthorized -
403 Forbidden -
409 Conflict -
422 Validation Error -
500 Internal Server Error -
+ */ + public okhttp3.Call enableServiceCall( + @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/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 = {}; + 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 enableServiceValidateBeforeCall( + @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 enableService(Async)"); + } + + return enableServiceCall(projectId, _callback); + } + + /** + * Create Project Create a project. Creation will also be successful if the project already + * exists, but will not create a duplicate + * + * @param projectId STACKIT project ID (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 OK -
201 Successful Response -
401 Unauthorized -
403 Forbidden -
409 Conflict -
422 Validation Error -
500 Internal Server Error -
+ */ + public ProjectStatus enableService(@javax.annotation.Nonnull String projectId) + throws ApiException { + ApiResponse localVarResp = enableServiceWithHttpInfo(projectId); + return localVarResp.getData(); + } + + /** + * Create Project Create a project. Creation will also be successful if the project already + * exists, but will not create a duplicate + * + * @param projectId STACKIT project ID (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 OK -
201 Successful Response -
401 Unauthorized -
403 Forbidden -
409 Conflict -
422 Validation Error -
500 Internal Server Error -
+ */ + public ApiResponse enableServiceWithHttpInfo( + @javax.annotation.Nonnull String projectId) throws ApiException { + okhttp3.Call localVarCall = enableServiceValidateBeforeCall(projectId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create Project (asynchronously) Create a project. Creation will also be successful if the + * project already exists, but will not create a duplicate + * + * @param projectId STACKIT 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 OK -
201 Successful Response -
401 Unauthorized -
403 Forbidden -
409 Conflict -
422 Validation Error -
500 Internal Server Error -
+ */ + public okhttp3.Call enableServiceAsync( + @javax.annotation.Nonnull String projectId, final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = enableServiceValidateBeforeCall(projectId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getBucket + * + * @param projectId STACKIT project ID (required) + * @param bucketName The name has to be dns-conform. (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 -
500 Internal Server Error -
+ */ + public okhttp3.Call getBucketCall( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String bucketName, + 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/project/{projectId}/bucket/{bucketName}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "bucketName" + "}", + localVarApiClient.escapeString(bucketName.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 getBucketValidateBeforeCall( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String bucketName, + 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 getBucket(Async)"); + } + + // verify the required parameter 'bucketName' is set + if (bucketName == null) { + throw new ApiException( + "Missing the required parameter 'bucketName' when calling getBucket(Async)"); + } + + return getBucketCall(projectId, bucketName, _callback); + } + + /** + * Get Bucket Get information for the given bucket in the project. + * + * @param projectId STACKIT project ID (required) + * @param bucketName The name has to be dns-conform. (required) + * @return GetBucketResponse + * @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 -
500 Internal Server Error -
+ */ + public GetBucketResponse getBucket( + @javax.annotation.Nonnull String projectId, @javax.annotation.Nonnull String bucketName) + throws ApiException { + ApiResponse localVarResp = getBucketWithHttpInfo(projectId, bucketName); + return localVarResp.getData(); + } + + /** + * Get Bucket Get information for the given bucket in the project. + * + * @param projectId STACKIT project ID (required) + * @param bucketName The name has to be dns-conform. (required) + * @return ApiResponse<GetBucketResponse> + * @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 -
500 Internal Server Error -
+ */ + public ApiResponse getBucketWithHttpInfo( + @javax.annotation.Nonnull String projectId, @javax.annotation.Nonnull String bucketName) + throws ApiException { + okhttp3.Call localVarCall = getBucketValidateBeforeCall(projectId, bucketName, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Bucket (asynchronously) Get information for the given bucket in the project. + * + * @param projectId STACKIT project ID (required) + * @param bucketName The name has to be dns-conform. (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 -
500 Internal Server Error -
+ */ + public okhttp3.Call getBucketAsync( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String bucketName, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = getBucketValidateBeforeCall(projectId, bucketName, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getComplianceLock + * + * @param projectId STACKIT 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 Successful Response -
404 Not Found -
500 Internal Server Error -
+ */ + public okhttp3.Call getComplianceLockCall( + @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/project/{projectId}/compliance-lock" + .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 getComplianceLockValidateBeforeCall( + @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 getComplianceLock(Async)"); + } + + return getComplianceLockCall(projectId, _callback); + } + + /** + * Get Compliance Lock Get the project-level compliance lock. + * + * @param projectId STACKIT project ID (required) + * @return ComplianceLockResponse + * @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 -
404 Not Found -
500 Internal Server Error -
+ */ + public ComplianceLockResponse getComplianceLock(@javax.annotation.Nonnull String projectId) + throws ApiException { + ApiResponse localVarResp = getComplianceLockWithHttpInfo(projectId); + return localVarResp.getData(); + } + + /** + * Get Compliance Lock Get the project-level compliance lock. + * + * @param projectId STACKIT project ID (required) + * @return ApiResponse<ComplianceLockResponse> + * @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 -
404 Not Found -
500 Internal Server Error -
+ */ + public ApiResponse getComplianceLockWithHttpInfo( + @javax.annotation.Nonnull String projectId) throws ApiException { + okhttp3.Call localVarCall = getComplianceLockValidateBeforeCall(projectId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Compliance Lock (asynchronously) Get the project-level compliance lock. + * + * @param projectId STACKIT 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 Successful Response -
404 Not Found -
500 Internal Server Error -
+ */ + public okhttp3.Call getComplianceLockAsync( + @javax.annotation.Nonnull String projectId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = getComplianceLockValidateBeforeCall(projectId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getCredentialsGroup + * + * @param projectId STACKIT project ID (required) + * @param groupId Id of the credentials group (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 -
404 Not Found -
422 Validation Error -
500 Internal Server Error -
+ */ + public okhttp3.Call getCredentialsGroupCall( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String groupId, + 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/project/{projectId}/credentials-group/{groupId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "groupId" + "}", + localVarApiClient.escapeString(groupId.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 getCredentialsGroupValidateBeforeCall( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String groupId, + 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 getCredentialsGroup(Async)"); + } + + // verify the required parameter 'groupId' is set + if (groupId == null) { + throw new ApiException( + "Missing the required parameter 'groupId' when calling getCredentialsGroup(Async)"); + } + + return getCredentialsGroupCall(projectId, groupId, _callback); + } + + /** + * Get Credentials Group Get the details of a single credentials group + * + * @param projectId STACKIT project ID (required) + * @param groupId Id of the credentials group (required) + * @return GetCredentialsGroupResponse + * @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 -
404 Not Found -
422 Validation Error -
500 Internal Server Error -
+ */ + public GetCredentialsGroupResponse getCredentialsGroup( + @javax.annotation.Nonnull String projectId, @javax.annotation.Nonnull String groupId) + throws ApiException { + ApiResponse localVarResp = + getCredentialsGroupWithHttpInfo(projectId, groupId); + return localVarResp.getData(); + } + + /** + * Get Credentials Group Get the details of a single credentials group + * + * @param projectId STACKIT project ID (required) + * @param groupId Id of the credentials group (required) + * @return ApiResponse<GetCredentialsGroupResponse> + * @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 -
404 Not Found -
422 Validation Error -
500 Internal Server Error -
+ */ + public ApiResponse getCredentialsGroupWithHttpInfo( + @javax.annotation.Nonnull String projectId, @javax.annotation.Nonnull String groupId) + throws ApiException { + okhttp3.Call localVarCall = getCredentialsGroupValidateBeforeCall(projectId, groupId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Credentials Group (asynchronously) Get the details of a single credentials group + * + * @param projectId STACKIT project ID (required) + * @param groupId Id of the credentials group (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 -
404 Not Found -
422 Validation Error -
500 Internal Server Error -
+ */ + public okhttp3.Call getCredentialsGroupAsync( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String groupId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getCredentialsGroupValidateBeforeCall(projectId, groupId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getDefaultRetention + * + * @param projectId STACKIT project ID (required) + * @param bucketName The name has to be dns-conform. (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 -
404 Not Found -
409 Conflict -
500 Internal Server Error -
+ */ + public okhttp3.Call getDefaultRetentionCall( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String bucketName, + 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/project/{projectId}/bucket/{bucketName}/default-retention" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "bucketName" + "}", + localVarApiClient.escapeString(bucketName.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 getDefaultRetentionValidateBeforeCall( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String bucketName, + 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 getDefaultRetention(Async)"); + } + + // verify the required parameter 'bucketName' is set + if (bucketName == null) { + throw new ApiException( + "Missing the required parameter 'bucketName' when calling getDefaultRetention(Async)"); + } + + return getDefaultRetentionCall(projectId, bucketName, _callback); + } + + /** + * Get Default Retention Get the default retention configuration for a bucket. + * + * @param projectId STACKIT project ID (required) + * @param bucketName The name has to be dns-conform. (required) + * @return DefaultRetentionResponse + * @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 -
404 Not Found -
409 Conflict -
500 Internal Server Error -
+ */ + public DefaultRetentionResponse getDefaultRetention( + @javax.annotation.Nonnull String projectId, @javax.annotation.Nonnull String bucketName) + throws ApiException { + ApiResponse localVarResp = + getDefaultRetentionWithHttpInfo(projectId, bucketName); + return localVarResp.getData(); + } + + /** + * Get Default Retention Get the default retention configuration for a bucket. + * + * @param projectId STACKIT project ID (required) + * @param bucketName The name has to be dns-conform. (required) + * @return ApiResponse<DefaultRetentionResponse> + * @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 -
404 Not Found -
409 Conflict -
500 Internal Server Error -
+ */ + public ApiResponse getDefaultRetentionWithHttpInfo( + @javax.annotation.Nonnull String projectId, @javax.annotation.Nonnull String bucketName) + throws ApiException { + okhttp3.Call localVarCall = + getDefaultRetentionValidateBeforeCall(projectId, bucketName, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Default Retention (asynchronously) Get the default retention configuration for a bucket. + * + * @param projectId STACKIT project ID (required) + * @param bucketName The name has to be dns-conform. (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 -
404 Not Found -
409 Conflict -
500 Internal Server Error -
+ */ + public okhttp3.Call getDefaultRetentionAsync( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String bucketName, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getDefaultRetentionValidateBeforeCall(projectId, bucketName, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getServiceStatus + * + * @param projectId STACKIT 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 Successful Response -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Validation Error -
500 Internal Server Error -
+ */ + public okhttp3.Call getServiceStatusCall( + @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/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 = {}; + 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 getServiceStatusValidateBeforeCall( + @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 getServiceStatus(Async)"); + } + + return getServiceStatusCall(projectId, _callback); + } + + /** + * Get Project Get project details. + * + * @param projectId STACKIT project ID (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 -
500 Internal Server Error -
+ */ + public ProjectStatus getServiceStatus(@javax.annotation.Nonnull String projectId) + throws ApiException { + ApiResponse localVarResp = getServiceStatusWithHttpInfo(projectId); + return localVarResp.getData(); + } + + /** + * Get Project Get project details. + * + * @param projectId STACKIT project ID (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 -
500 Internal Server Error -
+ */ + public ApiResponse getServiceStatusWithHttpInfo( + @javax.annotation.Nonnull String projectId) throws ApiException { + okhttp3.Call localVarCall = getServiceStatusValidateBeforeCall(projectId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Project (asynchronously) Get project details. + * + * @param projectId STACKIT 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 Successful Response -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Validation Error -
500 Internal Server Error -
+ */ + public okhttp3.Call getServiceStatusAsync( + @javax.annotation.Nonnull String projectId, final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = getServiceStatusValidateBeforeCall(projectId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listAccessKeys + * + * @param projectId STACKIT project ID (required) + * @param credentialsGroup (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 Successful Response -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Validation Error -
500 Internal Server Error -
+ */ + public okhttp3.Call listAccessKeysCall( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nullable String credentialsGroup, + 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/project/{projectId}/access-keys" + .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(); + + if (credentialsGroup != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("credentials-group", credentialsGroup)); + } + + 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 listAccessKeysValidateBeforeCall( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nullable String credentialsGroup, + 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 listAccessKeys(Async)"); + } + + return listAccessKeysCall(projectId, credentialsGroup, _callback); + } + + /** + * Get Access Keys Get a list of access keys for the given project. + * + * @param projectId STACKIT project ID (required) + * @param credentialsGroup (optional) + * @return ListAccessKeysResponse + * @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 -
500 Internal Server Error -
+ */ + public ListAccessKeysResponse listAccessKeys( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nullable String credentialsGroup) + throws ApiException { + ApiResponse localVarResp = + listAccessKeysWithHttpInfo(projectId, credentialsGroup); + return localVarResp.getData(); + } + + /** + * Get Access Keys Get a list of access keys for the given project. + * + * @param projectId STACKIT project ID (required) + * @param credentialsGroup (optional) + * @return ApiResponse<ListAccessKeysResponse> + * @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 -
500 Internal Server Error -
+ */ + public ApiResponse listAccessKeysWithHttpInfo( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nullable String credentialsGroup) + throws ApiException { + okhttp3.Call localVarCall = + listAccessKeysValidateBeforeCall(projectId, credentialsGroup, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Access Keys (asynchronously) Get a list of access keys for the given project. + * + * @param projectId STACKIT project ID (required) + * @param credentialsGroup (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 Successful Response -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Validation Error -
500 Internal Server Error -
+ */ + public okhttp3.Call listAccessKeysAsync( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nullable String credentialsGroup, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listAccessKeysValidateBeforeCall(projectId, credentialsGroup, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listBuckets + * + * @param projectId STACKIT 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 Successful Response -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Validation Error -
500 Internal Server Error -
+ */ + public okhttp3.Call listBucketsCall( + @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/project/{projectId}/buckets" + .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 listBucketsValidateBeforeCall( + @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 listBuckets(Async)"); + } + + return listBucketsCall(projectId, _callback); + } + + /** + * Get Buckets Get the list of all buckets in the given project + * + * @param projectId STACKIT project ID (required) + * @return ListBucketsResponse + * @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 -
500 Internal Server Error -
+ */ + public ListBucketsResponse listBuckets(@javax.annotation.Nonnull String projectId) + throws ApiException { + ApiResponse localVarResp = listBucketsWithHttpInfo(projectId); + return localVarResp.getData(); + } + + /** + * Get Buckets Get the list of all buckets in the given project + * + * @param projectId STACKIT project ID (required) + * @return ApiResponse<ListBucketsResponse> + * @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 -
500 Internal Server Error -
+ */ + public ApiResponse listBucketsWithHttpInfo( + @javax.annotation.Nonnull String projectId) throws ApiException { + okhttp3.Call localVarCall = listBucketsValidateBeforeCall(projectId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Buckets (asynchronously) Get the list of all buckets in the given project + * + * @param projectId STACKIT 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 Successful Response -
401 Unauthorized -
403 Forbidden -
404 Not Found -
422 Validation Error -
500 Internal Server Error -
+ */ + public okhttp3.Call listBucketsAsync( + @javax.annotation.Nonnull String projectId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = listBucketsValidateBeforeCall(projectId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listCredentialsGroups + * + * @param projectId STACKIT 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 Successful Response -
401 Unauthorized -
404 Not Found -
422 Validation Error -
500 Internal Server Error -
+ */ + public okhttp3.Call listCredentialsGroupsCall( + @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/project/{projectId}/credentials-groups" + .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 listCredentialsGroupsValidateBeforeCall( + @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 listCredentialsGroups(Async)"); + } + + return listCredentialsGroupsCall(projectId, _callback); + } + + /** + * Get Credentials Groups Get credentials groups inside a project if the project exists + * + * @param projectId STACKIT project ID (required) + * @return ListCredentialsGroupsResponse + * @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 -
404 Not Found -
422 Validation Error -
500 Internal Server Error -
+ */ + public ListCredentialsGroupsResponse listCredentialsGroups( + @javax.annotation.Nonnull String projectId) throws ApiException { + ApiResponse localVarResp = + listCredentialsGroupsWithHttpInfo(projectId); + return localVarResp.getData(); + } + + /** + * Get Credentials Groups Get credentials groups inside a project if the project exists + * + * @param projectId STACKIT project ID (required) + * @return ApiResponse<ListCredentialsGroupsResponse> + * @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 -
404 Not Found -
422 Validation Error -
500 Internal Server Error -
+ */ + public ApiResponse listCredentialsGroupsWithHttpInfo( + @javax.annotation.Nonnull String projectId) throws ApiException { + okhttp3.Call localVarCall = listCredentialsGroupsValidateBeforeCall(projectId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Credentials Groups (asynchronously) Get credentials groups inside a project if the + * project exists + * + * @param projectId STACKIT 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 Successful Response -
401 Unauthorized -
404 Not Found -
422 Validation Error -
500 Internal Server Error -
+ */ + public okhttp3.Call listCredentialsGroupsAsync( + @javax.annotation.Nonnull String projectId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = listCredentialsGroupsValidateBeforeCall(projectId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for setDefaultRetention + * + * @param projectId STACKIT project ID (required) + * @param bucketName The name has to be dns-conform. (required) + * @param setDefaultRetentionPayload (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 -
400 Bad Request -
404 Not Found -
409 Conflict -
500 Internal Server Error -
+ */ + public okhttp3.Call setDefaultRetentionCall( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String bucketName, + @javax.annotation.Nonnull SetDefaultRetentionPayload setDefaultRetentionPayload, + 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 = setDefaultRetentionPayload; + + // create path and map variables + String localVarPath = + "/v1/project/{projectId}/bucket/{bucketName}/default-retention" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "bucketName" + "}", + localVarApiClient.escapeString(bucketName.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 setDefaultRetentionValidateBeforeCall( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String bucketName, + @javax.annotation.Nonnull SetDefaultRetentionPayload setDefaultRetentionPayload, + 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 setDefaultRetention(Async)"); + } + + // verify the required parameter 'bucketName' is set + if (bucketName == null) { + throw new ApiException( + "Missing the required parameter 'bucketName' when calling setDefaultRetention(Async)"); + } + + // verify the required parameter 'setDefaultRetentionPayload' is set + if (setDefaultRetentionPayload == null) { + throw new ApiException( + "Missing the required parameter 'setDefaultRetentionPayload' when calling setDefaultRetention(Async)"); + } + + return setDefaultRetentionCall( + projectId, bucketName, setDefaultRetentionPayload, _callback); + } + + /** + * Update Default Retention Set or update the default retention for a bucket. + * + * @param projectId STACKIT project ID (required) + * @param bucketName The name has to be dns-conform. (required) + * @param setDefaultRetentionPayload (required) + * @return DefaultRetentionResponse + * @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 -
400 Bad Request -
404 Not Found -
409 Conflict -
500 Internal Server Error -
+ */ + public DefaultRetentionResponse setDefaultRetention( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String bucketName, + @javax.annotation.Nonnull SetDefaultRetentionPayload setDefaultRetentionPayload) + throws ApiException { + ApiResponse localVarResp = + setDefaultRetentionWithHttpInfo(projectId, bucketName, setDefaultRetentionPayload); + return localVarResp.getData(); + } + + /** + * Update Default Retention Set or update the default retention for a bucket. + * + * @param projectId STACKIT project ID (required) + * @param bucketName The name has to be dns-conform. (required) + * @param setDefaultRetentionPayload (required) + * @return ApiResponse<DefaultRetentionResponse> + * @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 -
400 Bad Request -
404 Not Found -
409 Conflict -
500 Internal Server Error -
+ */ + public ApiResponse setDefaultRetentionWithHttpInfo( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String bucketName, + @javax.annotation.Nonnull SetDefaultRetentionPayload setDefaultRetentionPayload) + throws ApiException { + okhttp3.Call localVarCall = + setDefaultRetentionValidateBeforeCall( + projectId, bucketName, setDefaultRetentionPayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update Default Retention (asynchronously) Set or update the default retention for a bucket. + * + * @param projectId STACKIT project ID (required) + * @param bucketName The name has to be dns-conform. (required) + * @param setDefaultRetentionPayload (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 -
400 Bad Request -
404 Not Found -
409 Conflict -
500 Internal Server Error -
+ */ + public okhttp3.Call setDefaultRetentionAsync( + @javax.annotation.Nonnull String projectId, + @javax.annotation.Nonnull String bucketName, + @javax.annotation.Nonnull SetDefaultRetentionPayload setDefaultRetentionPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + setDefaultRetentionValidateBeforeCall( + projectId, bucketName, setDefaultRetentionPayload, _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/api/ObjectStorageApi.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/api/ObjectStorageApi.java new file mode 100644 index 00000000..6df2f4df --- /dev/null +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/api/ObjectStorageApi.java @@ -0,0 +1,64 @@ +/* + * 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.api; + +import cloud.stackit.sdk.core.config.CoreConfiguration; +import java.io.IOException; +import okhttp3.OkHttpClient; + +public class ObjectStorageApi extends DefaultApi { + /** + * Basic constructor for ObjectStorageApi + * + *

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

For production use consider using the constructor with the OkHttpClient parameter. + * + * @param configuration your STACKIT SDK CoreConfiguration + * @throws IOException + */ + public ObjectStorageApi(CoreConfiguration configuration) throws IOException { + super(configuration); + } + + /** + * Constructor for ObjectStorageApi + * + * @param httpClient OkHttpClient object + * @throws IOException + */ + public ObjectStorageApi(OkHttpClient httpClient) throws IOException { + super(httpClient); + } + + /** + * Constructor for ObjectStorageApi + * + * @param httpClient OkHttpClient object + * @param configuration your STACKIT SDK CoreConfiguration + * @throws IOException + */ + public ObjectStorageApi(OkHttpClient httpClient, CoreConfiguration configuration) + throws IOException { + super(httpClient, configuration); + } +} diff --git a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/AbstractOpenApiSchema.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/AbstractOpenApiSchema.java new file mode 100644 index 00000000..f72cd86f --- /dev/null +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/AbstractOpenApiSchema.java @@ -0,0 +1,145 @@ +/* + * 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 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/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/AccessKey.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/AccessKey.java new file mode 100644 index 00000000..5f459f88 --- /dev/null +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/AccessKey.java @@ -0,0 +1,375 @@ +/* + * 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; + +/** AccessKey */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class AccessKey { + public static final String SERIALIZED_NAME_DISPLAY_NAME = "displayName"; + + @SerializedName(SERIALIZED_NAME_DISPLAY_NAME) + @javax.annotation.Nonnull + private String displayName; + + public static final String SERIALIZED_NAME_EXPIRES = "expires"; + + @SerializedName(SERIALIZED_NAME_EXPIRES) + @javax.annotation.Nonnull + private String expires; + + public static final String SERIALIZED_NAME_KEY_ID = "keyId"; + + @SerializedName(SERIALIZED_NAME_KEY_ID) + @javax.annotation.Nonnull + private String keyId; + + public AccessKey() {} + + public AccessKey displayName(@javax.annotation.Nonnull String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get displayName + * + * @return displayName + */ + @javax.annotation.Nonnull + public String getDisplayName() { + return displayName; + } + + public void setDisplayName(@javax.annotation.Nonnull String displayName) { + this.displayName = displayName; + } + + public AccessKey expires(@javax.annotation.Nonnull String expires) { + this.expires = expires; + return this; + } + + /** + * Get expires + * + * @return expires + */ + @javax.annotation.Nonnull + public String getExpires() { + return expires; + } + + public void setExpires(@javax.annotation.Nonnull String expires) { + this.expires = expires; + } + + public AccessKey keyId(@javax.annotation.Nonnull String keyId) { + this.keyId = keyId; + return this; + } + + /** + * Identifies the pair of access key and secret access key for deletion + * + * @return keyId + */ + @javax.annotation.Nonnull + public String getKeyId() { + return keyId; + } + + public void setKeyId(@javax.annotation.Nonnull String keyId) { + this.keyId = keyId; + } + + /** + * 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 AccessKey instance itself + */ + public AccessKey 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; + } + AccessKey accessKey = (AccessKey) o; + return Objects.equals(this.displayName, accessKey.displayName) + && Objects.equals(this.expires, accessKey.expires) + && Objects.equals(this.keyId, accessKey.keyId) + && Objects.equals(this.additionalProperties, accessKey.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(displayName, expires, keyId, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AccessKey {\n"); + sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); + sb.append(" expires: ").append(toIndentedString(expires)).append("\n"); + sb.append(" keyId: ").append(toIndentedString(keyId)).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("displayName", "expires", "keyId")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = + new HashSet(Arrays.asList("displayName", "expires", "keyId")); + } + + /** + * 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 AccessKey + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AccessKey.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 AccessKey is not found in the empty JSON string", + AccessKey.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AccessKey.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("displayName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `displayName` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("displayName").toString())); + } + if (!jsonObj.get("expires").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `expires` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("expires").toString())); + } + if (!jsonObj.get("keyId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `keyId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("keyId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AccessKey.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AccessKey' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(AccessKey.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AccessKey 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 AccessKey read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AccessKey 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 AccessKey given an JSON string + * + * @param jsonString JSON string + * @return An instance of AccessKey + * @throws IOException if the JSON string is invalid with respect to AccessKey + */ + public static AccessKey fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AccessKey.class); + } + + /** + * Convert an instance of AccessKey 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/v1api/model/Bucket.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/Bucket.java new file mode 100644 index 00000000..e1afaf01 --- /dev/null +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/Bucket.java @@ -0,0 +1,459 @@ +/* + * 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; + +/** Bucket */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class Bucket { + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_OBJECT_LOCK_ENABLED = "objectLockEnabled"; + + @SerializedName(SERIALIZED_NAME_OBJECT_LOCK_ENABLED) + @javax.annotation.Nonnull + private Boolean objectLockEnabled; + + public static final String SERIALIZED_NAME_REGION = "region"; + + @SerializedName(SERIALIZED_NAME_REGION) + @javax.annotation.Nonnull + private String region; + + public static final String SERIALIZED_NAME_URL_PATH_STYLE = "urlPathStyle"; + + @SerializedName(SERIALIZED_NAME_URL_PATH_STYLE) + @javax.annotation.Nonnull + private String urlPathStyle; + + public static final String SERIALIZED_NAME_URL_VIRTUAL_HOSTED_STYLE = "urlVirtualHostedStyle"; + + @SerializedName(SERIALIZED_NAME_URL_VIRTUAL_HOSTED_STYLE) + @javax.annotation.Nonnull + private String urlVirtualHostedStyle; + + public Bucket() {} + + public Bucket 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 Bucket objectLockEnabled(@javax.annotation.Nonnull Boolean objectLockEnabled) { + this.objectLockEnabled = objectLockEnabled; + return this; + } + + /** + * Whether S3 Object Lock is enabled for this bucket + * + * @return objectLockEnabled + */ + @javax.annotation.Nonnull + public Boolean getObjectLockEnabled() { + return objectLockEnabled; + } + + public void setObjectLockEnabled(@javax.annotation.Nonnull Boolean objectLockEnabled) { + this.objectLockEnabled = objectLockEnabled; + } + + public Bucket region(@javax.annotation.Nonnull String region) { + this.region = region; + return this; + } + + /** + * Get region + * + * @return region + */ + @javax.annotation.Nonnull + public String getRegion() { + return region; + } + + public void setRegion(@javax.annotation.Nonnull String region) { + this.region = region; + } + + public Bucket urlPathStyle(@javax.annotation.Nonnull String urlPathStyle) { + this.urlPathStyle = urlPathStyle; + return this; + } + + /** + * URL in path style + * + * @return urlPathStyle + */ + @javax.annotation.Nonnull + public String getUrlPathStyle() { + return urlPathStyle; + } + + public void setUrlPathStyle(@javax.annotation.Nonnull String urlPathStyle) { + this.urlPathStyle = urlPathStyle; + } + + public Bucket urlVirtualHostedStyle(@javax.annotation.Nonnull String urlVirtualHostedStyle) { + this.urlVirtualHostedStyle = urlVirtualHostedStyle; + return this; + } + + /** + * URL in virtual hosted style + * + * @return urlVirtualHostedStyle + */ + @javax.annotation.Nonnull + public String getUrlVirtualHostedStyle() { + return urlVirtualHostedStyle; + } + + public void setUrlVirtualHostedStyle(@javax.annotation.Nonnull String urlVirtualHostedStyle) { + this.urlVirtualHostedStyle = urlVirtualHostedStyle; + } + + /** + * 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 Bucket instance itself + */ + public Bucket 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; + } + Bucket bucket = (Bucket) o; + return Objects.equals(this.name, bucket.name) + && Objects.equals(this.objectLockEnabled, bucket.objectLockEnabled) + && Objects.equals(this.region, bucket.region) + && Objects.equals(this.urlPathStyle, bucket.urlPathStyle) + && Objects.equals(this.urlVirtualHostedStyle, bucket.urlVirtualHostedStyle) + && Objects.equals(this.additionalProperties, bucket.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + name, + objectLockEnabled, + region, + urlPathStyle, + urlVirtualHostedStyle, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Bucket {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" objectLockEnabled: ") + .append(toIndentedString(objectLockEnabled)) + .append("\n"); + sb.append(" region: ").append(toIndentedString(region)).append("\n"); + sb.append(" urlPathStyle: ").append(toIndentedString(urlPathStyle)).append("\n"); + sb.append(" urlVirtualHostedStyle: ") + .append(toIndentedString(urlVirtualHostedStyle)) + .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( + "name", + "objectLockEnabled", + "region", + "urlPathStyle", + "urlVirtualHostedStyle")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = + new HashSet( + Arrays.asList( + "name", + "objectLockEnabled", + "region", + "urlPathStyle", + "urlVirtualHostedStyle")); + } + + /** + * 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 Bucket + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Bucket.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 Bucket is not found in the empty JSON string", + Bucket.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Bucket.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("region").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `region` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("region").toString())); + } + if (!jsonObj.get("urlPathStyle").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `urlPathStyle` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("urlPathStyle").toString())); + } + if (!jsonObj.get("urlVirtualHostedStyle").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `urlVirtualHostedStyle` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("urlVirtualHostedStyle").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Bucket.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Bucket' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(Bucket.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, Bucket 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 Bucket read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Bucket 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 Bucket given an JSON string + * + * @param jsonString JSON string + * @return An instance of Bucket + * @throws IOException if the JSON string is invalid with respect to Bucket + */ + public static Bucket fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Bucket.class); + } + + /** + * Convert an instance of Bucket 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/v1api/model/ComplianceLockResponse.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/ComplianceLockResponse.java new file mode 100644 index 00000000..997c81c1 --- /dev/null +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/ComplianceLockResponse.java @@ -0,0 +1,336 @@ +/* + * 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; + +/** ComplianceLockResponse */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class ComplianceLockResponse { + public static final String SERIALIZED_NAME_MAX_RETENTION_DAYS = "maxRetentionDays"; + + @SerializedName(SERIALIZED_NAME_MAX_RETENTION_DAYS) + @javax.annotation.Nonnull + private Integer maxRetentionDays; + + public static final String SERIALIZED_NAME_PROJECT = "project"; + + @SerializedName(SERIALIZED_NAME_PROJECT) + @javax.annotation.Nonnull + private String project; + + public ComplianceLockResponse() {} + + public ComplianceLockResponse maxRetentionDays( + @javax.annotation.Nonnull Integer maxRetentionDays) { + this.maxRetentionDays = maxRetentionDays; + return this; + } + + /** + * Maximum retention period in days + * + * @return maxRetentionDays + */ + @javax.annotation.Nonnull + public Integer getMaxRetentionDays() { + return maxRetentionDays; + } + + public void setMaxRetentionDays(@javax.annotation.Nonnull Integer maxRetentionDays) { + this.maxRetentionDays = maxRetentionDays; + } + + public ComplianceLockResponse project(@javax.annotation.Nonnull String project) { + this.project = project; + return this; + } + + /** + * Project ID + * + * @return project + */ + @javax.annotation.Nonnull + public String getProject() { + return project; + } + + public void setProject(@javax.annotation.Nonnull String project) { + this.project = project; + } + + /** + * 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 ComplianceLockResponse instance itself + */ + public ComplianceLockResponse 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; + } + ComplianceLockResponse complianceLockResponse = (ComplianceLockResponse) o; + return Objects.equals(this.maxRetentionDays, complianceLockResponse.maxRetentionDays) + && Objects.equals(this.project, complianceLockResponse.project) + && Objects.equals( + this.additionalProperties, complianceLockResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(maxRetentionDays, project, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ComplianceLockResponse {\n"); + sb.append(" maxRetentionDays: ").append(toIndentedString(maxRetentionDays)).append("\n"); + sb.append(" project: ").append(toIndentedString(project)).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("maxRetentionDays", "project")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("maxRetentionDays", "project")); + } + + /** + * 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 ComplianceLockResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ComplianceLockResponse.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 ComplianceLockResponse is not found in the empty JSON string", + ComplianceLockResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ComplianceLockResponse.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("project").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `project` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("project").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ComplianceLockResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ComplianceLockResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ComplianceLockResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ComplianceLockResponse 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 ComplianceLockResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ComplianceLockResponse 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 ComplianceLockResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ComplianceLockResponse + * @throws IOException if the JSON string is invalid with respect to ComplianceLockResponse + */ + public static ComplianceLockResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ComplianceLockResponse.class); + } + + /** + * Convert an instance of ComplianceLockResponse 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/v1api/model/CreateAccessKeyPayload.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/CreateAccessKeyPayload.java new file mode 100644 index 00000000..48c40372 --- /dev/null +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/CreateAccessKeyPayload.java @@ -0,0 +1,288 @@ +/* + * 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.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** CreateAccessKeyPayload */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateAccessKeyPayload { + public static final String SERIALIZED_NAME_EXPIRES = "expires"; + + @SerializedName(SERIALIZED_NAME_EXPIRES) + @javax.annotation.Nullable private OffsetDateTime expires; + + public CreateAccessKeyPayload() {} + + public CreateAccessKeyPayload expires(@javax.annotation.Nullable OffsetDateTime expires) { + this.expires = expires; + return this; + } + + /** + * Expiration date. Null means never expires. + * + * @return expires + */ + @javax.annotation.Nullable public OffsetDateTime getExpires() { + return expires; + } + + public void setExpires(@javax.annotation.Nullable OffsetDateTime expires) { + this.expires = expires; + } + + /** + * 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 CreateAccessKeyPayload instance itself + */ + public CreateAccessKeyPayload 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; + } + CreateAccessKeyPayload createAccessKeyPayload = (CreateAccessKeyPayload) o; + return Objects.equals(this.expires, createAccessKeyPayload.expires) + && Objects.equals( + this.additionalProperties, createAccessKeyPayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(expires, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateAccessKeyPayload {\n"); + sb.append(" expires: ").append(toIndentedString(expires)).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("expires")); + + // 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 CreateAccessKeyPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateAccessKeyPayload.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 CreateAccessKeyPayload is not found in the empty JSON string", + CreateAccessKeyPayload.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateAccessKeyPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateAccessKeyPayload' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateAccessKeyPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateAccessKeyPayload 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 CreateAccessKeyPayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateAccessKeyPayload 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 CreateAccessKeyPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateAccessKeyPayload + * @throws IOException if the JSON string is invalid with respect to CreateAccessKeyPayload + */ + public static CreateAccessKeyPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateAccessKeyPayload.class); + } + + /** + * Convert an instance of CreateAccessKeyPayload 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/v1api/model/CreateAccessKeyResponse.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/CreateAccessKeyResponse.java new file mode 100644 index 00000000..2e5ab46f --- /dev/null +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/CreateAccessKeyResponse.java @@ -0,0 +1,503 @@ +/* + * 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; + +/** CreateAccessKeyResponse */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateAccessKeyResponse { + public static final String SERIALIZED_NAME_ACCESS_KEY = "accessKey"; + + @SerializedName(SERIALIZED_NAME_ACCESS_KEY) + @javax.annotation.Nonnull + private String accessKey; + + public static final String SERIALIZED_NAME_DISPLAY_NAME = "displayName"; + + @SerializedName(SERIALIZED_NAME_DISPLAY_NAME) + @javax.annotation.Nonnull + private String displayName; + + public static final String SERIALIZED_NAME_EXPIRES = "expires"; + + @SerializedName(SERIALIZED_NAME_EXPIRES) + @javax.annotation.Nonnull + private String expires; + + public static final String SERIALIZED_NAME_KEY_ID = "keyId"; + + @SerializedName(SERIALIZED_NAME_KEY_ID) + @javax.annotation.Nonnull + private String keyId; + + public static final String SERIALIZED_NAME_PROJECT = "project"; + + @SerializedName(SERIALIZED_NAME_PROJECT) + @javax.annotation.Nonnull + private String project; + + public static final String SERIALIZED_NAME_SECRET_ACCESS_KEY = "secretAccessKey"; + + @SerializedName(SERIALIZED_NAME_SECRET_ACCESS_KEY) + @javax.annotation.Nonnull + private String secretAccessKey; + + public CreateAccessKeyResponse() {} + + public CreateAccessKeyResponse accessKey(@javax.annotation.Nonnull String accessKey) { + this.accessKey = accessKey; + return this; + } + + /** + * Access key + * + * @return accessKey + */ + @javax.annotation.Nonnull + public String getAccessKey() { + return accessKey; + } + + public void setAccessKey(@javax.annotation.Nonnull String accessKey) { + this.accessKey = accessKey; + } + + public CreateAccessKeyResponse displayName(@javax.annotation.Nonnull String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Obfuscated access key + * + * @return displayName + */ + @javax.annotation.Nonnull + public String getDisplayName() { + return displayName; + } + + public void setDisplayName(@javax.annotation.Nonnull String displayName) { + this.displayName = displayName; + } + + public CreateAccessKeyResponse expires(@javax.annotation.Nonnull String expires) { + this.expires = expires; + return this; + } + + /** + * Expiration date. Null means never expires. + * + * @return expires + */ + @javax.annotation.Nonnull + public String getExpires() { + return expires; + } + + public void setExpires(@javax.annotation.Nonnull String expires) { + this.expires = expires; + } + + public CreateAccessKeyResponse keyId(@javax.annotation.Nonnull String keyId) { + this.keyId = keyId; + return this; + } + + /** + * Identifies the pair of access key and secret access key for deletion + * + * @return keyId + */ + @javax.annotation.Nonnull + public String getKeyId() { + return keyId; + } + + public void setKeyId(@javax.annotation.Nonnull String keyId) { + this.keyId = keyId; + } + + public CreateAccessKeyResponse project(@javax.annotation.Nonnull String project) { + this.project = project; + return this; + } + + /** + * Project ID + * + * @return project + */ + @javax.annotation.Nonnull + public String getProject() { + return project; + } + + public void setProject(@javax.annotation.Nonnull String project) { + this.project = project; + } + + public CreateAccessKeyResponse secretAccessKey( + @javax.annotation.Nonnull String secretAccessKey) { + this.secretAccessKey = secretAccessKey; + return this; + } + + /** + * Secret access key + * + * @return secretAccessKey + */ + @javax.annotation.Nonnull + public String getSecretAccessKey() { + return secretAccessKey; + } + + public void setSecretAccessKey(@javax.annotation.Nonnull String secretAccessKey) { + this.secretAccessKey = secretAccessKey; + } + + /** + * 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 CreateAccessKeyResponse instance itself + */ + public CreateAccessKeyResponse 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; + } + CreateAccessKeyResponse createAccessKeyResponse = (CreateAccessKeyResponse) o; + return Objects.equals(this.accessKey, createAccessKeyResponse.accessKey) + && Objects.equals(this.displayName, createAccessKeyResponse.displayName) + && Objects.equals(this.expires, createAccessKeyResponse.expires) + && Objects.equals(this.keyId, createAccessKeyResponse.keyId) + && Objects.equals(this.project, createAccessKeyResponse.project) + && Objects.equals(this.secretAccessKey, createAccessKeyResponse.secretAccessKey) + && Objects.equals( + this.additionalProperties, createAccessKeyResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + accessKey, + displayName, + expires, + keyId, + project, + secretAccessKey, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateAccessKeyResponse {\n"); + sb.append(" accessKey: ").append(toIndentedString(accessKey)).append("\n"); + sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); + sb.append(" expires: ").append(toIndentedString(expires)).append("\n"); + sb.append(" keyId: ").append(toIndentedString(keyId)).append("\n"); + sb.append(" project: ").append(toIndentedString(project)).append("\n"); + sb.append(" secretAccessKey: ").append(toIndentedString(secretAccessKey)).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( + "accessKey", + "displayName", + "expires", + "keyId", + "project", + "secretAccessKey")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = + new HashSet( + Arrays.asList( + "accessKey", + "displayName", + "expires", + "keyId", + "project", + "secretAccessKey")); + } + + /** + * 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 CreateAccessKeyResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateAccessKeyResponse.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 CreateAccessKeyResponse is not found in the empty JSON string", + CreateAccessKeyResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateAccessKeyResponse.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("accessKey").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `accessKey` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("accessKey").toString())); + } + if (!jsonObj.get("displayName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `displayName` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("displayName").toString())); + } + if (!jsonObj.get("expires").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `expires` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("expires").toString())); + } + if (!jsonObj.get("keyId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `keyId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("keyId").toString())); + } + if (!jsonObj.get("project").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `project` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("project").toString())); + } + if (!jsonObj.get("secretAccessKey").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `secretAccessKey` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("secretAccessKey").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateAccessKeyResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateAccessKeyResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateAccessKeyResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateAccessKeyResponse 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 CreateAccessKeyResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateAccessKeyResponse 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 CreateAccessKeyResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateAccessKeyResponse + * @throws IOException if the JSON string is invalid with respect to CreateAccessKeyResponse + */ + public static CreateAccessKeyResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateAccessKeyResponse.class); + } + + /** + * Convert an instance of CreateAccessKeyResponse 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/v1api/model/CreateBucketResponse.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/CreateBucketResponse.java new file mode 100644 index 00000000..a42ef2f7 --- /dev/null +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/CreateBucketResponse.java @@ -0,0 +1,342 @@ +/* + * 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; + +/** CreateBucketResponse */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateBucketResponse { + public static final String SERIALIZED_NAME_BUCKET = "bucket"; + + @SerializedName(SERIALIZED_NAME_BUCKET) + @javax.annotation.Nonnull + private String bucket; + + public static final String SERIALIZED_NAME_PROJECT = "project"; + + @SerializedName(SERIALIZED_NAME_PROJECT) + @javax.annotation.Nonnull + private String project; + + public CreateBucketResponse() {} + + public CreateBucketResponse bucket(@javax.annotation.Nonnull String bucket) { + this.bucket = bucket; + return this; + } + + /** + * Name of the bucket + * + * @return bucket + */ + @javax.annotation.Nonnull + public String getBucket() { + return bucket; + } + + public void setBucket(@javax.annotation.Nonnull String bucket) { + this.bucket = bucket; + } + + public CreateBucketResponse project(@javax.annotation.Nonnull String project) { + this.project = project; + return this; + } + + /** + * Project ID + * + * @return project + */ + @javax.annotation.Nonnull + public String getProject() { + return project; + } + + public void setProject(@javax.annotation.Nonnull String project) { + this.project = project; + } + + /** + * 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 CreateBucketResponse instance itself + */ + public CreateBucketResponse 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; + } + CreateBucketResponse createBucketResponse = (CreateBucketResponse) o; + return Objects.equals(this.bucket, createBucketResponse.bucket) + && Objects.equals(this.project, createBucketResponse.project) + && Objects.equals( + this.additionalProperties, createBucketResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(bucket, project, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateBucketResponse {\n"); + sb.append(" bucket: ").append(toIndentedString(bucket)).append("\n"); + sb.append(" project: ").append(toIndentedString(project)).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("bucket", "project")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("bucket", "project")); + } + + /** + * 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 CreateBucketResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateBucketResponse.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 CreateBucketResponse is not found in the empty JSON string", + CreateBucketResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateBucketResponse.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("bucket").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `bucket` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("bucket").toString())); + } + if (!jsonObj.get("project").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `project` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("project").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateBucketResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateBucketResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateBucketResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateBucketResponse 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 CreateBucketResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateBucketResponse 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 CreateBucketResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateBucketResponse + * @throws IOException if the JSON string is invalid with respect to CreateBucketResponse + */ + public static CreateBucketResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateBucketResponse.class); + } + + /** + * Convert an instance of CreateBucketResponse 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/v1api/model/CreateCredentialsGroupPayload.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/CreateCredentialsGroupPayload.java new file mode 100644 index 00000000..282ccd2b --- /dev/null +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/CreateCredentialsGroupPayload.java @@ -0,0 +1,316 @@ +/* + * 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; + +/** CreateCredentialsGroupPayload */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateCredentialsGroupPayload { + public static final String SERIALIZED_NAME_DISPLAY_NAME = "displayName"; + + @SerializedName(SERIALIZED_NAME_DISPLAY_NAME) + @javax.annotation.Nonnull + private String displayName; + + public CreateCredentialsGroupPayload() {} + + public CreateCredentialsGroupPayload displayName(@javax.annotation.Nonnull String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Name of the group holding credentials + * + * @return displayName + */ + @javax.annotation.Nonnull + public String getDisplayName() { + return displayName; + } + + public void setDisplayName(@javax.annotation.Nonnull String displayName) { + this.displayName = displayName; + } + + /** + * 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 CreateCredentialsGroupPayload instance itself + */ + public CreateCredentialsGroupPayload 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; + } + CreateCredentialsGroupPayload createCredentialsGroupPayload = + (CreateCredentialsGroupPayload) o; + return Objects.equals(this.displayName, createCredentialsGroupPayload.displayName) + && Objects.equals( + this.additionalProperties, + createCredentialsGroupPayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(displayName, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateCredentialsGroupPayload {\n"); + sb.append(" displayName: ").append(toIndentedString(displayName)).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("displayName")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("displayName")); + } + + /** + * 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 + * CreateCredentialsGroupPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateCredentialsGroupPayload.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 CreateCredentialsGroupPayload is not found in the empty JSON string", + CreateCredentialsGroupPayload.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateCredentialsGroupPayload.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("displayName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `displayName` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("displayName").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateCredentialsGroupPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateCredentialsGroupPayload' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateCredentialsGroupPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateCredentialsGroupPayload 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 CreateCredentialsGroupPayload read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateCredentialsGroupPayload 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 CreateCredentialsGroupPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateCredentialsGroupPayload + * @throws IOException if the JSON string is invalid with respect to + * CreateCredentialsGroupPayload + */ + public static CreateCredentialsGroupPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateCredentialsGroupPayload.class); + } + + /** + * Convert an instance of CreateCredentialsGroupPayload 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/v1api/model/CreateCredentialsGroupResponse.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/CreateCredentialsGroupResponse.java new file mode 100644 index 00000000..55b5090b --- /dev/null +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/CreateCredentialsGroupResponse.java @@ -0,0 +1,347 @@ +/* + * 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; + +/** CreateCredentialsGroupResponse */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateCredentialsGroupResponse { + public static final String SERIALIZED_NAME_CREDENTIALS_GROUP = "credentialsGroup"; + + @SerializedName(SERIALIZED_NAME_CREDENTIALS_GROUP) + @javax.annotation.Nonnull + private CredentialsGroup credentialsGroup; + + public static final String SERIALIZED_NAME_PROJECT = "project"; + + @SerializedName(SERIALIZED_NAME_PROJECT) + @javax.annotation.Nonnull + private String project; + + public CreateCredentialsGroupResponse() {} + + public CreateCredentialsGroupResponse credentialsGroup( + @javax.annotation.Nonnull CredentialsGroup credentialsGroup) { + this.credentialsGroup = credentialsGroup; + return this; + } + + /** + * Get credentialsGroup + * + * @return credentialsGroup + */ + @javax.annotation.Nonnull + public CredentialsGroup getCredentialsGroup() { + return credentialsGroup; + } + + public void setCredentialsGroup(@javax.annotation.Nonnull CredentialsGroup credentialsGroup) { + this.credentialsGroup = credentialsGroup; + } + + public CreateCredentialsGroupResponse project(@javax.annotation.Nonnull String project) { + this.project = project; + return this; + } + + /** + * Project ID + * + * @return project + */ + @javax.annotation.Nonnull + public String getProject() { + return project; + } + + public void setProject(@javax.annotation.Nonnull String project) { + this.project = project; + } + + /** + * 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 CreateCredentialsGroupResponse instance itself + */ + public CreateCredentialsGroupResponse 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; + } + CreateCredentialsGroupResponse createCredentialsGroupResponse = + (CreateCredentialsGroupResponse) o; + return Objects.equals( + this.credentialsGroup, createCredentialsGroupResponse.credentialsGroup) + && Objects.equals(this.project, createCredentialsGroupResponse.project) + && Objects.equals( + this.additionalProperties, + createCredentialsGroupResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(credentialsGroup, project, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateCredentialsGroupResponse {\n"); + sb.append(" credentialsGroup: ").append(toIndentedString(credentialsGroup)).append("\n"); + sb.append(" project: ").append(toIndentedString(project)).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("credentialsGroup", "project")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("credentialsGroup", "project")); + } + + /** + * 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 + * CreateCredentialsGroupResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateCredentialsGroupResponse.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 CreateCredentialsGroupResponse is not found in the empty JSON string", + CreateCredentialsGroupResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateCredentialsGroupResponse.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(); + // validate the required field `credentialsGroup` + CredentialsGroup.validateJsonElement(jsonObj.get("credentialsGroup")); + if (!jsonObj.get("project").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `project` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("project").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateCredentialsGroupResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateCredentialsGroupResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateCredentialsGroupResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateCredentialsGroupResponse 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 CreateCredentialsGroupResponse read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateCredentialsGroupResponse 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 CreateCredentialsGroupResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateCredentialsGroupResponse + * @throws IOException if the JSON string is invalid with respect to + * CreateCredentialsGroupResponse + */ + public static CreateCredentialsGroupResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateCredentialsGroupResponse.class); + } + + /** + * Convert an instance of CreateCredentialsGroupResponse 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/v1api/model/CredentialsGroup.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/CredentialsGroup.java new file mode 100644 index 00000000..9ed9c50f --- /dev/null +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/CredentialsGroup.java @@ -0,0 +1,380 @@ +/* + * 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; + +/** CredentialsGroup */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CredentialsGroup { + public static final String SERIALIZED_NAME_CREDENTIALS_GROUP_ID = "credentialsGroupId"; + + @SerializedName(SERIALIZED_NAME_CREDENTIALS_GROUP_ID) + @javax.annotation.Nonnull + private String credentialsGroupId; + + public static final String SERIALIZED_NAME_DISPLAY_NAME = "displayName"; + + @SerializedName(SERIALIZED_NAME_DISPLAY_NAME) + @javax.annotation.Nonnull + private String displayName; + + public static final String SERIALIZED_NAME_URN = "urn"; + + @SerializedName(SERIALIZED_NAME_URN) + @javax.annotation.Nonnull + private String urn; + + public CredentialsGroup() {} + + public CredentialsGroup credentialsGroupId( + @javax.annotation.Nonnull String credentialsGroupId) { + this.credentialsGroupId = credentialsGroupId; + return this; + } + + /** + * The ID of the credentials group + * + * @return credentialsGroupId + */ + @javax.annotation.Nonnull + public String getCredentialsGroupId() { + return credentialsGroupId; + } + + public void setCredentialsGroupId(@javax.annotation.Nonnull String credentialsGroupId) { + this.credentialsGroupId = credentialsGroupId; + } + + public CredentialsGroup displayName(@javax.annotation.Nonnull String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Name of the group holding credentials + * + * @return displayName + */ + @javax.annotation.Nonnull + public String getDisplayName() { + return displayName; + } + + public void setDisplayName(@javax.annotation.Nonnull String displayName) { + this.displayName = displayName; + } + + public CredentialsGroup urn(@javax.annotation.Nonnull String urn) { + this.urn = urn; + return this; + } + + /** + * Credentials group URN + * + * @return urn + */ + @javax.annotation.Nonnull + public String getUrn() { + return urn; + } + + public void setUrn(@javax.annotation.Nonnull String urn) { + this.urn = urn; + } + + /** + * 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 CredentialsGroup instance itself + */ + public CredentialsGroup 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; + } + CredentialsGroup credentialsGroup = (CredentialsGroup) o; + return Objects.equals(this.credentialsGroupId, credentialsGroup.credentialsGroupId) + && Objects.equals(this.displayName, credentialsGroup.displayName) + && Objects.equals(this.urn, credentialsGroup.urn) + && Objects.equals(this.additionalProperties, credentialsGroup.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(credentialsGroupId, displayName, urn, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CredentialsGroup {\n"); + sb.append(" credentialsGroupId: ") + .append(toIndentedString(credentialsGroupId)) + .append("\n"); + sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); + sb.append(" urn: ").append(toIndentedString(urn)).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("credentialsGroupId", "displayName", "urn")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = + new HashSet(Arrays.asList("credentialsGroupId", "displayName", "urn")); + } + + /** + * 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 CredentialsGroup + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CredentialsGroup.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 CredentialsGroup is not found in the empty JSON string", + CredentialsGroup.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CredentialsGroup.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("credentialsGroupId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `credentialsGroupId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("credentialsGroupId").toString())); + } + if (!jsonObj.get("displayName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `displayName` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("displayName").toString())); + } + if (!jsonObj.get("urn").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `urn` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("urn").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CredentialsGroup.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CredentialsGroup' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CredentialsGroup.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CredentialsGroup 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 CredentialsGroup read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CredentialsGroup 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 CredentialsGroup given an JSON string + * + * @param jsonString JSON string + * @return An instance of CredentialsGroup + * @throws IOException if the JSON string is invalid with respect to CredentialsGroup + */ + public static CredentialsGroup fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CredentialsGroup.class); + } + + /** + * Convert an instance of CredentialsGroup 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/v1api/model/CredentialsGroupExtended.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/CredentialsGroupExtended.java new file mode 100644 index 00000000..68c2af68 --- /dev/null +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/CredentialsGroupExtended.java @@ -0,0 +1,418 @@ +/* + * 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; + +/** CredentialsGroupExtended */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CredentialsGroupExtended { + public static final String SERIALIZED_NAME_CREDENTIALS_GROUP_ID = "credentialsGroupId"; + + @SerializedName(SERIALIZED_NAME_CREDENTIALS_GROUP_ID) + @javax.annotation.Nonnull + private String credentialsGroupId; + + public static final String SERIALIZED_NAME_DISPLAY_NAME = "displayName"; + + @SerializedName(SERIALIZED_NAME_DISPLAY_NAME) + @javax.annotation.Nonnull + private String displayName; + + public static final String SERIALIZED_NAME_URN = "urn"; + + @SerializedName(SERIALIZED_NAME_URN) + @javax.annotation.Nonnull + private String urn; + + public static final String SERIALIZED_NAME_USER_URN = "userUrn"; + + @SerializedName(SERIALIZED_NAME_USER_URN) + @javax.annotation.Nonnull + private String userUrn; + + public CredentialsGroupExtended() {} + + public CredentialsGroupExtended credentialsGroupId( + @javax.annotation.Nonnull String credentialsGroupId) { + this.credentialsGroupId = credentialsGroupId; + return this; + } + + /** + * The ID of the credentials group + * + * @return credentialsGroupId + */ + @javax.annotation.Nonnull + public String getCredentialsGroupId() { + return credentialsGroupId; + } + + public void setCredentialsGroupId(@javax.annotation.Nonnull String credentialsGroupId) { + this.credentialsGroupId = credentialsGroupId; + } + + public CredentialsGroupExtended displayName(@javax.annotation.Nonnull String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Name of the group holding credentials + * + * @return displayName + */ + @javax.annotation.Nonnull + public String getDisplayName() { + return displayName; + } + + public void setDisplayName(@javax.annotation.Nonnull String displayName) { + this.displayName = displayName; + } + + public CredentialsGroupExtended urn(@javax.annotation.Nonnull String urn) { + this.urn = urn; + return this; + } + + /** + * StorageGRID group URN + * + * @return urn + */ + @javax.annotation.Nonnull + public String getUrn() { + return urn; + } + + public void setUrn(@javax.annotation.Nonnull String urn) { + this.urn = urn; + } + + public CredentialsGroupExtended userUrn(@javax.annotation.Nonnull String userUrn) { + this.userUrn = userUrn; + return this; + } + + /** + * StorageGRID user URN + * + * @return userUrn + */ + @javax.annotation.Nonnull + public String getUserUrn() { + return userUrn; + } + + public void setUserUrn(@javax.annotation.Nonnull String userUrn) { + this.userUrn = userUrn; + } + + /** + * 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 CredentialsGroupExtended instance itself + */ + public CredentialsGroupExtended 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; + } + CredentialsGroupExtended credentialsGroupExtended = (CredentialsGroupExtended) o; + return Objects.equals(this.credentialsGroupId, credentialsGroupExtended.credentialsGroupId) + && Objects.equals(this.displayName, credentialsGroupExtended.displayName) + && Objects.equals(this.urn, credentialsGroupExtended.urn) + && Objects.equals(this.userUrn, credentialsGroupExtended.userUrn) + && Objects.equals( + this.additionalProperties, credentialsGroupExtended.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(credentialsGroupId, displayName, urn, userUrn, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CredentialsGroupExtended {\n"); + sb.append(" credentialsGroupId: ") + .append(toIndentedString(credentialsGroupId)) + .append("\n"); + sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); + sb.append(" urn: ").append(toIndentedString(urn)).append("\n"); + sb.append(" userUrn: ").append(toIndentedString(userUrn)).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("credentialsGroupId", "displayName", "urn", "userUrn")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = + new HashSet( + Arrays.asList("credentialsGroupId", "displayName", "urn", "userUrn")); + } + + /** + * 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 CredentialsGroupExtended + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CredentialsGroupExtended.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 CredentialsGroupExtended is not found in the empty JSON string", + CredentialsGroupExtended.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CredentialsGroupExtended.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("credentialsGroupId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `credentialsGroupId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("credentialsGroupId").toString())); + } + if (!jsonObj.get("displayName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `displayName` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("displayName").toString())); + } + if (!jsonObj.get("urn").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `urn` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("urn").toString())); + } + if (!jsonObj.get("userUrn").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `userUrn` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("userUrn").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CredentialsGroupExtended.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CredentialsGroupExtended' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CredentialsGroupExtended.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CredentialsGroupExtended 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 CredentialsGroupExtended read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CredentialsGroupExtended 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 CredentialsGroupExtended given an JSON string + * + * @param jsonString JSON string + * @return An instance of CredentialsGroupExtended + * @throws IOException if the JSON string is invalid with respect to CredentialsGroupExtended + */ + public static CredentialsGroupExtended fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CredentialsGroupExtended.class); + } + + /** + * Convert an instance of CredentialsGroupExtended 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/v1api/model/DefaultRetentionResponse.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/DefaultRetentionResponse.java new file mode 100644 index 00000000..e2006aa1 --- /dev/null +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/DefaultRetentionResponse.java @@ -0,0 +1,400 @@ +/* + * 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; + +/** DefaultRetentionResponse */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class DefaultRetentionResponse { + public static final String SERIALIZED_NAME_BUCKET = "bucket"; + + @SerializedName(SERIALIZED_NAME_BUCKET) + @javax.annotation.Nonnull + private String bucket; + + public static final String SERIALIZED_NAME_DAYS = "days"; + + @SerializedName(SERIALIZED_NAME_DAYS) + @javax.annotation.Nonnull + private Integer days; + + public static final String SERIALIZED_NAME_MODE = "mode"; + + @SerializedName(SERIALIZED_NAME_MODE) + @javax.annotation.Nonnull + private RetentionMode mode; + + public static final String SERIALIZED_NAME_PROJECT = "project"; + + @SerializedName(SERIALIZED_NAME_PROJECT) + @javax.annotation.Nonnull + private String project; + + public DefaultRetentionResponse() {} + + public DefaultRetentionResponse bucket(@javax.annotation.Nonnull String bucket) { + this.bucket = bucket; + return this; + } + + /** + * Name of the bucket + * + * @return bucket + */ + @javax.annotation.Nonnull + public String getBucket() { + return bucket; + } + + public void setBucket(@javax.annotation.Nonnull String bucket) { + this.bucket = bucket; + } + + public DefaultRetentionResponse days(@javax.annotation.Nonnull Integer days) { + this.days = days; + return this; + } + + /** + * Retention period in days + * + * @return days + */ + @javax.annotation.Nonnull + public Integer getDays() { + return days; + } + + public void setDays(@javax.annotation.Nonnull Integer days) { + this.days = days; + } + + public DefaultRetentionResponse mode(@javax.annotation.Nonnull RetentionMode mode) { + this.mode = mode; + return this; + } + + /** + * Get mode + * + * @return mode + */ + @javax.annotation.Nonnull + public RetentionMode getMode() { + return mode; + } + + public void setMode(@javax.annotation.Nonnull RetentionMode mode) { + this.mode = mode; + } + + public DefaultRetentionResponse project(@javax.annotation.Nonnull String project) { + this.project = project; + return this; + } + + /** + * Project ID + * + * @return project + */ + @javax.annotation.Nonnull + public String getProject() { + return project; + } + + public void setProject(@javax.annotation.Nonnull String project) { + this.project = project; + } + + /** + * 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 DefaultRetentionResponse instance itself + */ + public DefaultRetentionResponse 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; + } + DefaultRetentionResponse defaultRetentionResponse = (DefaultRetentionResponse) o; + return Objects.equals(this.bucket, defaultRetentionResponse.bucket) + && Objects.equals(this.days, defaultRetentionResponse.days) + && Objects.equals(this.mode, defaultRetentionResponse.mode) + && Objects.equals(this.project, defaultRetentionResponse.project) + && Objects.equals( + this.additionalProperties, defaultRetentionResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(bucket, days, mode, project, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DefaultRetentionResponse {\n"); + sb.append(" bucket: ").append(toIndentedString(bucket)).append("\n"); + sb.append(" days: ").append(toIndentedString(days)).append("\n"); + sb.append(" mode: ").append(toIndentedString(mode)).append("\n"); + sb.append(" project: ").append(toIndentedString(project)).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("bucket", "days", "mode", "project")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = + new HashSet(Arrays.asList("bucket", "days", "mode", "project")); + } + + /** + * 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 DefaultRetentionResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DefaultRetentionResponse.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 DefaultRetentionResponse is not found in the empty JSON string", + DefaultRetentionResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DefaultRetentionResponse.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("bucket").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `bucket` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("bucket").toString())); + } + // validate the required field `mode` + RetentionMode.validateJsonElement(jsonObj.get("mode")); + if (!jsonObj.get("project").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `project` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("project").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DefaultRetentionResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DefaultRetentionResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DefaultRetentionResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DefaultRetentionResponse 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 DefaultRetentionResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + DefaultRetentionResponse 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 DefaultRetentionResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of DefaultRetentionResponse + * @throws IOException if the JSON string is invalid with respect to DefaultRetentionResponse + */ + public static DefaultRetentionResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DefaultRetentionResponse.class); + } + + /** + * Convert an instance of DefaultRetentionResponse 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/v1api/model/DeleteAccessKeyResponse.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/DeleteAccessKeyResponse.java new file mode 100644 index 00000000..8917f295 --- /dev/null +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/DeleteAccessKeyResponse.java @@ -0,0 +1,343 @@ +/* + * 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; + +/** DeleteAccessKeyResponse */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class DeleteAccessKeyResponse { + public static final String SERIALIZED_NAME_KEY_ID = "keyId"; + + @SerializedName(SERIALIZED_NAME_KEY_ID) + @javax.annotation.Nonnull + private String keyId; + + public static final String SERIALIZED_NAME_PROJECT = "project"; + + @SerializedName(SERIALIZED_NAME_PROJECT) + @javax.annotation.Nonnull + private String project; + + public DeleteAccessKeyResponse() {} + + public DeleteAccessKeyResponse keyId(@javax.annotation.Nonnull String keyId) { + this.keyId = keyId; + return this; + } + + /** + * Identifies the pair of access key and secret access key for deletion + * + * @return keyId + */ + @javax.annotation.Nonnull + public String getKeyId() { + return keyId; + } + + public void setKeyId(@javax.annotation.Nonnull String keyId) { + this.keyId = keyId; + } + + public DeleteAccessKeyResponse project(@javax.annotation.Nonnull String project) { + this.project = project; + return this; + } + + /** + * Project ID + * + * @return project + */ + @javax.annotation.Nonnull + public String getProject() { + return project; + } + + public void setProject(@javax.annotation.Nonnull String project) { + this.project = project; + } + + /** + * 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 DeleteAccessKeyResponse instance itself + */ + public DeleteAccessKeyResponse 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; + } + DeleteAccessKeyResponse deleteAccessKeyResponse = (DeleteAccessKeyResponse) o; + return Objects.equals(this.keyId, deleteAccessKeyResponse.keyId) + && Objects.equals(this.project, deleteAccessKeyResponse.project) + && Objects.equals( + this.additionalProperties, deleteAccessKeyResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(keyId, project, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeleteAccessKeyResponse {\n"); + sb.append(" keyId: ").append(toIndentedString(keyId)).append("\n"); + sb.append(" project: ").append(toIndentedString(project)).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("keyId", "project")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("keyId", "project")); + } + + /** + * 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 DeleteAccessKeyResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeleteAccessKeyResponse.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 DeleteAccessKeyResponse is not found in the empty JSON string", + DeleteAccessKeyResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DeleteAccessKeyResponse.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("keyId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `keyId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("keyId").toString())); + } + if (!jsonObj.get("project").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `project` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("project").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeleteAccessKeyResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeleteAccessKeyResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DeleteAccessKeyResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DeleteAccessKeyResponse 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 DeleteAccessKeyResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + DeleteAccessKeyResponse 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 DeleteAccessKeyResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeleteAccessKeyResponse + * @throws IOException if the JSON string is invalid with respect to DeleteAccessKeyResponse + */ + public static DeleteAccessKeyResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeleteAccessKeyResponse.class); + } + + /** + * Convert an instance of DeleteAccessKeyResponse 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/v1api/model/DeleteBucketResponse.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/DeleteBucketResponse.java new file mode 100644 index 00000000..dd04c83e --- /dev/null +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/DeleteBucketResponse.java @@ -0,0 +1,342 @@ +/* + * 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; + +/** DeleteBucketResponse */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class DeleteBucketResponse { + public static final String SERIALIZED_NAME_BUCKET = "bucket"; + + @SerializedName(SERIALIZED_NAME_BUCKET) + @javax.annotation.Nonnull + private String bucket; + + public static final String SERIALIZED_NAME_PROJECT = "project"; + + @SerializedName(SERIALIZED_NAME_PROJECT) + @javax.annotation.Nonnull + private String project; + + public DeleteBucketResponse() {} + + public DeleteBucketResponse bucket(@javax.annotation.Nonnull String bucket) { + this.bucket = bucket; + return this; + } + + /** + * Name of the bucket + * + * @return bucket + */ + @javax.annotation.Nonnull + public String getBucket() { + return bucket; + } + + public void setBucket(@javax.annotation.Nonnull String bucket) { + this.bucket = bucket; + } + + public DeleteBucketResponse project(@javax.annotation.Nonnull String project) { + this.project = project; + return this; + } + + /** + * Project ID + * + * @return project + */ + @javax.annotation.Nonnull + public String getProject() { + return project; + } + + public void setProject(@javax.annotation.Nonnull String project) { + this.project = project; + } + + /** + * 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 DeleteBucketResponse instance itself + */ + public DeleteBucketResponse 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; + } + DeleteBucketResponse deleteBucketResponse = (DeleteBucketResponse) o; + return Objects.equals(this.bucket, deleteBucketResponse.bucket) + && Objects.equals(this.project, deleteBucketResponse.project) + && Objects.equals( + this.additionalProperties, deleteBucketResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(bucket, project, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeleteBucketResponse {\n"); + sb.append(" bucket: ").append(toIndentedString(bucket)).append("\n"); + sb.append(" project: ").append(toIndentedString(project)).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("bucket", "project")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("bucket", "project")); + } + + /** + * 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 DeleteBucketResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeleteBucketResponse.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 DeleteBucketResponse is not found in the empty JSON string", + DeleteBucketResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DeleteBucketResponse.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("bucket").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `bucket` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("bucket").toString())); + } + if (!jsonObj.get("project").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `project` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("project").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeleteBucketResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeleteBucketResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DeleteBucketResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DeleteBucketResponse 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 DeleteBucketResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + DeleteBucketResponse 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 DeleteBucketResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeleteBucketResponse + * @throws IOException if the JSON string is invalid with respect to DeleteBucketResponse + */ + public static DeleteBucketResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeleteBucketResponse.class); + } + + /** + * Convert an instance of DeleteBucketResponse 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/v1api/model/DeleteCredentialsGroupResponse.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/DeleteCredentialsGroupResponse.java new file mode 100644 index 00000000..4593dfe0 --- /dev/null +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/DeleteCredentialsGroupResponse.java @@ -0,0 +1,354 @@ +/* + * 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; + +/** DeleteCredentialsGroupResponse */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class DeleteCredentialsGroupResponse { + public static final String SERIALIZED_NAME_CREDENTIALS_GROUP_ID = "credentialsGroupId"; + + @SerializedName(SERIALIZED_NAME_CREDENTIALS_GROUP_ID) + @javax.annotation.Nonnull + private String credentialsGroupId; + + public static final String SERIALIZED_NAME_PROJECT = "project"; + + @SerializedName(SERIALIZED_NAME_PROJECT) + @javax.annotation.Nonnull + private String project; + + public DeleteCredentialsGroupResponse() {} + + public DeleteCredentialsGroupResponse credentialsGroupId( + @javax.annotation.Nonnull String credentialsGroupId) { + this.credentialsGroupId = credentialsGroupId; + return this; + } + + /** + * The ID of the credentials group + * + * @return credentialsGroupId + */ + @javax.annotation.Nonnull + public String getCredentialsGroupId() { + return credentialsGroupId; + } + + public void setCredentialsGroupId(@javax.annotation.Nonnull String credentialsGroupId) { + this.credentialsGroupId = credentialsGroupId; + } + + public DeleteCredentialsGroupResponse project(@javax.annotation.Nonnull String project) { + this.project = project; + return this; + } + + /** + * Project ID + * + * @return project + */ + @javax.annotation.Nonnull + public String getProject() { + return project; + } + + public void setProject(@javax.annotation.Nonnull String project) { + this.project = project; + } + + /** + * 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 DeleteCredentialsGroupResponse instance itself + */ + public DeleteCredentialsGroupResponse 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; + } + DeleteCredentialsGroupResponse deleteCredentialsGroupResponse = + (DeleteCredentialsGroupResponse) o; + return Objects.equals( + this.credentialsGroupId, deleteCredentialsGroupResponse.credentialsGroupId) + && Objects.equals(this.project, deleteCredentialsGroupResponse.project) + && Objects.equals( + this.additionalProperties, + deleteCredentialsGroupResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(credentialsGroupId, project, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeleteCredentialsGroupResponse {\n"); + sb.append(" credentialsGroupId: ") + .append(toIndentedString(credentialsGroupId)) + .append("\n"); + sb.append(" project: ").append(toIndentedString(project)).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("credentialsGroupId", "project")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("credentialsGroupId", "project")); + } + + /** + * 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 + * DeleteCredentialsGroupResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeleteCredentialsGroupResponse.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 DeleteCredentialsGroupResponse is not found in the empty JSON string", + DeleteCredentialsGroupResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DeleteCredentialsGroupResponse.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("credentialsGroupId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `credentialsGroupId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("credentialsGroupId").toString())); + } + if (!jsonObj.get("project").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `project` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("project").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeleteCredentialsGroupResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeleteCredentialsGroupResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(DeleteCredentialsGroupResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DeleteCredentialsGroupResponse 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 DeleteCredentialsGroupResponse read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + DeleteCredentialsGroupResponse 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 DeleteCredentialsGroupResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeleteCredentialsGroupResponse + * @throws IOException if the JSON string is invalid with respect to + * DeleteCredentialsGroupResponse + */ + public static DeleteCredentialsGroupResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeleteCredentialsGroupResponse.class); + } + + /** + * Convert an instance of DeleteCredentialsGroupResponse 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/v1api/model/DeleteDefaultRetentionResponse.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/DeleteDefaultRetentionResponse.java new file mode 100644 index 00000000..ded40700 --- /dev/null +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/DeleteDefaultRetentionResponse.java @@ -0,0 +1,350 @@ +/* + * 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; + +/** DeleteDefaultRetentionResponse */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class DeleteDefaultRetentionResponse { + public static final String SERIALIZED_NAME_BUCKET = "bucket"; + + @SerializedName(SERIALIZED_NAME_BUCKET) + @javax.annotation.Nonnull + private String bucket; + + public static final String SERIALIZED_NAME_PROJECT = "project"; + + @SerializedName(SERIALIZED_NAME_PROJECT) + @javax.annotation.Nonnull + private String project; + + public DeleteDefaultRetentionResponse() {} + + public DeleteDefaultRetentionResponse bucket(@javax.annotation.Nonnull String bucket) { + this.bucket = bucket; + return this; + } + + /** + * Name of the bucket + * + * @return bucket + */ + @javax.annotation.Nonnull + public String getBucket() { + return bucket; + } + + public void setBucket(@javax.annotation.Nonnull String bucket) { + this.bucket = bucket; + } + + public DeleteDefaultRetentionResponse project(@javax.annotation.Nonnull String project) { + this.project = project; + return this; + } + + /** + * Project ID + * + * @return project + */ + @javax.annotation.Nonnull + public String getProject() { + return project; + } + + public void setProject(@javax.annotation.Nonnull String project) { + this.project = project; + } + + /** + * 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 DeleteDefaultRetentionResponse instance itself + */ + public DeleteDefaultRetentionResponse 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; + } + DeleteDefaultRetentionResponse deleteDefaultRetentionResponse = + (DeleteDefaultRetentionResponse) o; + return Objects.equals(this.bucket, deleteDefaultRetentionResponse.bucket) + && Objects.equals(this.project, deleteDefaultRetentionResponse.project) + && Objects.equals( + this.additionalProperties, + deleteDefaultRetentionResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(bucket, project, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeleteDefaultRetentionResponse {\n"); + sb.append(" bucket: ").append(toIndentedString(bucket)).append("\n"); + sb.append(" project: ").append(toIndentedString(project)).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("bucket", "project")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("bucket", "project")); + } + + /** + * 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 + * DeleteDefaultRetentionResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeleteDefaultRetentionResponse.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 DeleteDefaultRetentionResponse is not found in the empty JSON string", + DeleteDefaultRetentionResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DeleteDefaultRetentionResponse.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("bucket").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `bucket` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("bucket").toString())); + } + if (!jsonObj.get("project").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `project` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("project").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeleteDefaultRetentionResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeleteDefaultRetentionResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(DeleteDefaultRetentionResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DeleteDefaultRetentionResponse 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 DeleteDefaultRetentionResponse read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + DeleteDefaultRetentionResponse 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 DeleteDefaultRetentionResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeleteDefaultRetentionResponse + * @throws IOException if the JSON string is invalid with respect to + * DeleteDefaultRetentionResponse + */ + public static DeleteDefaultRetentionResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeleteDefaultRetentionResponse.class); + } + + /** + * Convert an instance of DeleteDefaultRetentionResponse 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/v1api/model/DetailedError.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/DetailedError.java new file mode 100644 index 00000000..1c7056c9 --- /dev/null +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/DetailedError.java @@ -0,0 +1,340 @@ +/* + * 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; + +/** DetailedError */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class DetailedError { + public static final String SERIALIZED_NAME_KEY = "key"; + + @SerializedName(SERIALIZED_NAME_KEY) + @javax.annotation.Nonnull + private String key; + + public static final String SERIALIZED_NAME_MSG = "msg"; + + @SerializedName(SERIALIZED_NAME_MSG) + @javax.annotation.Nonnull + private String msg; + + public DetailedError() {} + + public DetailedError key(@javax.annotation.Nonnull String key) { + this.key = key; + return this; + } + + /** + * Get key + * + * @return key + */ + @javax.annotation.Nonnull + public String getKey() { + return key; + } + + public void setKey(@javax.annotation.Nonnull String key) { + this.key = key; + } + + public DetailedError msg(@javax.annotation.Nonnull String msg) { + this.msg = msg; + return this; + } + + /** + * Get msg + * + * @return msg + */ + @javax.annotation.Nonnull + public String getMsg() { + return msg; + } + + public void setMsg(@javax.annotation.Nonnull String msg) { + this.msg = msg; + } + + /** + * 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 DetailedError instance itself + */ + public DetailedError 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; + } + DetailedError detailedError = (DetailedError) o; + return Objects.equals(this.key, detailedError.key) + && Objects.equals(this.msg, detailedError.msg) + && Objects.equals(this.additionalProperties, detailedError.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(key, msg, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DetailedError {\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" msg: ").append(toIndentedString(msg)).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("key", "msg")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("key", "msg")); + } + + /** + * 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 DetailedError + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DetailedError.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 DetailedError is not found in the empty JSON string", + DetailedError.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DetailedError.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("key").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `key` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("key").toString())); + } + if (!jsonObj.get("msg").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `msg` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("msg").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DetailedError.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DetailedError' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DetailedError.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DetailedError 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 DetailedError read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + DetailedError 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 DetailedError given an JSON string + * + * @param jsonString JSON string + * @return An instance of DetailedError + * @throws IOException if the JSON string is invalid with respect to DetailedError + */ + public static DetailedError fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DetailedError.class); + } + + /** + * Convert an instance of DetailedError 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/v1api/model/ErrorMessage.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/ErrorMessage.java new file mode 100644 index 00000000..1a3aa5e8 --- /dev/null +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/ErrorMessage.java @@ -0,0 +1,324 @@ +/* + * 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.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; + +/** ErrorMessage */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class ErrorMessage { + public static final String SERIALIZED_NAME_DETAIL = "detail"; + + @SerializedName(SERIALIZED_NAME_DETAIL) + @javax.annotation.Nonnull + private List detail = new ArrayList<>(); + + public ErrorMessage() {} + + public ErrorMessage detail(@javax.annotation.Nonnull List detail) { + this.detail = detail; + return this; + } + + public ErrorMessage addDetailItem(DetailedError detailItem) { + if (this.detail == null) { + this.detail = new ArrayList<>(); + } + this.detail.add(detailItem); + return this; + } + + /** + * Get detail + * + * @return detail + */ + @javax.annotation.Nonnull + public List getDetail() { + return detail; + } + + public void setDetail(@javax.annotation.Nonnull List detail) { + this.detail = detail; + } + + /** + * 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 ErrorMessage instance itself + */ + public ErrorMessage 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; + } + ErrorMessage errorMessage = (ErrorMessage) o; + return Objects.equals(this.detail, errorMessage.detail) + && Objects.equals(this.additionalProperties, errorMessage.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(detail, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ErrorMessage {\n"); + sb.append(" detail: ").append(toIndentedString(detail)).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("detail")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("detail")); + } + + /** + * 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 ErrorMessage + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ErrorMessage.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 ErrorMessage is not found in the empty JSON string", + ErrorMessage.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ErrorMessage.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(); + // ensure the json data is an array + if (!jsonObj.get("detail").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `detail` to be an array in the JSON string but got `%s`", + jsonObj.get("detail").toString())); + } + + JsonArray jsonArraydetail = jsonObj.getAsJsonArray("detail"); + // validate the required field `detail` (array) + for (int i = 0; i < jsonArraydetail.size(); i++) { + DetailedError.validateJsonElement(jsonArraydetail.get(i)); + } + ; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ErrorMessage.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ErrorMessage' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ErrorMessage.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ErrorMessage 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 ErrorMessage read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ErrorMessage 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 ErrorMessage given an JSON string + * + * @param jsonString JSON string + * @return An instance of ErrorMessage + * @throws IOException if the JSON string is invalid with respect to ErrorMessage + */ + public static ErrorMessage fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ErrorMessage.class); + } + + /** + * Convert an instance of ErrorMessage 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/v1api/model/GetBucketResponse.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/GetBucketResponse.java new file mode 100644 index 00000000..61b82ab1 --- /dev/null +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/GetBucketResponse.java @@ -0,0 +1,337 @@ +/* + * 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; + +/** GetBucketResponse */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class GetBucketResponse { + public static final String SERIALIZED_NAME_BUCKET = "bucket"; + + @SerializedName(SERIALIZED_NAME_BUCKET) + @javax.annotation.Nonnull + private Bucket bucket; + + public static final String SERIALIZED_NAME_PROJECT = "project"; + + @SerializedName(SERIALIZED_NAME_PROJECT) + @javax.annotation.Nonnull + private String project; + + public GetBucketResponse() {} + + public GetBucketResponse bucket(@javax.annotation.Nonnull Bucket bucket) { + this.bucket = bucket; + return this; + } + + /** + * Get bucket + * + * @return bucket + */ + @javax.annotation.Nonnull + public Bucket getBucket() { + return bucket; + } + + public void setBucket(@javax.annotation.Nonnull Bucket bucket) { + this.bucket = bucket; + } + + public GetBucketResponse project(@javax.annotation.Nonnull String project) { + this.project = project; + return this; + } + + /** + * Project ID + * + * @return project + */ + @javax.annotation.Nonnull + public String getProject() { + return project; + } + + public void setProject(@javax.annotation.Nonnull String project) { + this.project = project; + } + + /** + * 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 GetBucketResponse instance itself + */ + public GetBucketResponse 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; + } + GetBucketResponse getBucketResponse = (GetBucketResponse) o; + return Objects.equals(this.bucket, getBucketResponse.bucket) + && Objects.equals(this.project, getBucketResponse.project) + && Objects.equals( + this.additionalProperties, getBucketResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(bucket, project, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetBucketResponse {\n"); + sb.append(" bucket: ").append(toIndentedString(bucket)).append("\n"); + sb.append(" project: ").append(toIndentedString(project)).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("bucket", "project")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("bucket", "project")); + } + + /** + * 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 GetBucketResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetBucketResponse.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 GetBucketResponse is not found in the empty JSON string", + GetBucketResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetBucketResponse.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(); + // validate the required field `bucket` + Bucket.validateJsonElement(jsonObj.get("bucket")); + if (!jsonObj.get("project").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `project` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("project").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetBucketResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetBucketResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetBucketResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetBucketResponse 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 GetBucketResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + GetBucketResponse 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 GetBucketResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetBucketResponse + * @throws IOException if the JSON string is invalid with respect to GetBucketResponse + */ + public static GetBucketResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetBucketResponse.class); + } + + /** + * Convert an instance of GetBucketResponse 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/v1api/model/GetCredentialsGroupResponse.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/GetCredentialsGroupResponse.java new file mode 100644 index 00000000..721d02f1 --- /dev/null +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/GetCredentialsGroupResponse.java @@ -0,0 +1,343 @@ +/* + * 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; + +/** GetCredentialsGroupResponse */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class GetCredentialsGroupResponse { + public static final String SERIALIZED_NAME_CREDENTIALS_GROUP = "credentialsGroup"; + + @SerializedName(SERIALIZED_NAME_CREDENTIALS_GROUP) + @javax.annotation.Nonnull + private CredentialsGroupExtended credentialsGroup; + + public static final String SERIALIZED_NAME_PROJECT = "project"; + + @SerializedName(SERIALIZED_NAME_PROJECT) + @javax.annotation.Nonnull + private String project; + + public GetCredentialsGroupResponse() {} + + public GetCredentialsGroupResponse credentialsGroup( + @javax.annotation.Nonnull CredentialsGroupExtended credentialsGroup) { + this.credentialsGroup = credentialsGroup; + return this; + } + + /** + * Get credentialsGroup + * + * @return credentialsGroup + */ + @javax.annotation.Nonnull + public CredentialsGroupExtended getCredentialsGroup() { + return credentialsGroup; + } + + public void setCredentialsGroup( + @javax.annotation.Nonnull CredentialsGroupExtended credentialsGroup) { + this.credentialsGroup = credentialsGroup; + } + + public GetCredentialsGroupResponse project(@javax.annotation.Nonnull String project) { + this.project = project; + return this; + } + + /** + * Project ID + * + * @return project + */ + @javax.annotation.Nonnull + public String getProject() { + return project; + } + + public void setProject(@javax.annotation.Nonnull String project) { + this.project = project; + } + + /** + * 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 GetCredentialsGroupResponse instance itself + */ + public GetCredentialsGroupResponse 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; + } + GetCredentialsGroupResponse getCredentialsGroupResponse = (GetCredentialsGroupResponse) o; + return Objects.equals(this.credentialsGroup, getCredentialsGroupResponse.credentialsGroup) + && Objects.equals(this.project, getCredentialsGroupResponse.project) + && Objects.equals( + this.additionalProperties, + getCredentialsGroupResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(credentialsGroup, project, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetCredentialsGroupResponse {\n"); + sb.append(" credentialsGroup: ").append(toIndentedString(credentialsGroup)).append("\n"); + sb.append(" project: ").append(toIndentedString(project)).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("credentialsGroup", "project")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("credentialsGroup", "project")); + } + + /** + * 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 + * GetCredentialsGroupResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetCredentialsGroupResponse.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 GetCredentialsGroupResponse is not found in the empty JSON string", + GetCredentialsGroupResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetCredentialsGroupResponse.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(); + // validate the required field `credentialsGroup` + CredentialsGroupExtended.validateJsonElement(jsonObj.get("credentialsGroup")); + if (!jsonObj.get("project").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `project` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("project").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetCredentialsGroupResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetCredentialsGroupResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetCredentialsGroupResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetCredentialsGroupResponse 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 GetCredentialsGroupResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + GetCredentialsGroupResponse 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 GetCredentialsGroupResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetCredentialsGroupResponse + * @throws IOException if the JSON string is invalid with respect to GetCredentialsGroupResponse + */ + public static GetCredentialsGroupResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetCredentialsGroupResponse.class); + } + + /** + * Convert an instance of GetCredentialsGroupResponse 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/v1api/model/HTTPValidationError.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/HTTPValidationError.java new file mode 100644 index 00000000..4484800b --- /dev/null +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/HTTPValidationError.java @@ -0,0 +1,316 @@ +/* + * 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.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; + +/** HTTPValidationError */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class HTTPValidationError { + public static final String SERIALIZED_NAME_DETAIL = "detail"; + + @SerializedName(SERIALIZED_NAME_DETAIL) + @javax.annotation.Nullable private List detail = new ArrayList<>(); + + public HTTPValidationError() {} + + public HTTPValidationError detail(@javax.annotation.Nullable List detail) { + this.detail = detail; + return this; + } + + public HTTPValidationError addDetailItem(ValidationError detailItem) { + if (this.detail == null) { + this.detail = new ArrayList<>(); + } + this.detail.add(detailItem); + return this; + } + + /** + * Get detail + * + * @return detail + */ + @javax.annotation.Nullable public List getDetail() { + return detail; + } + + public void setDetail(@javax.annotation.Nullable List detail) { + this.detail = detail; + } + + /** + * 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 HTTPValidationError instance itself + */ + public HTTPValidationError 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; + } + HTTPValidationError htTPValidationError = (HTTPValidationError) o; + return Objects.equals(this.detail, htTPValidationError.detail) + && Objects.equals( + this.additionalProperties, htTPValidationError.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(detail, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HTTPValidationError {\n"); + sb.append(" detail: ").append(toIndentedString(detail)).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("detail")); + + // 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 HTTPValidationError + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!HTTPValidationError.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 HTTPValidationError is not found in the empty JSON string", + HTTPValidationError.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("detail") != null && !jsonObj.get("detail").isJsonNull()) { + JsonArray jsonArraydetail = jsonObj.getAsJsonArray("detail"); + if (jsonArraydetail != null) { + // ensure the json data is an array + if (!jsonObj.get("detail").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `detail` to be an array in the JSON string but got `%s`", + jsonObj.get("detail").toString())); + } + + // validate the optional field `detail` (array) + for (int i = 0; i < jsonArraydetail.size(); i++) { + ValidationError.validateJsonElement(jsonArraydetail.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!HTTPValidationError.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'HTTPValidationError' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(HTTPValidationError.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, HTTPValidationError 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 HTTPValidationError read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + HTTPValidationError 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 HTTPValidationError given an JSON string + * + * @param jsonString JSON string + * @return An instance of HTTPValidationError + * @throws IOException if the JSON string is invalid with respect to HTTPValidationError + */ + public static HTTPValidationError fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, HTTPValidationError.class); + } + + /** + * Convert an instance of HTTPValidationError 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/v1api/model/ListAccessKeysResponse.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/ListAccessKeysResponse.java new file mode 100644 index 00000000..504937cb --- /dev/null +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/ListAccessKeysResponse.java @@ -0,0 +1,360 @@ +/* + * 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.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; + +/** ListAccessKeysResponse */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class ListAccessKeysResponse { + public static final String SERIALIZED_NAME_ACCESS_KEYS = "accessKeys"; + + @SerializedName(SERIALIZED_NAME_ACCESS_KEYS) + @javax.annotation.Nonnull + private List accessKeys = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PROJECT = "project"; + + @SerializedName(SERIALIZED_NAME_PROJECT) + @javax.annotation.Nonnull + private String project; + + public ListAccessKeysResponse() {} + + public ListAccessKeysResponse accessKeys(@javax.annotation.Nonnull List accessKeys) { + this.accessKeys = accessKeys; + return this; + } + + public ListAccessKeysResponse addAccessKeysItem(AccessKey accessKeysItem) { + if (this.accessKeys == null) { + this.accessKeys = new ArrayList<>(); + } + this.accessKeys.add(accessKeysItem); + return this; + } + + /** + * Get accessKeys + * + * @return accessKeys + */ + @javax.annotation.Nonnull + public List getAccessKeys() { + return accessKeys; + } + + public void setAccessKeys(@javax.annotation.Nonnull List accessKeys) { + this.accessKeys = accessKeys; + } + + public ListAccessKeysResponse project(@javax.annotation.Nonnull String project) { + this.project = project; + return this; + } + + /** + * Project ID + * + * @return project + */ + @javax.annotation.Nonnull + public String getProject() { + return project; + } + + public void setProject(@javax.annotation.Nonnull String project) { + this.project = project; + } + + /** + * 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 ListAccessKeysResponse instance itself + */ + public ListAccessKeysResponse 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; + } + ListAccessKeysResponse listAccessKeysResponse = (ListAccessKeysResponse) o; + return Objects.equals(this.accessKeys, listAccessKeysResponse.accessKeys) + && Objects.equals(this.project, listAccessKeysResponse.project) + && Objects.equals( + this.additionalProperties, listAccessKeysResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(accessKeys, project, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListAccessKeysResponse {\n"); + sb.append(" accessKeys: ").append(toIndentedString(accessKeys)).append("\n"); + sb.append(" project: ").append(toIndentedString(project)).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("accessKeys", "project")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("accessKeys", "project")); + } + + /** + * 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 ListAccessKeysResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ListAccessKeysResponse.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 ListAccessKeysResponse is not found in the empty JSON string", + ListAccessKeysResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ListAccessKeysResponse.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(); + // ensure the json data is an array + if (!jsonObj.get("accessKeys").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `accessKeys` to be an array in the JSON string but got `%s`", + jsonObj.get("accessKeys").toString())); + } + + JsonArray jsonArrayaccessKeys = jsonObj.getAsJsonArray("accessKeys"); + // validate the required field `accessKeys` (array) + for (int i = 0; i < jsonArrayaccessKeys.size(); i++) { + AccessKey.validateJsonElement(jsonArrayaccessKeys.get(i)); + } + ; + if (!jsonObj.get("project").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `project` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("project").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ListAccessKeysResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ListAccessKeysResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ListAccessKeysResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ListAccessKeysResponse 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 ListAccessKeysResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ListAccessKeysResponse 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 ListAccessKeysResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ListAccessKeysResponse + * @throws IOException if the JSON string is invalid with respect to ListAccessKeysResponse + */ + public static ListAccessKeysResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ListAccessKeysResponse.class); + } + + /** + * Convert an instance of ListAccessKeysResponse 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/v1api/model/ListBucketsResponse.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/ListBucketsResponse.java new file mode 100644 index 00000000..d6d6c7d8 --- /dev/null +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/ListBucketsResponse.java @@ -0,0 +1,360 @@ +/* + * 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.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; + +/** ListBucketsResponse */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class ListBucketsResponse { + public static final String SERIALIZED_NAME_BUCKETS = "buckets"; + + @SerializedName(SERIALIZED_NAME_BUCKETS) + @javax.annotation.Nonnull + private List buckets = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PROJECT = "project"; + + @SerializedName(SERIALIZED_NAME_PROJECT) + @javax.annotation.Nonnull + private String project; + + public ListBucketsResponse() {} + + public ListBucketsResponse buckets(@javax.annotation.Nonnull List buckets) { + this.buckets = buckets; + return this; + } + + public ListBucketsResponse addBucketsItem(Bucket bucketsItem) { + if (this.buckets == null) { + this.buckets = new ArrayList<>(); + } + this.buckets.add(bucketsItem); + return this; + } + + /** + * Get buckets + * + * @return buckets + */ + @javax.annotation.Nonnull + public List getBuckets() { + return buckets; + } + + public void setBuckets(@javax.annotation.Nonnull List buckets) { + this.buckets = buckets; + } + + public ListBucketsResponse project(@javax.annotation.Nonnull String project) { + this.project = project; + return this; + } + + /** + * Project ID + * + * @return project + */ + @javax.annotation.Nonnull + public String getProject() { + return project; + } + + public void setProject(@javax.annotation.Nonnull String project) { + this.project = project; + } + + /** + * 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 ListBucketsResponse instance itself + */ + public ListBucketsResponse 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; + } + ListBucketsResponse listBucketsResponse = (ListBucketsResponse) o; + return Objects.equals(this.buckets, listBucketsResponse.buckets) + && Objects.equals(this.project, listBucketsResponse.project) + && Objects.equals( + this.additionalProperties, listBucketsResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(buckets, project, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListBucketsResponse {\n"); + sb.append(" buckets: ").append(toIndentedString(buckets)).append("\n"); + sb.append(" project: ").append(toIndentedString(project)).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("buckets", "project")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("buckets", "project")); + } + + /** + * 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 ListBucketsResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ListBucketsResponse.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 ListBucketsResponse is not found in the empty JSON string", + ListBucketsResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ListBucketsResponse.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(); + // ensure the json data is an array + if (!jsonObj.get("buckets").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `buckets` to be an array in the JSON string but got `%s`", + jsonObj.get("buckets").toString())); + } + + JsonArray jsonArraybuckets = jsonObj.getAsJsonArray("buckets"); + // validate the required field `buckets` (array) + for (int i = 0; i < jsonArraybuckets.size(); i++) { + Bucket.validateJsonElement(jsonArraybuckets.get(i)); + } + ; + if (!jsonObj.get("project").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `project` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("project").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ListBucketsResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ListBucketsResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ListBucketsResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ListBucketsResponse 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 ListBucketsResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ListBucketsResponse 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 ListBucketsResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ListBucketsResponse + * @throws IOException if the JSON string is invalid with respect to ListBucketsResponse + */ + public static ListBucketsResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ListBucketsResponse.class); + } + + /** + * Convert an instance of ListBucketsResponse 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/v1api/model/ListCredentialsGroupsResponse.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/ListCredentialsGroupsResponse.java new file mode 100644 index 00000000..de6ee305 --- /dev/null +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/ListCredentialsGroupsResponse.java @@ -0,0 +1,374 @@ +/* + * 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.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; + +/** ListCredentialsGroupsResponse */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class ListCredentialsGroupsResponse { + public static final String SERIALIZED_NAME_CREDENTIALS_GROUPS = "credentialsGroups"; + + @SerializedName(SERIALIZED_NAME_CREDENTIALS_GROUPS) + @javax.annotation.Nonnull + private List credentialsGroups = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PROJECT = "project"; + + @SerializedName(SERIALIZED_NAME_PROJECT) + @javax.annotation.Nonnull + private String project; + + public ListCredentialsGroupsResponse() {} + + public ListCredentialsGroupsResponse credentialsGroups( + @javax.annotation.Nonnull List credentialsGroups) { + this.credentialsGroups = credentialsGroups; + return this; + } + + public ListCredentialsGroupsResponse addCredentialsGroupsItem( + CredentialsGroup credentialsGroupsItem) { + if (this.credentialsGroups == null) { + this.credentialsGroups = new ArrayList<>(); + } + this.credentialsGroups.add(credentialsGroupsItem); + return this; + } + + /** + * Get credentialsGroups + * + * @return credentialsGroups + */ + @javax.annotation.Nonnull + public List getCredentialsGroups() { + return credentialsGroups; + } + + public void setCredentialsGroups( + @javax.annotation.Nonnull List credentialsGroups) { + this.credentialsGroups = credentialsGroups; + } + + public ListCredentialsGroupsResponse project(@javax.annotation.Nonnull String project) { + this.project = project; + return this; + } + + /** + * Project ID + * + * @return project + */ + @javax.annotation.Nonnull + public String getProject() { + return project; + } + + public void setProject(@javax.annotation.Nonnull String project) { + this.project = project; + } + + /** + * 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 ListCredentialsGroupsResponse instance itself + */ + public ListCredentialsGroupsResponse 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; + } + ListCredentialsGroupsResponse listCredentialsGroupsResponse = + (ListCredentialsGroupsResponse) o; + return Objects.equals( + this.credentialsGroups, listCredentialsGroupsResponse.credentialsGroups) + && Objects.equals(this.project, listCredentialsGroupsResponse.project) + && Objects.equals( + this.additionalProperties, + listCredentialsGroupsResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(credentialsGroups, project, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListCredentialsGroupsResponse {\n"); + sb.append(" credentialsGroups: ") + .append(toIndentedString(credentialsGroups)) + .append("\n"); + sb.append(" project: ").append(toIndentedString(project)).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("credentialsGroups", "project")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("credentialsGroups", "project")); + } + + /** + * 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 + * ListCredentialsGroupsResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ListCredentialsGroupsResponse.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 ListCredentialsGroupsResponse is not found in the empty JSON string", + ListCredentialsGroupsResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ListCredentialsGroupsResponse.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(); + // ensure the json data is an array + if (!jsonObj.get("credentialsGroups").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `credentialsGroups` to be an array in the JSON string but got `%s`", + jsonObj.get("credentialsGroups").toString())); + } + + JsonArray jsonArraycredentialsGroups = jsonObj.getAsJsonArray("credentialsGroups"); + // validate the required field `credentialsGroups` (array) + for (int i = 0; i < jsonArraycredentialsGroups.size(); i++) { + CredentialsGroup.validateJsonElement(jsonArraycredentialsGroups.get(i)); + } + ; + if (!jsonObj.get("project").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `project` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("project").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ListCredentialsGroupsResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ListCredentialsGroupsResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(ListCredentialsGroupsResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ListCredentialsGroupsResponse 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 ListCredentialsGroupsResponse read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ListCredentialsGroupsResponse 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 ListCredentialsGroupsResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ListCredentialsGroupsResponse + * @throws IOException if the JSON string is invalid with respect to + * ListCredentialsGroupsResponse + */ + public static ListCredentialsGroupsResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ListCredentialsGroupsResponse.class); + } + + /** + * Convert an instance of ListCredentialsGroupsResponse 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/v1api/model/LocationInner.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/LocationInner.java new file mode 100644 index 00000000..c34b5a76 --- /dev/null +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/LocationInner.java @@ -0,0 +1,301 @@ +/* + * 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.JsonPrimitive; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +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.HashMap; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class LocationInner extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(LocationInner.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!LocationInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'LocationInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterString = + gson.getDelegateAdapter(this, TypeToken.get(String.class)); + final TypeAdapter adapterInteger = + gson.getDelegateAdapter(this, TypeToken.get(Integer.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, LocationInner value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `String` + if (value.getActualInstance() instanceof String) { + JsonPrimitive primitive = + adapterString + .toJsonTree((String) value.getActualInstance()) + .getAsJsonPrimitive(); + elementAdapter.write(out, primitive); + return; + } + // check if the actual instance is of the type `Integer` + if (value.getActualInstance() instanceof Integer) { + JsonPrimitive primitive = + adapterInteger + .toJsonTree((Integer) value.getActualInstance()) + .getAsJsonPrimitive(); + elementAdapter.write(out, primitive); + return; + } + throw new IOException( + "Failed to serialize as the type doesn't match anyOf schemas: Integer, String"); + } + + @Override + public LocationInner read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize String + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.getAsJsonPrimitive().isString()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected json element to be of type String in the JSON string but got `%s`", + jsonElement.toString())); + } + actualAdapter = adapterString; + LocationInner ret = new LocationInner(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for String failed with `%s`.", + e.getMessage())); + log.log( + Level.FINER, + "Input data does not match schema 'String'", + e); + } + // deserialize Integer + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.getAsJsonPrimitive().isNumber()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected json element to be of type Number in the JSON string but got `%s`", + jsonElement.toString())); + } + actualAdapter = adapterInteger; + LocationInner ret = new LocationInner(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for Integer failed with `%s`.", + e.getMessage())); + log.log( + Level.FINER, + "Input data does not match schema 'Integer'", + e); + } + + throw new IOException( + String.format( + java.util.Locale.ROOT, + "Failed deserialization for LocationInner: no class matches result, expected at least 1. Detailed failure message for anyOf schemas: %s. JSON: %s", + errorMessages, + jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in anyOf + public static final Map> schemas = new HashMap>(); + + public LocationInner() { + super("anyOf", Boolean.FALSE); + } + + public LocationInner(Object o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("String", String.class); + schemas.put("Integer", Integer.class); + } + + @Override + public Map> getSchemas() { + return LocationInner.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check the instance parameter is valid + * against the anyOf child schemas: Integer, String + * + *

It could be an instance of the 'anyOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof String) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof Integer) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Integer, String"); + } + + /** + * Get the actual instance, which can be the following: Integer, String + * + * @return The actual instance (Integer, String) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `String`. If the actual instance is not `String`, the + * ClassCastException will be thrown. + * + * @return The actual instance of `String` + * @throws ClassCastException if the instance is not `String` + */ + public String getString() throws ClassCastException { + return (String) super.getActualInstance(); + } + + /** + * Get the actual instance of `Integer`. If the actual instance is not `Integer`, the + * ClassCastException will be thrown. + * + * @return The actual instance of `Integer` + * @throws ClassCastException if the instance is not `Integer` + */ + public Integer getInteger() throws ClassCastException { + return (Integer) super.getActualInstance(); + } + + /** + * 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 LocationInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate anyOf schemas one by one + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with String + try { + if (!jsonElement.getAsJsonPrimitive().isString()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected json element to be of type String in the JSON string but got `%s`", + jsonElement.toString())); + } + return; + } catch (Exception e) { + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for String failed with `%s`.", + e.getMessage())); + // continue to the next one + } + // validate the json string with Integer + try { + if (!jsonElement.getAsJsonPrimitive().isNumber()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected json element to be of type Number in the JSON string but got `%s`", + jsonElement.toString())); + } + return; + } catch (Exception e) { + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for Integer failed with `%s`.", + e.getMessage())); + // continue to the next one + } + throw new IOException( + String.format( + java.util.Locale.ROOT, + "The JSON string is invalid for LocationInner with anyOf schemas: Integer, String. no class match the result, expected at least 1. Detailed failure message for anyOf schemas: %s. JSON: %s", + errorMessages, + jsonElement.toString())); + } + + /** + * Create an instance of LocationInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of LocationInner + * @throws IOException if the JSON string is invalid with respect to LocationInner + */ + public static LocationInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, LocationInner.class); + } + + /** + * Convert an instance of LocationInner 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/v1api/model/ProjectScope.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/ProjectScope.java new file mode 100644 index 00000000..27f08c9f --- /dev/null +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/ProjectScope.java @@ -0,0 +1,76 @@ +/* + * 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 com.google.gson.JsonElement; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +/** + * The scope of a STACKIT project can be public (default) or can have client specific special + * requirements. + */ +@JsonAdapter(ProjectScope.Adapter.class) +public enum ProjectScope { + PUBLIC("PUBLIC"), + + SCHWARZ("SCHWARZ"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + ProjectScope(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ProjectScope fromValue(String value) { + for (ProjectScope b : ProjectScope.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ProjectScope enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ProjectScope read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ProjectScope.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + ProjectScope.fromValue(value); + } +} 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 new file mode 100644 index 00000000..e01d30ff --- /dev/null +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/ProjectStatus.java @@ -0,0 +1,335 @@ +/* + * 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; + +/** ProjectStatus */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class ProjectStatus { + public static final String SERIALIZED_NAME_PROJECT = "project"; + + @SerializedName(SERIALIZED_NAME_PROJECT) + @javax.annotation.Nonnull + private String project; + + public static final String SERIALIZED_NAME_SCOPE = "scope"; + + @SerializedName(SERIALIZED_NAME_SCOPE) + @javax.annotation.Nonnull + private ProjectScope scope; + + public ProjectStatus() {} + + public ProjectStatus project(@javax.annotation.Nonnull String project) { + this.project = project; + return this; + } + + /** + * Project ID + * + * @return project + */ + @javax.annotation.Nonnull + public String getProject() { + return project; + } + + public void setProject(@javax.annotation.Nonnull String project) { + this.project = project; + } + + public ProjectStatus scope(@javax.annotation.Nonnull ProjectScope scope) { + this.scope = scope; + return this; + } + + /** + * Project Scope + * + * @return scope + */ + @javax.annotation.Nonnull + public ProjectScope getScope() { + return scope; + } + + public void setScope(@javax.annotation.Nonnull ProjectScope scope) { + this.scope = scope; + } + + /** + * 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 ProjectStatus instance itself + */ + public ProjectStatus 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; + } + ProjectStatus projectStatus = (ProjectStatus) o; + return 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); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProjectStatus {\n"); + sb.append(" project: ").append(toIndentedString(project)).append("\n"); + sb.append(" scope: ").append(toIndentedString(scope)).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("project", "scope")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("project", "scope")); + } + + /** + * 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 ProjectStatus + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProjectStatus.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 ProjectStatus is not found in the empty JSON string", + ProjectStatus.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ProjectStatus.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("project").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `project` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("project").toString())); + } + // validate the required field `scope` + ProjectScope.validateJsonElement(jsonObj.get("scope")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProjectStatus.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProjectStatus' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ProjectStatus.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ProjectStatus 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 ProjectStatus read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ProjectStatus 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 ProjectStatus given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProjectStatus + * @throws IOException if the JSON string is invalid with respect to ProjectStatus + */ + public static ProjectStatus fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProjectStatus.class); + } + + /** + * Convert an instance of ProjectStatus 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/v1api/model/RetentionMode.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/RetentionMode.java new file mode 100644 index 00000000..f2c62612 --- /dev/null +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/RetentionMode.java @@ -0,0 +1,73 @@ +/* + * 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 com.google.gson.JsonElement; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +/** The retention mode for default retention on a bucket. */ +@JsonAdapter(RetentionMode.Adapter.class) +public enum RetentionMode { + COMPLIANCE("COMPLIANCE"), + + GOVERNANCE("GOVERNANCE"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + RetentionMode(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static RetentionMode fromValue(String value) { + for (RetentionMode b : RetentionMode.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final RetentionMode enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public RetentionMode read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return RetentionMode.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + RetentionMode.fromValue(value); + } +} diff --git a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/SetDefaultRetentionPayload.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/SetDefaultRetentionPayload.java new file mode 100644 index 00000000..4c024215 --- /dev/null +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/SetDefaultRetentionPayload.java @@ -0,0 +1,331 @@ +/* + * 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; + +/** SetDefaultRetentionPayload */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class SetDefaultRetentionPayload { + public static final String SERIALIZED_NAME_DAYS = "days"; + + @SerializedName(SERIALIZED_NAME_DAYS) + @javax.annotation.Nonnull + private Integer days; + + public static final String SERIALIZED_NAME_MODE = "mode"; + + @SerializedName(SERIALIZED_NAME_MODE) + @javax.annotation.Nonnull + private RetentionMode mode; + + public SetDefaultRetentionPayload() {} + + public SetDefaultRetentionPayload days(@javax.annotation.Nonnull Integer days) { + this.days = days; + return this; + } + + /** + * Retention period in days minimum: 0 + * + * @return days + */ + @javax.annotation.Nonnull + public Integer getDays() { + return days; + } + + public void setDays(@javax.annotation.Nonnull Integer days) { + this.days = days; + } + + public SetDefaultRetentionPayload mode(@javax.annotation.Nonnull RetentionMode mode) { + this.mode = mode; + return this; + } + + /** + * Get mode + * + * @return mode + */ + @javax.annotation.Nonnull + public RetentionMode getMode() { + return mode; + } + + public void setMode(@javax.annotation.Nonnull RetentionMode mode) { + this.mode = mode; + } + + /** + * 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 SetDefaultRetentionPayload instance itself + */ + public SetDefaultRetentionPayload 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; + } + SetDefaultRetentionPayload setDefaultRetentionPayload = (SetDefaultRetentionPayload) o; + return Objects.equals(this.days, setDefaultRetentionPayload.days) + && Objects.equals(this.mode, setDefaultRetentionPayload.mode) + && Objects.equals( + this.additionalProperties, setDefaultRetentionPayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(days, mode, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SetDefaultRetentionPayload {\n"); + sb.append(" days: ").append(toIndentedString(days)).append("\n"); + sb.append(" mode: ").append(toIndentedString(mode)).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("days", "mode")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("days", "mode")); + } + + /** + * 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 SetDefaultRetentionPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SetDefaultRetentionPayload.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 SetDefaultRetentionPayload is not found in the empty JSON string", + SetDefaultRetentionPayload.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SetDefaultRetentionPayload.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(); + // validate the required field `mode` + RetentionMode.validateJsonElement(jsonObj.get("mode")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SetDefaultRetentionPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SetDefaultRetentionPayload' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(SetDefaultRetentionPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, SetDefaultRetentionPayload 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 SetDefaultRetentionPayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SetDefaultRetentionPayload 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 SetDefaultRetentionPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of SetDefaultRetentionPayload + * @throws IOException if the JSON string is invalid with respect to SetDefaultRetentionPayload + */ + public static SetDefaultRetentionPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SetDefaultRetentionPayload.class); + } + + /** + * Convert an instance of SetDefaultRetentionPayload 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/v1api/model/ValidationError.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/ValidationError.java new file mode 100644 index 00000000..c6865662 --- /dev/null +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v1api/model/ValidationError.java @@ -0,0 +1,393 @@ +/* + * 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.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; + +/** ValidationError */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class ValidationError { + public static final String SERIALIZED_NAME_LOC = "loc"; + + @SerializedName(SERIALIZED_NAME_LOC) + @javax.annotation.Nonnull + private List loc = new ArrayList<>(); + + public static final String SERIALIZED_NAME_MSG = "msg"; + + @SerializedName(SERIALIZED_NAME_MSG) + @javax.annotation.Nonnull + private String msg; + + public static final String SERIALIZED_NAME_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private String type; + + public ValidationError() {} + + public ValidationError loc(@javax.annotation.Nonnull List loc) { + this.loc = loc; + return this; + } + + public ValidationError addLocItem(LocationInner locItem) { + if (this.loc == null) { + this.loc = new ArrayList<>(); + } + this.loc.add(locItem); + return this; + } + + /** + * Get loc + * + * @return loc + */ + @javax.annotation.Nonnull + public List getLoc() { + return loc; + } + + public void setLoc(@javax.annotation.Nonnull List loc) { + this.loc = loc; + } + + public ValidationError msg(@javax.annotation.Nonnull String msg) { + this.msg = msg; + return this; + } + + /** + * Get msg + * + * @return msg + */ + @javax.annotation.Nonnull + public String getMsg() { + return msg; + } + + public void setMsg(@javax.annotation.Nonnull String msg) { + this.msg = msg; + } + + public ValidationError type(@javax.annotation.Nonnull String type) { + this.type = type; + return this; + } + + /** + * Get type + * + * @return type + */ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull String type) { + this.type = type; + } + + /** + * 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 ValidationError instance itself + */ + public ValidationError 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; + } + ValidationError validationError = (ValidationError) o; + return Objects.equals(this.loc, validationError.loc) + && Objects.equals(this.msg, validationError.msg) + && Objects.equals(this.type, validationError.type) + && Objects.equals(this.additionalProperties, validationError.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(loc, msg, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ValidationError {\n"); + sb.append(" loc: ").append(toIndentedString(loc)).append("\n"); + sb.append(" msg: ").append(toIndentedString(msg)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).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("loc", "msg", "type")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("loc", "msg", "type")); + } + + /** + * 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 ValidationError + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ValidationError.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 ValidationError is not found in the empty JSON string", + ValidationError.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ValidationError.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(); + // ensure the json data is an array + if (!jsonObj.get("loc").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `loc` to be an array in the JSON string but got `%s`", + jsonObj.get("loc").toString())); + } + + JsonArray jsonArrayloc = jsonObj.getAsJsonArray("loc"); + // validate the required field `loc` (array) + for (int i = 0; i < jsonArrayloc.size(); i++) { + LocationInner.validateJsonElement(jsonArrayloc.get(i)); + } + ; + if (!jsonObj.get("msg").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `msg` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("msg").toString())); + } + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `type` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("type").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ValidationError.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ValidationError' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ValidationError.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ValidationError 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 ValidationError read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ValidationError 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 ValidationError given an JSON string + * + * @param jsonString JSON string + * @return An instance of ValidationError + * @throws IOException if the JSON string is invalid with respect to ValidationError + */ + public static ValidationError fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ValidationError.class); + } + + /** + * Convert an instance of ValidationError 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/ApiCallback.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/ApiCallback.java similarity index 97% rename from services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/ApiCallback.java rename to services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/ApiCallback.java index 6b9e5e92..e4ed9c7e 100644 --- a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/ApiCallback.java +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/ApiCallback.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.objectstorage; +package cloud.stackit.sdk.objectstorage.v2api; import cloud.stackit.sdk.core.exception.ApiException; import java.util.List; diff --git a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/ApiClient.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/ApiClient.java similarity index 99% rename from services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/ApiClient.java rename to services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/ApiClient.java index 8137f341..535ffa7d 100644 --- a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/ApiClient.java +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/ApiClient.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.objectstorage; +package cloud.stackit.sdk.objectstorage.v2api; 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.objectstorage.ApiClient} object + * @return a {@link cloud.stackit.sdk.objectstorage.v2api.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.objectstorage.ApiClient} object + * @return a {@link cloud.stackit.sdk.objectstorage.v2api.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.objectstorage.ApiClient} object + * @return a {@link cloud.stackit.sdk.objectstorage.v2api.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.objectstorage.ApiClient} object + * @return a {@link cloud.stackit.sdk.objectstorage.v2api.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.objectstorage.ApiClient} object + * @return a {@link cloud.stackit.sdk.objectstorage.v2api.ApiClient} object */ public ApiClient setLenientOnJson(boolean lenientOnJson) { JSON.setLenientOnJson(lenientOnJson); diff --git a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/ApiResponse.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/ApiResponse.java similarity index 97% rename from services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/ApiResponse.java rename to services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/ApiResponse.java index 39c4d7d6..b956d450 100644 --- a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/ApiResponse.java +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/ApiResponse.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.objectstorage; +package cloud.stackit.sdk.objectstorage.v2api; import java.util.List; import java.util.Map; diff --git a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/GzipRequestInterceptor.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/GzipRequestInterceptor.java similarity index 97% rename from services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/GzipRequestInterceptor.java rename to services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/GzipRequestInterceptor.java index 7cd5f9af..1ee2bbaa 100644 --- a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/GzipRequestInterceptor.java +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/GzipRequestInterceptor.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.objectstorage; +package cloud.stackit.sdk.objectstorage.v2api; import java.io.IOException; import okhttp3.*; diff --git a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/JSON.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/JSON.java similarity index 85% rename from services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/JSON.java rename to services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/JSON.java index ba1c867d..4d61b9ea 100644 --- a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/JSON.java +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/JSON.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.objectstorage; +package cloud.stackit.sdk.objectstorage.v2api; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -96,79 +96,84 @@ private static Class getClassByDiscriminator( gsonBuilder.registerTypeAdapter(LocalDate.class, localDateTypeAdapter); gsonBuilder.registerTypeAdapter(byte[].class, byteArrayAdapter); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.objectstorage.model.AccessKey.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.objectstorage.v2api.model.AccessKey + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.objectstorage.model.Bucket.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.objectstorage.v2api.model.Bucket.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.objectstorage.model.ComplianceLockResponse + new cloud.stackit.sdk.objectstorage.v2api.model.ComplianceLockResponse .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.objectstorage.model.CreateAccessKeyPayload + new cloud.stackit.sdk.objectstorage.v2api.model.CreateAccessKeyPayload .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.objectstorage.model.CreateAccessKeyResponse + new cloud.stackit.sdk.objectstorage.v2api.model.CreateAccessKeyResponse .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.objectstorage.model.CreateBucketResponse + new cloud.stackit.sdk.objectstorage.v2api.model.CreateBucketResponse .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.objectstorage.model.CreateCredentialsGroupPayload + new cloud.stackit.sdk.objectstorage.v2api.model.CreateCredentialsGroupPayload .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.objectstorage.model.CreateCredentialsGroupResponse + new cloud.stackit.sdk.objectstorage.v2api.model.CreateCredentialsGroupResponse .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.objectstorage.model.CredentialsGroup + new cloud.stackit.sdk.objectstorage.v2api.model.CredentialsGroup .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.objectstorage.model.CredentialsGroupExtended + new cloud.stackit.sdk.objectstorage.v2api.model.CredentialsGroupExtended .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.objectstorage.model.DefaultRetentionResponse + new cloud.stackit.sdk.objectstorage.v2api.model.DefaultRetentionResponse .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.objectstorage.model.DeleteAccessKeyResponse + new cloud.stackit.sdk.objectstorage.v2api.model.DeleteAccessKeyResponse .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.objectstorage.model.DeleteBucketResponse + new cloud.stackit.sdk.objectstorage.v2api.model.DeleteBucketResponse .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.objectstorage.model.DeleteCredentialsGroupResponse + new cloud.stackit.sdk.objectstorage.v2api.model.DeleteCredentialsGroupResponse .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.objectstorage.model.DeleteDefaultRetentionResponse + new cloud.stackit.sdk.objectstorage.v2api.model.DeleteDefaultRetentionResponse .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.objectstorage.model.DetailedError.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.objectstorage.v2api.model.DetailedError + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.objectstorage.model.ErrorMessage.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.objectstorage.v2api.model.ErrorMessage + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.objectstorage.model.GetBucketResponse + new cloud.stackit.sdk.objectstorage.v2api.model.GetBucketResponse .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.objectstorage.model.GetCredentialsGroupResponse + new cloud.stackit.sdk.objectstorage.v2api.model.GetCredentialsGroupResponse .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.objectstorage.model.HTTPValidationError + new cloud.stackit.sdk.objectstorage.v2api.model.HTTPValidationError .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.objectstorage.model.ListAccessKeysResponse + new cloud.stackit.sdk.objectstorage.v2api.model.ListAccessKeysResponse .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.objectstorage.model.ListBucketsResponse + new cloud.stackit.sdk.objectstorage.v2api.model.ListBucketsResponse .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.objectstorage.model.ListCredentialsGroupsResponse + new cloud.stackit.sdk.objectstorage.v2api.model.ListCredentialsGroupsResponse .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.objectstorage.model.LocationInner.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.objectstorage.v2api.model.LocationInner + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.objectstorage.model.ProjectStatus.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.objectstorage.v2api.model.ProjectStatus + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.objectstorage.model.SetDefaultRetentionPayload + new cloud.stackit.sdk.objectstorage.v2api.model.SetDefaultRetentionPayload .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.objectstorage.model.ValidationError + new cloud.stackit.sdk.objectstorage.v2api.model.ValidationError .CustomTypeAdapterFactory()); gson = gsonBuilder.create(); } diff --git a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/Pair.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/Pair.java similarity index 94% rename from services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/Pair.java rename to services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/Pair.java index 0909c587..3052b202 100644 --- a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/Pair.java +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/Pair.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.objectstorage; +package cloud.stackit.sdk.objectstorage.v2api; @javax.annotation.Generated( value = "org.openapitools.codegen.languages.JavaClientCodegen", diff --git a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/ProgressRequestBody.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/ProgressRequestBody.java similarity index 97% rename from services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/ProgressRequestBody.java rename to services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/ProgressRequestBody.java index 21e11e65..80725b8e 100644 --- a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/ProgressRequestBody.java +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/ProgressRequestBody.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.objectstorage; +package cloud.stackit.sdk.objectstorage.v2api; import java.io.IOException; import okhttp3.MediaType; diff --git a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/ProgressResponseBody.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/ProgressResponseBody.java similarity index 97% rename from services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/ProgressResponseBody.java rename to services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/ProgressResponseBody.java index 4d0ea75d..782d92de 100644 --- a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/ProgressResponseBody.java +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/ProgressResponseBody.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.objectstorage; +package cloud.stackit.sdk.objectstorage.v2api; import java.io.IOException; import okhttp3.MediaType; diff --git a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/ServerConfiguration.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/ServerConfiguration.java similarity index 97% rename from services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/ServerConfiguration.java rename to services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/ServerConfiguration.java index 835b97e1..fee92de4 100644 --- a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/ServerConfiguration.java +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/ServerConfiguration.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.objectstorage; +package cloud.stackit.sdk.objectstorage.v2api; import java.util.Map; diff --git a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/ServerVariable.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/ServerVariable.java similarity index 96% rename from services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/ServerVariable.java rename to services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/ServerVariable.java index 7e28f359..58531fbe 100644 --- a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/ServerVariable.java +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/ServerVariable.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.objectstorage; +package cloud.stackit.sdk.objectstorage.v2api; import java.util.HashSet; diff --git a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/StringUtil.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/StringUtil.java similarity index 97% rename from services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/StringUtil.java rename to services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/StringUtil.java index a0ff3e9b..5ba15c82 100644 --- a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/StringUtil.java +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/StringUtil.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.objectstorage; +package cloud.stackit.sdk.objectstorage.v2api; import java.util.Collection; import java.util.Iterator; diff --git a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/api/DefaultApi.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/api/DefaultApi.java similarity index 99% rename from services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/api/DefaultApi.java rename to services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/api/DefaultApi.java index 1e3fcba8..e8690b7d 100644 --- a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/api/DefaultApi.java +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/api/DefaultApi.java @@ -10,32 +10,32 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.objectstorage.api; +package cloud.stackit.sdk.objectstorage.v2api.api; import cloud.stackit.sdk.core.config.CoreConfiguration; import cloud.stackit.sdk.core.exception.ApiException; -import cloud.stackit.sdk.objectstorage.ApiCallback; -import cloud.stackit.sdk.objectstorage.ApiClient; -import cloud.stackit.sdk.objectstorage.ApiResponse; -import cloud.stackit.sdk.objectstorage.Pair; -import cloud.stackit.sdk.objectstorage.model.ComplianceLockResponse; -import cloud.stackit.sdk.objectstorage.model.CreateAccessKeyPayload; -import cloud.stackit.sdk.objectstorage.model.CreateAccessKeyResponse; -import cloud.stackit.sdk.objectstorage.model.CreateBucketResponse; -import cloud.stackit.sdk.objectstorage.model.CreateCredentialsGroupPayload; -import cloud.stackit.sdk.objectstorage.model.CreateCredentialsGroupResponse; -import cloud.stackit.sdk.objectstorage.model.DefaultRetentionResponse; -import cloud.stackit.sdk.objectstorage.model.DeleteAccessKeyResponse; -import cloud.stackit.sdk.objectstorage.model.DeleteBucketResponse; -import cloud.stackit.sdk.objectstorage.model.DeleteCredentialsGroupResponse; -import cloud.stackit.sdk.objectstorage.model.DeleteDefaultRetentionResponse; -import cloud.stackit.sdk.objectstorage.model.GetBucketResponse; -import cloud.stackit.sdk.objectstorage.model.GetCredentialsGroupResponse; -import cloud.stackit.sdk.objectstorage.model.ListAccessKeysResponse; -import cloud.stackit.sdk.objectstorage.model.ListBucketsResponse; -import cloud.stackit.sdk.objectstorage.model.ListCredentialsGroupsResponse; -import cloud.stackit.sdk.objectstorage.model.ProjectStatus; -import cloud.stackit.sdk.objectstorage.model.SetDefaultRetentionPayload; +import cloud.stackit.sdk.objectstorage.v2api.ApiCallback; +import cloud.stackit.sdk.objectstorage.v2api.ApiClient; +import cloud.stackit.sdk.objectstorage.v2api.ApiResponse; +import cloud.stackit.sdk.objectstorage.v2api.Pair; +import cloud.stackit.sdk.objectstorage.v2api.model.ComplianceLockResponse; +import cloud.stackit.sdk.objectstorage.v2api.model.CreateAccessKeyPayload; +import cloud.stackit.sdk.objectstorage.v2api.model.CreateAccessKeyResponse; +import cloud.stackit.sdk.objectstorage.v2api.model.CreateBucketResponse; +import cloud.stackit.sdk.objectstorage.v2api.model.CreateCredentialsGroupPayload; +import cloud.stackit.sdk.objectstorage.v2api.model.CreateCredentialsGroupResponse; +import cloud.stackit.sdk.objectstorage.v2api.model.DefaultRetentionResponse; +import cloud.stackit.sdk.objectstorage.v2api.model.DeleteAccessKeyResponse; +import cloud.stackit.sdk.objectstorage.v2api.model.DeleteBucketResponse; +import cloud.stackit.sdk.objectstorage.v2api.model.DeleteCredentialsGroupResponse; +import cloud.stackit.sdk.objectstorage.v2api.model.DeleteDefaultRetentionResponse; +import cloud.stackit.sdk.objectstorage.v2api.model.GetBucketResponse; +import cloud.stackit.sdk.objectstorage.v2api.model.GetCredentialsGroupResponse; +import cloud.stackit.sdk.objectstorage.v2api.model.ListAccessKeysResponse; +import cloud.stackit.sdk.objectstorage.v2api.model.ListBucketsResponse; +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 com.google.gson.reflect.TypeToken; import java.io.IOException; import java.lang.reflect.Type; diff --git a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/api/ObjectStorageApi.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/api/ObjectStorageApi.java similarity index 93% rename from services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/api/ObjectStorageApi.java rename to services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/api/ObjectStorageApi.java index 6c04be66..758af412 100644 --- a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/api/ObjectStorageApi.java +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/api/ObjectStorageApi.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.objectstorage.api; +package cloud.stackit.sdk.objectstorage.v2api.api; import cloud.stackit.sdk.core.config.CoreConfiguration; import java.io.IOException; @@ -33,7 +33,7 @@ public ObjectStorageApi() throws IOException { * *

For production use consider using the constructor with the OkHttpClient parameter. * - * @param config your STACKIT SDK CoreConfiguration + * @param configuration your STACKIT SDK CoreConfiguration * @throws IOException */ public ObjectStorageApi(CoreConfiguration configuration) throws IOException { diff --git a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/AbstractOpenApiSchema.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/AbstractOpenApiSchema.java similarity index 98% rename from services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/AbstractOpenApiSchema.java rename to services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/AbstractOpenApiSchema.java index eb0d16ef..4d3d9969 100644 --- a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/AbstractOpenApiSchema.java +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/AbstractOpenApiSchema.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.objectstorage.model; +package cloud.stackit.sdk.objectstorage.v2api.model; import java.util.Map; import java.util.Objects; diff --git a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/AccessKey.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/AccessKey.java similarity index 99% rename from services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/AccessKey.java rename to services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/AccessKey.java index e66fade3..f1332c7a 100644 --- a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/AccessKey.java +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/AccessKey.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.objectstorage.model; +package cloud.stackit.sdk.objectstorage.v2api.model; -import cloud.stackit.sdk.objectstorage.JSON; +import cloud.stackit.sdk.objectstorage.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/Bucket.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/Bucket.java similarity index 99% rename from services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/Bucket.java rename to services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/Bucket.java index 91d71342..3065c696 100644 --- a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/Bucket.java +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/Bucket.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.objectstorage.model; +package cloud.stackit.sdk.objectstorage.v2api.model; -import cloud.stackit.sdk.objectstorage.JSON; +import cloud.stackit.sdk.objectstorage.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/ComplianceLockResponse.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/ComplianceLockResponse.java similarity index 99% rename from services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/ComplianceLockResponse.java rename to services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/ComplianceLockResponse.java index d53d60fd..6380abdc 100644 --- a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/ComplianceLockResponse.java +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/ComplianceLockResponse.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.objectstorage.model; +package cloud.stackit.sdk.objectstorage.v2api.model; -import cloud.stackit.sdk.objectstorage.JSON; +import cloud.stackit.sdk.objectstorage.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/CreateAccessKeyPayload.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/CreateAccessKeyPayload.java similarity index 98% rename from services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/CreateAccessKeyPayload.java rename to services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/CreateAccessKeyPayload.java index f4fbd8b9..c98453ee 100644 --- a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/CreateAccessKeyPayload.java +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/CreateAccessKeyPayload.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.objectstorage.model; +package cloud.stackit.sdk.objectstorage.v2api.model; -import cloud.stackit.sdk.objectstorage.JSON; +import cloud.stackit.sdk.objectstorage.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/CreateAccessKeyResponse.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/CreateAccessKeyResponse.java similarity index 99% rename from services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/CreateAccessKeyResponse.java rename to services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/CreateAccessKeyResponse.java index 19282852..5675e07e 100644 --- a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/CreateAccessKeyResponse.java +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/CreateAccessKeyResponse.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.objectstorage.model; +package cloud.stackit.sdk.objectstorage.v2api.model; -import cloud.stackit.sdk.objectstorage.JSON; +import cloud.stackit.sdk.objectstorage.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/CreateBucketResponse.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/CreateBucketResponse.java similarity index 99% rename from services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/CreateBucketResponse.java rename to services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/CreateBucketResponse.java index df9c6c87..6d1bdea3 100644 --- a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/CreateBucketResponse.java +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/CreateBucketResponse.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.objectstorage.model; +package cloud.stackit.sdk.objectstorage.v2api.model; -import cloud.stackit.sdk.objectstorage.JSON; +import cloud.stackit.sdk.objectstorage.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/CreateCredentialsGroupPayload.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/CreateCredentialsGroupPayload.java similarity index 99% rename from services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/CreateCredentialsGroupPayload.java rename to services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/CreateCredentialsGroupPayload.java index d07209ec..4d2fa0d4 100644 --- a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/CreateCredentialsGroupPayload.java +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/CreateCredentialsGroupPayload.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.objectstorage.model; +package cloud.stackit.sdk.objectstorage.v2api.model; -import cloud.stackit.sdk.objectstorage.JSON; +import cloud.stackit.sdk.objectstorage.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/CreateCredentialsGroupResponse.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/CreateCredentialsGroupResponse.java similarity index 99% rename from services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/CreateCredentialsGroupResponse.java rename to services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/CreateCredentialsGroupResponse.java index b65193ca..24937885 100644 --- a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/CreateCredentialsGroupResponse.java +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/CreateCredentialsGroupResponse.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.objectstorage.model; +package cloud.stackit.sdk.objectstorage.v2api.model; -import cloud.stackit.sdk.objectstorage.JSON; +import cloud.stackit.sdk.objectstorage.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/CredentialsGroup.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/CredentialsGroup.java similarity index 99% rename from services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/CredentialsGroup.java rename to services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/CredentialsGroup.java index 4c109a4b..652b7919 100644 --- a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/CredentialsGroup.java +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/CredentialsGroup.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.objectstorage.model; +package cloud.stackit.sdk.objectstorage.v2api.model; -import cloud.stackit.sdk.objectstorage.JSON; +import cloud.stackit.sdk.objectstorage.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/CredentialsGroupExtended.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/CredentialsGroupExtended.java similarity index 99% rename from services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/CredentialsGroupExtended.java rename to services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/CredentialsGroupExtended.java index d9f94001..3b892c23 100644 --- a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/CredentialsGroupExtended.java +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/CredentialsGroupExtended.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.objectstorage.model; +package cloud.stackit.sdk.objectstorage.v2api.model; -import cloud.stackit.sdk.objectstorage.JSON; +import cloud.stackit.sdk.objectstorage.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/DefaultRetentionResponse.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/DefaultRetentionResponse.java similarity index 99% rename from services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/DefaultRetentionResponse.java rename to services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/DefaultRetentionResponse.java index a2466b1a..ccd2c35b 100644 --- a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/DefaultRetentionResponse.java +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/DefaultRetentionResponse.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.objectstorage.model; +package cloud.stackit.sdk.objectstorage.v2api.model; -import cloud.stackit.sdk.objectstorage.JSON; +import cloud.stackit.sdk.objectstorage.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/DeleteAccessKeyResponse.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/DeleteAccessKeyResponse.java similarity index 99% rename from services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/DeleteAccessKeyResponse.java rename to services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/DeleteAccessKeyResponse.java index 433cdd70..87b4b60b 100644 --- a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/DeleteAccessKeyResponse.java +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/DeleteAccessKeyResponse.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.objectstorage.model; +package cloud.stackit.sdk.objectstorage.v2api.model; -import cloud.stackit.sdk.objectstorage.JSON; +import cloud.stackit.sdk.objectstorage.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/DeleteBucketResponse.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/DeleteBucketResponse.java similarity index 99% rename from services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/DeleteBucketResponse.java rename to services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/DeleteBucketResponse.java index d2effa96..b8843f69 100644 --- a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/DeleteBucketResponse.java +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/DeleteBucketResponse.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.objectstorage.model; +package cloud.stackit.sdk.objectstorage.v2api.model; -import cloud.stackit.sdk.objectstorage.JSON; +import cloud.stackit.sdk.objectstorage.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/DeleteCredentialsGroupResponse.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/DeleteCredentialsGroupResponse.java similarity index 99% rename from services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/DeleteCredentialsGroupResponse.java rename to services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/DeleteCredentialsGroupResponse.java index c0b2e958..36128d18 100644 --- a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/DeleteCredentialsGroupResponse.java +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/DeleteCredentialsGroupResponse.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.objectstorage.model; +package cloud.stackit.sdk.objectstorage.v2api.model; -import cloud.stackit.sdk.objectstorage.JSON; +import cloud.stackit.sdk.objectstorage.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/DeleteDefaultRetentionResponse.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/DeleteDefaultRetentionResponse.java similarity index 99% rename from services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/DeleteDefaultRetentionResponse.java rename to services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/DeleteDefaultRetentionResponse.java index e19939ff..a9ac3242 100644 --- a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/DeleteDefaultRetentionResponse.java +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/DeleteDefaultRetentionResponse.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.objectstorage.model; +package cloud.stackit.sdk.objectstorage.v2api.model; -import cloud.stackit.sdk.objectstorage.JSON; +import cloud.stackit.sdk.objectstorage.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/DetailedError.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/DetailedError.java similarity index 99% rename from services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/DetailedError.java rename to services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/DetailedError.java index 4aa911f2..2b196b4b 100644 --- a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/DetailedError.java +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/DetailedError.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.objectstorage.model; +package cloud.stackit.sdk.objectstorage.v2api.model; -import cloud.stackit.sdk.objectstorage.JSON; +import cloud.stackit.sdk.objectstorage.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/ErrorMessage.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/ErrorMessage.java similarity index 99% rename from services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/ErrorMessage.java rename to services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/ErrorMessage.java index b3d6bd46..b8ebb9f3 100644 --- a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/ErrorMessage.java +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/ErrorMessage.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.objectstorage.model; +package cloud.stackit.sdk.objectstorage.v2api.model; -import cloud.stackit.sdk.objectstorage.JSON; +import cloud.stackit.sdk.objectstorage.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; diff --git a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/GetBucketResponse.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/GetBucketResponse.java similarity index 99% rename from services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/GetBucketResponse.java rename to services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/GetBucketResponse.java index 63440508..8a8ef3b7 100644 --- a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/GetBucketResponse.java +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/GetBucketResponse.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.objectstorage.model; +package cloud.stackit.sdk.objectstorage.v2api.model; -import cloud.stackit.sdk.objectstorage.JSON; +import cloud.stackit.sdk.objectstorage.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/GetCredentialsGroupResponse.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/GetCredentialsGroupResponse.java similarity index 99% rename from services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/GetCredentialsGroupResponse.java rename to services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/GetCredentialsGroupResponse.java index 0b512377..8b91e2ff 100644 --- a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/GetCredentialsGroupResponse.java +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/GetCredentialsGroupResponse.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.objectstorage.model; +package cloud.stackit.sdk.objectstorage.v2api.model; -import cloud.stackit.sdk.objectstorage.JSON; +import cloud.stackit.sdk.objectstorage.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/HTTPValidationError.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/HTTPValidationError.java similarity index 99% rename from services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/HTTPValidationError.java rename to services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/HTTPValidationError.java index a324e5d4..b6fc4891 100644 --- a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/HTTPValidationError.java +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/HTTPValidationError.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.objectstorage.model; +package cloud.stackit.sdk.objectstorage.v2api.model; -import cloud.stackit.sdk.objectstorage.JSON; +import cloud.stackit.sdk.objectstorage.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; diff --git a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/ListAccessKeysResponse.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/ListAccessKeysResponse.java similarity index 99% rename from services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/ListAccessKeysResponse.java rename to services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/ListAccessKeysResponse.java index f3d52c4f..32dedc58 100644 --- a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/ListAccessKeysResponse.java +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/ListAccessKeysResponse.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.objectstorage.model; +package cloud.stackit.sdk.objectstorage.v2api.model; -import cloud.stackit.sdk.objectstorage.JSON; +import cloud.stackit.sdk.objectstorage.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; diff --git a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/ListBucketsResponse.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/ListBucketsResponse.java similarity index 99% rename from services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/ListBucketsResponse.java rename to services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/ListBucketsResponse.java index 2f2df8f3..875282b3 100644 --- a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/ListBucketsResponse.java +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/ListBucketsResponse.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.objectstorage.model; +package cloud.stackit.sdk.objectstorage.v2api.model; -import cloud.stackit.sdk.objectstorage.JSON; +import cloud.stackit.sdk.objectstorage.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; diff --git a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/ListCredentialsGroupsResponse.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/ListCredentialsGroupsResponse.java similarity index 99% rename from services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/ListCredentialsGroupsResponse.java rename to services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/ListCredentialsGroupsResponse.java index 253a2e4c..718e745a 100644 --- a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/ListCredentialsGroupsResponse.java +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/ListCredentialsGroupsResponse.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.objectstorage.model; +package cloud.stackit.sdk.objectstorage.v2api.model; -import cloud.stackit.sdk.objectstorage.JSON; +import cloud.stackit.sdk.objectstorage.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; diff --git a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/LocationInner.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/LocationInner.java similarity index 98% rename from services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/LocationInner.java rename to services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/LocationInner.java index bfa6ce90..30590b45 100644 --- a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/LocationInner.java +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/LocationInner.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.objectstorage.model; +package cloud.stackit.sdk.objectstorage.v2api.model; -import cloud.stackit.sdk.objectstorage.JSON; +import cloud.stackit.sdk.objectstorage.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonPrimitive; diff --git a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/ProjectScope.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/ProjectScope.java similarity index 97% rename from services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/ProjectScope.java rename to services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/ProjectScope.java index 86419bb5..9e51b645 100644 --- a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/ProjectScope.java +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/ProjectScope.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.objectstorage.model; +package cloud.stackit.sdk.objectstorage.v2api.model; import com.google.gson.JsonElement; import com.google.gson.TypeAdapter; diff --git a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/ProjectStatus.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/ProjectStatus.java similarity index 99% rename from services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/ProjectStatus.java rename to services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/ProjectStatus.java index 93754c6b..73f60c83 100644 --- a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/ProjectStatus.java +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/ProjectStatus.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.objectstorage.model; +package cloud.stackit.sdk.objectstorage.v2api.model; -import cloud.stackit.sdk.objectstorage.JSON; +import cloud.stackit.sdk.objectstorage.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/RetentionMode.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/RetentionMode.java similarity index 97% rename from services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/RetentionMode.java rename to services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/RetentionMode.java index 69e829c7..1fb73ae8 100644 --- a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/RetentionMode.java +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/RetentionMode.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.objectstorage.model; +package cloud.stackit.sdk.objectstorage.v2api.model; import com.google.gson.JsonElement; import com.google.gson.TypeAdapter; diff --git a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/SetDefaultRetentionPayload.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/SetDefaultRetentionPayload.java similarity index 99% rename from services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/SetDefaultRetentionPayload.java rename to services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/SetDefaultRetentionPayload.java index c4d7edb9..43d40ded 100644 --- a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/SetDefaultRetentionPayload.java +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/SetDefaultRetentionPayload.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.objectstorage.model; +package cloud.stackit.sdk.objectstorage.v2api.model; -import cloud.stackit.sdk.objectstorage.JSON; +import cloud.stackit.sdk.objectstorage.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/ValidationError.java b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/ValidationError.java similarity index 99% rename from services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/ValidationError.java rename to services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/ValidationError.java index 077a0b10..af194bfd 100644 --- a/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/model/ValidationError.java +++ b/services/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/v2api/model/ValidationError.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.objectstorage.model; +package cloud.stackit.sdk.objectstorage.v2api.model; -import cloud.stackit.sdk.objectstorage.JSON; +import cloud.stackit.sdk.objectstorage.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; diff --git a/services/objectstorage/src/test/java/cloud/stackit/sdk/objectstorage/v1api/api/DefaultApiTest.java b/services/objectstorage/src/test/java/cloud/stackit/sdk/objectstorage/v1api/api/DefaultApiTest.java new file mode 100644 index 00000000..3c110263 --- /dev/null +++ b/services/objectstorage/src/test/java/cloud/stackit/sdk/objectstorage/v1api/api/DefaultApiTest.java @@ -0,0 +1,66 @@ +/* + * 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; + +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/objectstorage/src/test/java/cloud/stackit/sdk/objectstorage/v1api/api/ObjectStorageApiTest.java b/services/objectstorage/src/test/java/cloud/stackit/sdk/objectstorage/v1api/api/ObjectStorageApiTest.java new file mode 100644 index 00000000..5d26b744 --- /dev/null +++ b/services/objectstorage/src/test/java/cloud/stackit/sdk/objectstorage/v1api/api/ObjectStorageApiTest.java @@ -0,0 +1,67 @@ +/* + * 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.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 ObjectStorageApi */ +public class ObjectStorageApiTest { + @Test + public void TestCustomHttpClient() throws IOException { + // before + CoreConfiguration conf = + new CoreConfiguration().serviceAccountKey(TestUtils.MOCK_SERVICE_ACCOUNT_KEY); + + // when + OkHttpClient httpClient = new OkHttpClient(); + ObjectStorageApi api = new ObjectStorageApi(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 + ObjectStorageApi api = new ObjectStorageApi(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()); + } +} diff --git a/services/objectstorage/src/test/java/cloud/stackit/sdk/objectstorage/api/DefaultApiTest.java b/services/objectstorage/src/test/java/cloud/stackit/sdk/objectstorage/v2api/api/DefaultApiTest.java similarity index 97% rename from services/objectstorage/src/test/java/cloud/stackit/sdk/objectstorage/api/DefaultApiTest.java rename to services/objectstorage/src/test/java/cloud/stackit/sdk/objectstorage/v2api/api/DefaultApiTest.java index 99444a5a..bc2a18a8 100644 --- a/services/objectstorage/src/test/java/cloud/stackit/sdk/objectstorage/api/DefaultApiTest.java +++ b/services/objectstorage/src/test/java/cloud/stackit/sdk/objectstorage/v2api/api/DefaultApiTest.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.objectstorage; +package cloud.stackit.sdk.objectstorage.v2api; import cloud.stackit.sdk.core.KeyFlowAuthenticator; import cloud.stackit.sdk.core.auth.SetupAuth; diff --git a/services/objectstorage/src/test/java/cloud/stackit/sdk/objectstorage/api/ObjectStorageApiTest.java b/services/objectstorage/src/test/java/cloud/stackit/sdk/objectstorage/v2api/api/ObjectStorageApiTest.java similarity index 97% rename from services/objectstorage/src/test/java/cloud/stackit/sdk/objectstorage/api/ObjectStorageApiTest.java rename to services/objectstorage/src/test/java/cloud/stackit/sdk/objectstorage/v2api/api/ObjectStorageApiTest.java index d6730638..f5a9c802 100644 --- a/services/objectstorage/src/test/java/cloud/stackit/sdk/objectstorage/api/ObjectStorageApiTest.java +++ b/services/objectstorage/src/test/java/cloud/stackit/sdk/objectstorage/v2api/api/ObjectStorageApiTest.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.objectstorage.api; +package cloud.stackit.sdk.objectstorage.v2api.api; import cloud.stackit.sdk.core.KeyFlowAuthenticator; import cloud.stackit.sdk.core.auth.SetupAuth; From 650900634f4cf047bd27e1fee99149a0b63e723d Mon Sep 17 00:00:00 2001 From: Ruben Hoenle Date: Fri, 24 Apr 2026 14:35:46 +0200 Subject: [PATCH 2/3] examples --- .../sdk/objectstorage/examples/ObjectStorageExample.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/examples/ObjectStorageExample.java b/examples/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/examples/ObjectStorageExample.java index 97baeb53..78bf9dc9 100644 --- a/examples/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/examples/ObjectStorageExample.java +++ b/examples/objectstorage/src/main/java/cloud/stackit/sdk/objectstorage/examples/ObjectStorageExample.java @@ -3,8 +3,8 @@ import cloud.stackit.sdk.core.KeyFlowAuthenticator; import cloud.stackit.sdk.core.config.CoreConfiguration; import cloud.stackit.sdk.core.exception.ApiException; -import cloud.stackit.sdk.objectstorage.api.ObjectStorageApi; -import cloud.stackit.sdk.objectstorage.model.*; +import cloud.stackit.sdk.objectstorage.v2api.api.ObjectStorageApi; +import cloud.stackit.sdk.objectstorage.v2api.model.*; import java.io.IOException; import java.net.HttpURLConnection; import java.time.Duration; From 286049f8fecfa12afad88c35285adf7a67e4308c Mon Sep 17 00:00:00 2001 From: Ruben Hoenle Date: Fri, 24 Apr 2026 14:37:22 +0200 Subject: [PATCH 3/3] changelogs --- CHANGELOG.md | 2 ++ services/objectstorage/CHANGELOG.md | 3 +++ services/objectstorage/VERSION | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f17d0b23..69d0072e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ - **Feature (breaking change):** Introduction of multi API version support. See the GitHub discussion post for more details: https://github.com/stackitcloud/stackit-sdk-java/discussions/530 - `sfs`: [v0.3.1](services/sfs/CHANGELOG.md#v031) - Deprecate `getSchedule` and `listSchedules` methods in `SfsApi` class +- `objectstorage`: [v0.3.0](services/objectstorage/CHANGELOG.md#v030) + - **Feature (breaking change):** Introduction of multi API version support. See the GitHub discussion post for more details: https://github.com/stackitcloud/stackit-sdk-java/discussions/530 ## Release (2026-04-08) - `alb`: [v0.5.0](services/alb/CHANGELOG.md#v050) diff --git a/services/objectstorage/CHANGELOG.md b/services/objectstorage/CHANGELOG.md index 8b3d5992..cf46a967 100644 --- a/services/objectstorage/CHANGELOG.md +++ b/services/objectstorage/CHANGELOG.md @@ -1,3 +1,6 @@ +## v0.3.0 +- **Feature (breaking change):** Introduction of multi API version support. See the GitHub discussion post for more details: https://github.com/stackitcloud/stackit-sdk-java/discussions/530 + ## v0.2.0 - New model classes: `ComplianceLockResponse`, `CredentialsGroupExtended`, `DefaultRetentionResponse`, `DeleteDefaultRetentionResponse`, `GetCredentialsGroupResponse`, `SetDefaultRetentionPayload` - New methods for `Bucket` model class: `objectLockEnabled`,`setObjectLockEnabled`,`getObjectLockEnabled` diff --git a/services/objectstorage/VERSION b/services/objectstorage/VERSION index 0ea3a944..0d91a54c 100644 --- a/services/objectstorage/VERSION +++ b/services/objectstorage/VERSION @@ -1 +1 @@ -0.2.0 +0.3.0