diff --git a/CHANGELOG.md b/CHANGELOG.md index f17d0b23..2d4f6327 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,14 @@ ## Release (2026-MM-DD) +- `alb`: [v0.5.0](services/alb/CHANGELOG.md#v050) + - **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 +- `iaas`: [v1.2.0](services/resourcemanager/CHANGELOG.md#v120) + - **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 - `resourcemanager`: [v0.5.0](services/resourcemanager/CHANGELOG.md#v050) - **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 ## Release (2026-04-08) -- `alb`: [v0.5.0](services/alb/CHANGELOG.md#v050) - - **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 - `iaas`: - [v1.0.1](services/iaas/CHANGELOG.md#v101) - **Docs:** Extend docs of class `PortRange` diff --git a/examples/custom-http-client/src/main/java/cloud/stackit/sdk/customhttpclient/examples/CustomHttpClientExample.java b/examples/custom-http-client/src/main/java/cloud/stackit/sdk/customhttpclient/examples/CustomHttpClientExample.java index 602cd789..914b2b2f 100644 --- a/examples/custom-http-client/src/main/java/cloud/stackit/sdk/customhttpclient/examples/CustomHttpClientExample.java +++ b/examples/custom-http-client/src/main/java/cloud/stackit/sdk/customhttpclient/examples/CustomHttpClientExample.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.iaas.api.IaasApi; -import cloud.stackit.sdk.iaas.model.*; +import cloud.stackit.sdk.iaas.v2api.api.IaasApi; +import cloud.stackit.sdk.iaas.v2api.model.*; import java.io.IOException; import java.util.UUID; import okhttp3.OkHttpClient; diff --git a/examples/iaas/src/main/java/cloud/stackit/sdk/iaas/examples/IaaSExample.java b/examples/iaas/src/main/java/cloud/stackit/sdk/iaas/examples/IaaSExample.java index d31ba0af..0f984d5d 100644 --- a/examples/iaas/src/main/java/cloud/stackit/sdk/iaas/examples/IaaSExample.java +++ b/examples/iaas/src/main/java/cloud/stackit/sdk/iaas/examples/IaaSExample.java @@ -1,8 +1,8 @@ package cloud.stackit.sdk.iaas.examples; import cloud.stackit.sdk.core.exception.ApiException; -import cloud.stackit.sdk.iaas.api.IaasApi; -import cloud.stackit.sdk.iaas.model.*; +import cloud.stackit.sdk.iaas.v2api.api.IaasApi; +import cloud.stackit.sdk.iaas.v2api.model.*; import java.io.IOException; import java.net.HttpURLConnection; import java.util.Collections; diff --git a/examples/serverbackup/src/main/java/cloud/stackit/sdk/serverbackup/examples/ServerbackupExample.java b/examples/serverbackup/src/main/java/cloud/stackit/sdk/serverbackup/examples/ServerBackupExample.java similarity index 98% rename from examples/serverbackup/src/main/java/cloud/stackit/sdk/serverbackup/examples/ServerbackupExample.java rename to examples/serverbackup/src/main/java/cloud/stackit/sdk/serverbackup/examples/ServerBackupExample.java index 03e1db49..1b7edbbf 100644 --- a/examples/serverbackup/src/main/java/cloud/stackit/sdk/serverbackup/examples/ServerbackupExample.java +++ b/examples/serverbackup/src/main/java/cloud/stackit/sdk/serverbackup/examples/ServerBackupExample.java @@ -1,8 +1,8 @@ package cloud.stackit.sdk.serverbackup.examples; import cloud.stackit.sdk.core.exception.ApiException; -import cloud.stackit.sdk.iaas.api.IaasApi; -import cloud.stackit.sdk.iaas.model.*; +import cloud.stackit.sdk.iaas.v2api.api.IaasApi; +import cloud.stackit.sdk.iaas.v2api.model.*; import cloud.stackit.sdk.serverbackup.api.ServerBackupApi; import cloud.stackit.sdk.serverbackup.model.*; import cloud.stackit.sdk.serverbackup.model.Backup; diff --git a/services/iaas/CHANGELOG.md b/services/iaas/CHANGELOG.md index e1c9214c..ffa8e7d3 100644 --- a/services/iaas/CHANGELOG.md +++ b/services/iaas/CHANGELOG.md @@ -1,3 +1,6 @@ +## v1.2.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 + ## v1.1.0 - **Feature:** Add `cascade` parameter to `deleteVolume` methods in `DefaultApi` / `IaasApi` class - **Feature:** Add methods for new attribute `configDrive` in `CreateServerPayload` and `Server` class diff --git a/services/iaas/README.md b/services/iaas/README.md index 2ff59cdb..c07f06f2 100644 --- a/services/iaas/README.md +++ b/services/iaas/README.md @@ -1,11 +1,5 @@ # STACKIT Java SDK for STACKIT IaaS API -- API version: 2 - -This API allows you to create and modify IaaS resources. - -For more information, please visit [https://support.stackit.cloud/servicedesk](https://support.stackit.cloud/servicedesk) - 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/iaas/VERSION b/services/iaas/VERSION index 9084fa2f..26aaba0e 100644 --- a/services/iaas/VERSION +++ b/services/iaas/VERSION @@ -1 +1 @@ -1.1.0 +1.2.0 diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/ApiCallback.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/ApiCallback.java new file mode 100644 index 00000000..fb30e656 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/ApiCallback.java @@ -0,0 +1,60 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.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/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/ApiClient.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/ApiClient.java new file mode 100644 index 00000000..1c5fcbfb --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/ApiClient.java @@ -0,0 +1,1601 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.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://iaas.api.eu01.stackit.cloud"; + protected List servers = + new ArrayList( + Arrays.asList( + new ServerConfiguration( + "https://iaas.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/iaas"); + } + + /** + * Get base path + * + * @return Base path + */ + public String getBasePath() { + return basePath; + } + + /** + * Set base path + * + * @param basePath Base path of the URL (e.g https://iaas.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.iaas.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.iaas.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.iaas.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.iaas.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.iaas.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/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/ApiResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/ApiResponse.java new file mode 100644 index 00000000..0646d36d --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/ApiResponse.java @@ -0,0 +1,73 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.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/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/GzipRequestInterceptor.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/GzipRequestInterceptor.java new file mode 100644 index 00000000..98c6ba3f --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/GzipRequestInterceptor.java @@ -0,0 +1,87 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.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/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/JSON.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/JSON.java new file mode 100644 index 00000000..17b81fd9 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/JSON.java @@ -0,0 +1,748 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.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.iaas.v1api.model.AddVolumeToServerPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.AffinityGroup.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.AffinityGroupListResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.AllowedAddressesInner + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.Area.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.AreaConfig.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.AreaId.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.AreaPrefixConfigIPv4 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.AvailabilityZoneListResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.Backup.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.BackupListResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.BackupSource.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.BaseSecurityGroupRule + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.BootVolume.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.BootVolumeSource.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.CreateAffinityGroupPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.CreateAreaAddressFamily + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.CreateAreaIPv4.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.CreateBackupPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.CreateImagePayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.CreateKeyPairPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.CreateNetworkAddressFamily + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.CreateNetworkAreaPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.CreateNetworkAreaRangePayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.CreateNetworkAreaRoutePayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.CreateNetworkIPv4Body + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.CreateNetworkIPv6Body + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.CreateNetworkPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.CreateNicPayload.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.CreateProtocol.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.CreatePublicIPPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.CreateSecurityGroupPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.CreateSecurityGroupRulePayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.CreateSecurityGroupRuleProtocol + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.CreateServerNetworking + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.CreateServerNetworkingWithNics + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.CreateServerPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.CreateServerPayloadNetworking + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.CreateSnapshotPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.CreateVolumePayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.Error.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.GetServerLog200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.ICMPParameters.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.Image.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.ImageAgent.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.ImageChecksum.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.ImageConfig.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.ImageCreateResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.ImageListResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.ImageShare.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.ImageShareConsumer + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.KeyPairListResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.Keypair.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.MachineType.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.MachineTypeListResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.NIC.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.NICListResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.Network.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.NetworkArea.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.NetworkAreaIPv4.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.NetworkAreaListResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.NetworkListResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.NetworkRange.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.NetworkRangeListResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.PartialUpdateNetworkAreaPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.PartialUpdateNetworkPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.PortRange.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.Project.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.ProjectListResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.Protocol.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.PublicIp.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.PublicIpListResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.PublicNetwork.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.PublicNetworkListResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.Quota.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.QuotaList.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.QuotaListResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.Request.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.RequestResource.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.RescueServerPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.ResizeServerPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.ResizeVolumePayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.Route.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.RouteListResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.SecurityGroup.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.SecurityGroupListResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.SecurityGroupRule + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.SecurityGroupRuleListResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.SecurityGroupRuleProtocol + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.Server.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.ServerAgent.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.ServerConsoleUrl.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.ServerListResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.ServerMaintenance + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.ServerNetwork.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.ServerNetworking.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.ServiceAccountMailListResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.SetImageSharePayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.Snapshot.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.SnapshotListResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.UpdateAreaAddressFamily + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.UpdateAreaIPv4.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.UpdateAttachedVolumePayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.UpdateBackupPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.UpdateImagePayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.UpdateImageSharePayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.UpdateKeyPairPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.UpdateNetworkAddressFamily + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.UpdateNetworkAreaRoutePayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.UpdateNetworkIPv4Body + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.UpdateNetworkIPv6Body + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.UpdateNicPayload.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.UpdatePublicIPPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.UpdateSecurityGroupPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.UpdateServerPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.UpdateSnapshotPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.UpdateVolumePayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.Volume.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.VolumeAttachment.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.VolumeAttachmentListResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.VolumeEncryptionParameter + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.VolumeListResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.VolumePerformanceClass + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.VolumePerformanceClassListResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v1api.model.VolumeSource.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/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/Pair.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/Pair.java new file mode 100644 index 00000000..048cff4e --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/Pair.java @@ -0,0 +1,38 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.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/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/ProgressRequestBody.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/ProgressRequestBody.java new file mode 100644 index 00000000..3235f02b --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/ProgressRequestBody.java @@ -0,0 +1,71 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.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/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/ProgressResponseBody.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/ProgressResponseBody.java new file mode 100644 index 00000000..b60d2a2e --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/ProgressResponseBody.java @@ -0,0 +1,68 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.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/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/ServerConfiguration.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/ServerConfiguration.java new file mode 100644 index 00000000..e90c5615 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/ServerConfiguration.java @@ -0,0 +1,79 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.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/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/ServerVariable.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/ServerVariable.java new file mode 100644 index 00000000..0ec714a9 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/ServerVariable.java @@ -0,0 +1,37 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.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/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/StringUtil.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/StringUtil.java new file mode 100644 index 00000000..54747029 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/StringUtil.java @@ -0,0 +1,83 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.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/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/api/DefaultApi.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/api/DefaultApi.java new file mode 100644 index 00000000..2d6ca8c9 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/api/DefaultApi.java @@ -0,0 +1,26384 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.api; + +import cloud.stackit.sdk.core.config.CoreConfiguration; +import cloud.stackit.sdk.core.exception.ApiException; +import cloud.stackit.sdk.iaas.v1api.ApiCallback; +import cloud.stackit.sdk.iaas.v1api.ApiClient; +import cloud.stackit.sdk.iaas.v1api.ApiResponse; +import cloud.stackit.sdk.iaas.v1api.Pair; +import cloud.stackit.sdk.iaas.v1api.model.AddVolumeToServerPayload; +import cloud.stackit.sdk.iaas.v1api.model.AffinityGroup; +import cloud.stackit.sdk.iaas.v1api.model.AffinityGroupListResponse; +import cloud.stackit.sdk.iaas.v1api.model.AvailabilityZoneListResponse; +import cloud.stackit.sdk.iaas.v1api.model.Backup; +import cloud.stackit.sdk.iaas.v1api.model.BackupListResponse; +import cloud.stackit.sdk.iaas.v1api.model.CreateAffinityGroupPayload; +import cloud.stackit.sdk.iaas.v1api.model.CreateBackupPayload; +import cloud.stackit.sdk.iaas.v1api.model.CreateImagePayload; +import cloud.stackit.sdk.iaas.v1api.model.CreateKeyPairPayload; +import cloud.stackit.sdk.iaas.v1api.model.CreateNetworkAreaPayload; +import cloud.stackit.sdk.iaas.v1api.model.CreateNetworkAreaRangePayload; +import cloud.stackit.sdk.iaas.v1api.model.CreateNetworkAreaRoutePayload; +import cloud.stackit.sdk.iaas.v1api.model.CreateNetworkPayload; +import cloud.stackit.sdk.iaas.v1api.model.CreateNicPayload; +import cloud.stackit.sdk.iaas.v1api.model.CreatePublicIPPayload; +import cloud.stackit.sdk.iaas.v1api.model.CreateSecurityGroupPayload; +import cloud.stackit.sdk.iaas.v1api.model.CreateSecurityGroupRulePayload; +import cloud.stackit.sdk.iaas.v1api.model.CreateServerPayload; +import cloud.stackit.sdk.iaas.v1api.model.CreateSnapshotPayload; +import cloud.stackit.sdk.iaas.v1api.model.CreateVolumePayload; +import cloud.stackit.sdk.iaas.v1api.model.GetServerLog200Response; +import cloud.stackit.sdk.iaas.v1api.model.Image; +import cloud.stackit.sdk.iaas.v1api.model.ImageCreateResponse; +import cloud.stackit.sdk.iaas.v1api.model.ImageListResponse; +import cloud.stackit.sdk.iaas.v1api.model.ImageShare; +import cloud.stackit.sdk.iaas.v1api.model.ImageShareConsumer; +import cloud.stackit.sdk.iaas.v1api.model.KeyPairListResponse; +import cloud.stackit.sdk.iaas.v1api.model.Keypair; +import cloud.stackit.sdk.iaas.v1api.model.MachineType; +import cloud.stackit.sdk.iaas.v1api.model.MachineTypeListResponse; +import cloud.stackit.sdk.iaas.v1api.model.NIC; +import cloud.stackit.sdk.iaas.v1api.model.NICListResponse; +import cloud.stackit.sdk.iaas.v1api.model.Network; +import cloud.stackit.sdk.iaas.v1api.model.NetworkArea; +import cloud.stackit.sdk.iaas.v1api.model.NetworkAreaListResponse; +import cloud.stackit.sdk.iaas.v1api.model.NetworkListResponse; +import cloud.stackit.sdk.iaas.v1api.model.NetworkRange; +import cloud.stackit.sdk.iaas.v1api.model.NetworkRangeListResponse; +import cloud.stackit.sdk.iaas.v1api.model.PartialUpdateNetworkAreaPayload; +import cloud.stackit.sdk.iaas.v1api.model.PartialUpdateNetworkPayload; +import cloud.stackit.sdk.iaas.v1api.model.Project; +import cloud.stackit.sdk.iaas.v1api.model.ProjectListResponse; +import cloud.stackit.sdk.iaas.v1api.model.PublicIp; +import cloud.stackit.sdk.iaas.v1api.model.PublicIpListResponse; +import cloud.stackit.sdk.iaas.v1api.model.PublicNetworkListResponse; +import cloud.stackit.sdk.iaas.v1api.model.QuotaListResponse; +import cloud.stackit.sdk.iaas.v1api.model.Request; +import cloud.stackit.sdk.iaas.v1api.model.RescueServerPayload; +import cloud.stackit.sdk.iaas.v1api.model.ResizeServerPayload; +import cloud.stackit.sdk.iaas.v1api.model.ResizeVolumePayload; +import cloud.stackit.sdk.iaas.v1api.model.Route; +import cloud.stackit.sdk.iaas.v1api.model.RouteListResponse; +import cloud.stackit.sdk.iaas.v1api.model.SecurityGroup; +import cloud.stackit.sdk.iaas.v1api.model.SecurityGroupListResponse; +import cloud.stackit.sdk.iaas.v1api.model.SecurityGroupRule; +import cloud.stackit.sdk.iaas.v1api.model.SecurityGroupRuleListResponse; +import cloud.stackit.sdk.iaas.v1api.model.Server; +import cloud.stackit.sdk.iaas.v1api.model.ServerConsoleUrl; +import cloud.stackit.sdk.iaas.v1api.model.ServerListResponse; +import cloud.stackit.sdk.iaas.v1api.model.ServiceAccountMailListResponse; +import cloud.stackit.sdk.iaas.v1api.model.SetImageSharePayload; +import cloud.stackit.sdk.iaas.v1api.model.Snapshot; +import cloud.stackit.sdk.iaas.v1api.model.SnapshotListResponse; +import cloud.stackit.sdk.iaas.v1api.model.UpdateAttachedVolumePayload; +import cloud.stackit.sdk.iaas.v1api.model.UpdateBackupPayload; +import cloud.stackit.sdk.iaas.v1api.model.UpdateImagePayload; +import cloud.stackit.sdk.iaas.v1api.model.UpdateImageSharePayload; +import cloud.stackit.sdk.iaas.v1api.model.UpdateKeyPairPayload; +import cloud.stackit.sdk.iaas.v1api.model.UpdateNetworkAreaRoutePayload; +import cloud.stackit.sdk.iaas.v1api.model.UpdateNicPayload; +import cloud.stackit.sdk.iaas.v1api.model.UpdatePublicIPPayload; +import cloud.stackit.sdk.iaas.v1api.model.UpdateSecurityGroupPayload; +import cloud.stackit.sdk.iaas.v1api.model.UpdateServerPayload; +import cloud.stackit.sdk.iaas.v1api.model.UpdateSnapshotPayload; +import cloud.stackit.sdk.iaas.v1api.model.UpdateVolumePayload; +import cloud.stackit.sdk.iaas.v1api.model.Volume; +import cloud.stackit.sdk.iaas.v1api.model.VolumeAttachment; +import cloud.stackit.sdk.iaas.v1api.model.VolumeAttachmentListResponse; +import cloud.stackit.sdk.iaas.v1api.model.VolumeListResponse; +import cloud.stackit.sdk.iaas.v1api.model.VolumePerformanceClass; +import cloud.stackit.sdk.iaas.v1api.model.VolumePerformanceClassListResponse; +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 java.util.UUID; +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 addNetworkToServer + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (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
202 Create and attach network interface was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call addNetworkToServerCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID networkId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/servers/{serverId}/networks/{networkId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())) + .replace( + "{" + "networkId" + "}", + localVarApiClient.escapeString(networkId.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call addNetworkToServerValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID networkId, + 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 addNetworkToServer(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling addNetworkToServer(Async)"); + } + + // verify the required parameter 'networkId' is set + if (networkId == null) { + throw new ApiException( + "Missing the required parameter 'networkId' when calling addNetworkToServer(Async)"); + } + + return addNetworkToServerCall(projectId, serverId, networkId, _callback); + } + + /** + * Create and attach a network interface from the specified network. Create and attach a network + * interface from the specified network to the server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Create and attach network interface was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public void addNetworkToServer( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID networkId) + throws ApiException { + addNetworkToServerWithHttpInfo(projectId, serverId, networkId); + } + + /** + * Create and attach a network interface from the specified network. Create and attach a network + * interface from the specified network to the server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Create and attach network interface was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse addNetworkToServerWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID networkId) + throws ApiException { + okhttp3.Call localVarCall = + addNetworkToServerValidateBeforeCall(projectId, serverId, networkId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Create and attach a network interface from the specified network. (asynchronously) Create and + * attach a network interface from the specified network to the server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (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
202 Create and attach network interface was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call addNetworkToServerAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID networkId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + addNetworkToServerValidateBeforeCall(projectId, serverId, networkId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for addNicToServer + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param nicId The identifier (ID) of a network interface. (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
202 Network interface attachment request was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call addNicToServerCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID nicId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/servers/{serverId}/nics/{nicId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())) + .replace( + "{" + "nicId" + "}", + localVarApiClient.escapeString(nicId.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, + "PUT", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call addNicToServerValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID nicId, + 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 addNicToServer(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling addNicToServer(Async)"); + } + + // verify the required parameter 'nicId' is set + if (nicId == null) { + throw new ApiException( + "Missing the required parameter 'nicId' when calling addNicToServer(Async)"); + } + + return addNicToServerCall(projectId, serverId, nicId, _callback); + } + + /** + * Attach an existing network interface. Attach an existing network interface to a server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param nicId The identifier (ID) of a network interface. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Network interface attachment request was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public void addNicToServer( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID nicId) + throws ApiException { + addNicToServerWithHttpInfo(projectId, serverId, nicId); + } + + /** + * Attach an existing network interface. Attach an existing network interface to a server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param nicId The identifier (ID) of a network interface. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Network interface attachment request was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse addNicToServerWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID nicId) + throws ApiException { + okhttp3.Call localVarCall = + addNicToServerValidateBeforeCall(projectId, serverId, nicId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Attach an existing network interface. (asynchronously) Attach an existing network interface + * to a server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param nicId The identifier (ID) of a network interface. (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
202 Network interface attachment request was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call addNicToServerAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID nicId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + addNicToServerValidateBeforeCall(projectId, serverId, nicId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for addPublicIpToServer + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param publicIpId The identifier (ID) of a Public IP. (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
202 Attach Public IP to server was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call addPublicIpToServerCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID publicIpId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/servers/{serverId}/public-ips/{publicIpId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())) + .replace( + "{" + "publicIpId" + "}", + localVarApiClient.escapeString(publicIpId.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, + "PUT", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call addPublicIpToServerValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID publicIpId, + 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 addPublicIpToServer(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling addPublicIpToServer(Async)"); + } + + // verify the required parameter 'publicIpId' is set + if (publicIpId == null) { + throw new ApiException( + "Missing the required parameter 'publicIpId' when calling addPublicIpToServer(Async)"); + } + + return addPublicIpToServerCall(projectId, serverId, publicIpId, _callback); + } + + /** + * Associate a public IP to the server. Associate a public IP to a server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param publicIpId The identifier (ID) of a Public IP. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Attach Public IP to server was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public void addPublicIpToServer( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID publicIpId) + throws ApiException { + addPublicIpToServerWithHttpInfo(projectId, serverId, publicIpId); + } + + /** + * Associate a public IP to the server. Associate a public IP to a server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param publicIpId The identifier (ID) of a Public IP. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Attach Public IP to server was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse addPublicIpToServerWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID publicIpId) + throws ApiException { + okhttp3.Call localVarCall = + addPublicIpToServerValidateBeforeCall(projectId, serverId, publicIpId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Associate a public IP to the server. (asynchronously) Associate a public IP to a server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param publicIpId The identifier (ID) of a Public IP. (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
202 Attach Public IP to server was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call addPublicIpToServerAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID publicIpId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + addPublicIpToServerValidateBeforeCall(projectId, serverId, publicIpId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for addSecurityGroupToServer + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security 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
202 Security group attachment request was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call addSecurityGroupToServerCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID securityGroupId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/servers/{serverId}/security-groups/{securityGroupId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())) + .replace( + "{" + "securityGroupId" + "}", + localVarApiClient.escapeString(securityGroupId.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, + "PUT", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call addSecurityGroupToServerValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID securityGroupId, + 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 addSecurityGroupToServer(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling addSecurityGroupToServer(Async)"); + } + + // verify the required parameter 'securityGroupId' is set + if (securityGroupId == null) { + throw new ApiException( + "Missing the required parameter 'securityGroupId' when calling addSecurityGroupToServer(Async)"); + } + + return addSecurityGroupToServerCall(projectId, serverId, securityGroupId, _callback); + } + + /** + * Add a server to a security group. Add an existing server to an existing security group. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security Group. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Security group attachment request was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public void addSecurityGroupToServer( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID securityGroupId) + throws ApiException { + addSecurityGroupToServerWithHttpInfo(projectId, serverId, securityGroupId); + } + + /** + * Add a server to a security group. Add an existing server to an existing security group. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security Group. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Security group attachment request was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse addSecurityGroupToServerWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID securityGroupId) + throws ApiException { + okhttp3.Call localVarCall = + addSecurityGroupToServerValidateBeforeCall( + projectId, serverId, securityGroupId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Add a server to a security group. (asynchronously) Add an existing server to an existing + * security group. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security 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
202 Security group attachment request was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call addSecurityGroupToServerAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID securityGroupId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + addSecurityGroupToServerValidateBeforeCall( + projectId, serverId, securityGroupId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for addServiceAccountToServer + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param serviceAccountMail The e-mail address of a service account. (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 Service account attached to the server. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call addServiceAccountToServerCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull String serviceAccountMail, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/servers/{serverId}/service-accounts/{serviceAccountMail}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())) + .replace( + "{" + "serviceAccountMail" + "}", + localVarApiClient.escapeString(serviceAccountMail.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, + "PUT", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call addServiceAccountToServerValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull String serviceAccountMail, + 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 addServiceAccountToServer(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling addServiceAccountToServer(Async)"); + } + + // verify the required parameter 'serviceAccountMail' is set + if (serviceAccountMail == null) { + throw new ApiException( + "Missing the required parameter 'serviceAccountMail' when calling addServiceAccountToServer(Async)"); + } + + return addServiceAccountToServerCall(projectId, serverId, serviceAccountMail, _callback); + } + + /** + * Attach service account to a server. Attach an additional service account to the server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param serviceAccountMail The e-mail address of a service account. (required) + * @return ServiceAccountMailListResponse + * @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 Service account attached to the server. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ServiceAccountMailListResponse addServiceAccountToServer( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull String serviceAccountMail) + throws ApiException { + ApiResponse localVarResp = + addServiceAccountToServerWithHttpInfo(projectId, serverId, serviceAccountMail); + return localVarResp.getData(); + } + + /** + * Attach service account to a server. Attach an additional service account to the server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param serviceAccountMail The e-mail address of a service account. (required) + * @return ApiResponse<ServiceAccountMailListResponse> + * @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 Service account attached to the server. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse addServiceAccountToServerWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull String serviceAccountMail) + throws ApiException { + okhttp3.Call localVarCall = + addServiceAccountToServerValidateBeforeCall( + projectId, serverId, serviceAccountMail, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Attach service account to a server. (asynchronously) Attach an additional service account to + * the server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param serviceAccountMail The e-mail address of a service account. (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 Service account attached to the server. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call addServiceAccountToServerAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull String serviceAccountMail, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + addServiceAccountToServerValidateBeforeCall( + projectId, serverId, serviceAccountMail, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for addVolumeToServer + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @param addVolumeToServerPayload Request a volume attachment creation. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Volume attachment request was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call addVolumeToServerCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID volumeId, + @javax.annotation.Nullable AddVolumeToServerPayload addVolumeToServerPayload, + 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 = addVolumeToServerPayload; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/servers/{serverId}/volume-attachments/{volumeId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())) + .replace( + "{" + "volumeId" + "}", + localVarApiClient.escapeString(volumeId.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call addVolumeToServerValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID volumeId, + @javax.annotation.Nullable AddVolumeToServerPayload addVolumeToServerPayload, + 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 addVolumeToServer(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling addVolumeToServer(Async)"); + } + + // verify the required parameter 'volumeId' is set + if (volumeId == null) { + throw new ApiException( + "Missing the required parameter 'volumeId' when calling addVolumeToServer(Async)"); + } + + return addVolumeToServerCall( + projectId, serverId, volumeId, addVolumeToServerPayload, _callback); + } + + /** + * Attach a volume to a server. Attach an existing volume to an existing server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @param addVolumeToServerPayload Request a volume attachment creation. (optional) + * @return VolumeAttachment + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Volume attachment request was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public VolumeAttachment addVolumeToServer( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID volumeId, + @javax.annotation.Nullable AddVolumeToServerPayload addVolumeToServerPayload) + throws ApiException { + ApiResponse localVarResp = + addVolumeToServerWithHttpInfo( + projectId, serverId, volumeId, addVolumeToServerPayload); + return localVarResp.getData(); + } + + /** + * Attach a volume to a server. Attach an existing volume to an existing server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @param addVolumeToServerPayload Request a volume attachment creation. (optional) + * @return ApiResponse<VolumeAttachment> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Volume attachment request was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse addVolumeToServerWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID volumeId, + @javax.annotation.Nullable AddVolumeToServerPayload addVolumeToServerPayload) + throws ApiException { + okhttp3.Call localVarCall = + addVolumeToServerValidateBeforeCall( + projectId, serverId, volumeId, addVolumeToServerPayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Attach a volume to a server. (asynchronously) Attach an existing volume to an existing + * server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @param addVolumeToServerPayload Request a volume attachment creation. (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Volume attachment request was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call addVolumeToServerAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID volumeId, + @javax.annotation.Nullable AddVolumeToServerPayload addVolumeToServerPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + addVolumeToServerValidateBeforeCall( + projectId, serverId, volumeId, addVolumeToServerPayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for createAffinityGroup + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param createAffinityGroupPayload Request a affinity group creation. (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 Affinity group was created successfully. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call createAffinityGroupCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull CreateAffinityGroupPayload createAffinityGroupPayload, + 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 = createAffinityGroupPayload; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/affinity-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 = {"application/json"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call createAffinityGroupValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull CreateAffinityGroupPayload createAffinityGroupPayload, + 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 createAffinityGroup(Async)"); + } + + // verify the required parameter 'createAffinityGroupPayload' is set + if (createAffinityGroupPayload == null) { + throw new ApiException( + "Missing the required parameter 'createAffinityGroupPayload' when calling createAffinityGroup(Async)"); + } + + return createAffinityGroupCall(projectId, createAffinityGroupPayload, _callback); + } + + /** + * Create a new affinity group in a project. Create a new server affinity group in the given + * project ID. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param createAffinityGroupPayload Request a affinity group creation. (required) + * @return AffinityGroup + * @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 Affinity group was created successfully. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public AffinityGroup createAffinityGroup( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull CreateAffinityGroupPayload createAffinityGroupPayload) + throws ApiException { + ApiResponse localVarResp = + createAffinityGroupWithHttpInfo(projectId, createAffinityGroupPayload); + return localVarResp.getData(); + } + + /** + * Create a new affinity group in a project. Create a new server affinity group in the given + * project ID. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param createAffinityGroupPayload Request a affinity group creation. (required) + * @return ApiResponse<AffinityGroup> + * @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 Affinity group was created successfully. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse createAffinityGroupWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull CreateAffinityGroupPayload createAffinityGroupPayload) + throws ApiException { + okhttp3.Call localVarCall = + createAffinityGroupValidateBeforeCall(projectId, createAffinityGroupPayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create a new affinity group in a project. (asynchronously) Create a new server affinity group + * in the given project ID. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param createAffinityGroupPayload Request a affinity group creation. (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 Affinity group was created successfully. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call createAffinityGroupAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull CreateAffinityGroupPayload createAffinityGroupPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createAffinityGroupValidateBeforeCall( + projectId, createAffinityGroupPayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for createBackup + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param createBackupPayload Request a backup creation. (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 Create request for Backup accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call createBackupCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull CreateBackupPayload createBackupPayload, + 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 = createBackupPayload; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/backups" + .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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call createBackupValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull CreateBackupPayload createBackupPayload, + 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 createBackup(Async)"); + } + + // verify the required parameter 'createBackupPayload' is set + if (createBackupPayload == null) { + throw new ApiException( + "Missing the required parameter 'createBackupPayload' when calling createBackup(Async)"); + } + + return createBackupCall(projectId, createBackupPayload, _callback); + } + + /** + * Create new Backup. Create a new Backup in a project. If a snapshot ID is provided create the + * backup from the snapshot. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param createBackupPayload Request a backup creation. (required) + * @return Backup + * @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 Create request for Backup accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public Backup createBackup( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull CreateBackupPayload createBackupPayload) + throws ApiException { + ApiResponse localVarResp = createBackupWithHttpInfo(projectId, createBackupPayload); + return localVarResp.getData(); + } + + /** + * Create new Backup. Create a new Backup in a project. If a snapshot ID is provided create the + * backup from the snapshot. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param createBackupPayload Request a backup creation. (required) + * @return ApiResponse<Backup> + * @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 Create request for Backup accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse createBackupWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull CreateBackupPayload createBackupPayload) + throws ApiException { + okhttp3.Call localVarCall = + createBackupValidateBeforeCall(projectId, createBackupPayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create new Backup. (asynchronously) Create a new Backup in a project. If a snapshot ID is + * provided create the backup from the snapshot. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param createBackupPayload Request a backup creation. (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 Create request for Backup accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call createBackupAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull CreateBackupPayload createBackupPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createBackupValidateBeforeCall(projectId, createBackupPayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for createImage + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param createImagePayload Request an image creation. (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 Create request for an Image has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
429 Too Many Requests. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call createImageCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull CreateImagePayload createImagePayload, + 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 = createImagePayload; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/images" + .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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call createImageValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull CreateImagePayload createImagePayload, + 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 createImage(Async)"); + } + + // verify the required parameter 'createImagePayload' is set + if (createImagePayload == null) { + throw new ApiException( + "Missing the required parameter 'createImagePayload' when calling createImage(Async)"); + } + + return createImageCall(projectId, createImagePayload, _callback); + } + + /** + * Create new Image. Create a new Image in a project. This call, if successful, returns a + * pre-signed URL for the customer to upload the image. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param createImagePayload Request an image creation. (required) + * @return ImageCreateResponse + * @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 Create request for an Image has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
429 Too Many Requests. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ImageCreateResponse createImage( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull CreateImagePayload createImagePayload) + throws ApiException { + ApiResponse localVarResp = + createImageWithHttpInfo(projectId, createImagePayload); + return localVarResp.getData(); + } + + /** + * Create new Image. Create a new Image in a project. This call, if successful, returns a + * pre-signed URL for the customer to upload the image. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param createImagePayload Request an image creation. (required) + * @return ApiResponse<ImageCreateResponse> + * @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 Create request for an Image has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
429 Too Many Requests. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse createImageWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull CreateImagePayload createImagePayload) + throws ApiException { + okhttp3.Call localVarCall = + createImageValidateBeforeCall(projectId, createImagePayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create new Image. (asynchronously) Create a new Image in a project. This call, if successful, + * returns a pre-signed URL for the customer to upload the image. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param createImagePayload Request an image creation. (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 Create request for an Image has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
429 Too Many Requests. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call createImageAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull CreateImagePayload createImagePayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createImageValidateBeforeCall(projectId, createImagePayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for createKeyPair + * + * @param createKeyPairPayload Request a public key import. (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 Import of the public key was successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call createKeyPairCall( + @javax.annotation.Nonnull CreateKeyPairPayload createKeyPairPayload, + 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 = createKeyPairPayload; + + // create path and map variables + String localVarPath = "/v1/keypairs"; + + 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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call createKeyPairValidateBeforeCall( + @javax.annotation.Nonnull CreateKeyPairPayload createKeyPairPayload, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'createKeyPairPayload' is set + if (createKeyPairPayload == null) { + throw new ApiException( + "Missing the required parameter 'createKeyPairPayload' when calling createKeyPair(Async)"); + } + + return createKeyPairCall(createKeyPairPayload, _callback); + } + + /** + * Import a public key. Import a new public key for the requesting user based on provided public + * key material. The creation will fail if an SSH keypair with the same name already exists. If + * a name is not provided it is autogenerated form the ssh-pubkey comment section. If that is + * also not present it will be the the MD5 fingerprint of the key. For autogenerated names + * invalid characters will be removed. Supported keypair types are ecdsa, ed25519 and rsa. + * + * @param createKeyPairPayload Request a public key import. (required) + * @return Keypair + * @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 Import of the public key was successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public Keypair createKeyPair( + @javax.annotation.Nonnull CreateKeyPairPayload createKeyPairPayload) + throws ApiException { + ApiResponse localVarResp = createKeyPairWithHttpInfo(createKeyPairPayload); + return localVarResp.getData(); + } + + /** + * Import a public key. Import a new public key for the requesting user based on provided public + * key material. The creation will fail if an SSH keypair with the same name already exists. If + * a name is not provided it is autogenerated form the ssh-pubkey comment section. If that is + * also not present it will be the the MD5 fingerprint of the key. For autogenerated names + * invalid characters will be removed. Supported keypair types are ecdsa, ed25519 and rsa. + * + * @param createKeyPairPayload Request a public key import. (required) + * @return ApiResponse<Keypair> + * @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 Import of the public key was successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse createKeyPairWithHttpInfo( + @javax.annotation.Nonnull CreateKeyPairPayload createKeyPairPayload) + throws ApiException { + okhttp3.Call localVarCall = createKeyPairValidateBeforeCall(createKeyPairPayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Import a public key. (asynchronously) Import a new public key for the requesting user based + * on provided public key material. The creation will fail if an SSH keypair with the same name + * already exists. If a name is not provided it is autogenerated form the ssh-pubkey comment + * section. If that is also not present it will be the the MD5 fingerprint of the key. For + * autogenerated names invalid characters will be removed. Supported keypair types are ecdsa, + * ed25519 and rsa. + * + * @param createKeyPairPayload Request a public key import. (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 Import of the public key was successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call createKeyPairAsync( + @javax.annotation.Nonnull CreateKeyPairPayload createKeyPairPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createKeyPairValidateBeforeCall(createKeyPairPayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for createNetwork + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param createNetworkPayload Request a network creation. (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
202 Network create has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call createNetworkCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull CreateNetworkPayload createNetworkPayload, + 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 = createNetworkPayload; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/networks" + .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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call createNetworkValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull CreateNetworkPayload createNetworkPayload, + 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 createNetwork(Async)"); + } + + // verify the required parameter 'createNetworkPayload' is set + if (createNetworkPayload == null) { + throw new ApiException( + "Missing the required parameter 'createNetworkPayload' when calling createNetwork(Async)"); + } + + return createNetworkCall(projectId, createNetworkPayload, _callback); + } + + /** + * Create new network. Create a new network in a project. `nameservers` will be filled + * from `defaultNameservers` of the respective area if not specified. If the project + * has `internetAccess` enabled and this is the first network in the project this + * might incur cost. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param createNetworkPayload Request a network creation. (required) + * @return Network + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Network create has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public Network createNetwork( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull CreateNetworkPayload createNetworkPayload) + throws ApiException { + ApiResponse localVarResp = + createNetworkWithHttpInfo(projectId, createNetworkPayload); + return localVarResp.getData(); + } + + /** + * Create new network. Create a new network in a project. `nameservers` will be filled + * from `defaultNameservers` of the respective area if not specified. If the project + * has `internetAccess` enabled and this is the first network in the project this + * might incur cost. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param createNetworkPayload Request a network creation. (required) + * @return ApiResponse<Network> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Network create has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse createNetworkWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull CreateNetworkPayload createNetworkPayload) + throws ApiException { + okhttp3.Call localVarCall = + createNetworkValidateBeforeCall(projectId, createNetworkPayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create new network. (asynchronously) Create a new network in a project. + * `nameservers` will be filled from `defaultNameservers` of the respective + * area if not specified. If the project has `internetAccess` enabled and this is the + * first network in the project this might incur cost. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param createNetworkPayload Request a network creation. (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
202 Network create has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call createNetworkAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull CreateNetworkPayload createNetworkPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createNetworkValidateBeforeCall(projectId, createNetworkPayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for createNetworkArea + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param createNetworkAreaPayload Request an area creation. (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 Area has been successfully created. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call createNetworkAreaCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull CreateNetworkAreaPayload createNetworkAreaPayload, + 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 = createNetworkAreaPayload; + + // create path and map variables + String localVarPath = + "/v1/organizations/{organizationId}/network-areas" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call createNetworkAreaValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull CreateNetworkAreaPayload createNetworkAreaPayload, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling createNetworkArea(Async)"); + } + + // verify the required parameter 'createNetworkAreaPayload' is set + if (createNetworkAreaPayload == null) { + throw new ApiException( + "Missing the required parameter 'createNetworkAreaPayload' when calling createNetworkArea(Async)"); + } + + return createNetworkAreaCall(organizationId, createNetworkAreaPayload, _callback); + } + + /** + * Create new network area in an organization. Create a new network area in an organization. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param createNetworkAreaPayload Request an area creation. (required) + * @return NetworkArea + * @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 Area has been successfully created. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public NetworkArea createNetworkArea( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull CreateNetworkAreaPayload createNetworkAreaPayload) + throws ApiException { + ApiResponse localVarResp = + createNetworkAreaWithHttpInfo(organizationId, createNetworkAreaPayload); + return localVarResp.getData(); + } + + /** + * Create new network area in an organization. Create a new network area in an organization. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param createNetworkAreaPayload Request an area creation. (required) + * @return ApiResponse<NetworkArea> + * @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 Area has been successfully created. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse createNetworkAreaWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull CreateNetworkAreaPayload createNetworkAreaPayload) + throws ApiException { + okhttp3.Call localVarCall = + createNetworkAreaValidateBeforeCall(organizationId, createNetworkAreaPayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create new network area in an organization. (asynchronously) Create a new network area in an + * organization. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param createNetworkAreaPayload Request an area creation. (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 Area has been successfully created. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call createNetworkAreaAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull CreateNetworkAreaPayload createNetworkAreaPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createNetworkAreaValidateBeforeCall( + organizationId, createNetworkAreaPayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for createNetworkAreaRange + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param createNetworkAreaRangePayload Request an addition of network ranges to an area. + * (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 Adding network ranges was successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call createNetworkAreaRangeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull CreateNetworkAreaRangePayload createNetworkAreaRangePayload, + 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 = createNetworkAreaRangePayload; + + // create path and map variables + String localVarPath = + "/v1/organizations/{organizationId}/network-areas/{areaId}/network-ranges" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "areaId" + "}", + localVarApiClient.escapeString(areaId.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call createNetworkAreaRangeValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull CreateNetworkAreaRangePayload createNetworkAreaRangePayload, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling createNetworkAreaRange(Async)"); + } + + // verify the required parameter 'areaId' is set + if (areaId == null) { + throw new ApiException( + "Missing the required parameter 'areaId' when calling createNetworkAreaRange(Async)"); + } + + // verify the required parameter 'createNetworkAreaRangePayload' is set + if (createNetworkAreaRangePayload == null) { + throw new ApiException( + "Missing the required parameter 'createNetworkAreaRangePayload' when calling createNetworkAreaRange(Async)"); + } + + return createNetworkAreaRangeCall( + organizationId, areaId, createNetworkAreaRangePayload, _callback); + } + + /** + * Create new network range in a network area. Create a new network range in an existing network + * area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param createNetworkAreaRangePayload Request an addition of network ranges to an area. + * (required) + * @return NetworkRangeListResponse + * @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 Adding network ranges was successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public NetworkRangeListResponse createNetworkAreaRange( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull CreateNetworkAreaRangePayload createNetworkAreaRangePayload) + throws ApiException { + ApiResponse localVarResp = + createNetworkAreaRangeWithHttpInfo( + organizationId, areaId, createNetworkAreaRangePayload); + return localVarResp.getData(); + } + + /** + * Create new network range in a network area. Create a new network range in an existing network + * area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param createNetworkAreaRangePayload Request an addition of network ranges to an area. + * (required) + * @return ApiResponse<NetworkRangeListResponse> + * @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 Adding network ranges was successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse createNetworkAreaRangeWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull CreateNetworkAreaRangePayload createNetworkAreaRangePayload) + throws ApiException { + okhttp3.Call localVarCall = + createNetworkAreaRangeValidateBeforeCall( + organizationId, areaId, createNetworkAreaRangePayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create new network range in a network area. (asynchronously) Create a new network range in an + * existing network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param createNetworkAreaRangePayload Request an addition of network ranges to an area. + * (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 Adding network ranges was successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call createNetworkAreaRangeAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull CreateNetworkAreaRangePayload createNetworkAreaRangePayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createNetworkAreaRangeValidateBeforeCall( + organizationId, areaId, createNetworkAreaRangePayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for createNetworkAreaRoute + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param createNetworkAreaRoutePayload Request an addition of routes to an area. (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
202 Create request for network routes has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call createNetworkAreaRouteCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull CreateNetworkAreaRoutePayload createNetworkAreaRoutePayload, + 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 = createNetworkAreaRoutePayload; + + // create path and map variables + String localVarPath = + "/v1/organizations/{organizationId}/network-areas/{areaId}/routes" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "areaId" + "}", + localVarApiClient.escapeString(areaId.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call createNetworkAreaRouteValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull CreateNetworkAreaRoutePayload createNetworkAreaRoutePayload, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling createNetworkAreaRoute(Async)"); + } + + // verify the required parameter 'areaId' is set + if (areaId == null) { + throw new ApiException( + "Missing the required parameter 'areaId' when calling createNetworkAreaRoute(Async)"); + } + + // verify the required parameter 'createNetworkAreaRoutePayload' is set + if (createNetworkAreaRoutePayload == null) { + throw new ApiException( + "Missing the required parameter 'createNetworkAreaRoutePayload' when calling createNetworkAreaRoute(Async)"); + } + + return createNetworkAreaRouteCall( + organizationId, areaId, createNetworkAreaRoutePayload, _callback); + } + + /** + * Create new network routes. Create one or several new network routes in a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param createNetworkAreaRoutePayload Request an addition of routes to an area. (required) + * @return RouteListResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Create request for network routes has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public RouteListResponse createNetworkAreaRoute( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull CreateNetworkAreaRoutePayload createNetworkAreaRoutePayload) + throws ApiException { + ApiResponse localVarResp = + createNetworkAreaRouteWithHttpInfo( + organizationId, areaId, createNetworkAreaRoutePayload); + return localVarResp.getData(); + } + + /** + * Create new network routes. Create one or several new network routes in a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param createNetworkAreaRoutePayload Request an addition of routes to an area. (required) + * @return ApiResponse<RouteListResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Create request for network routes has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse createNetworkAreaRouteWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull CreateNetworkAreaRoutePayload createNetworkAreaRoutePayload) + throws ApiException { + okhttp3.Call localVarCall = + createNetworkAreaRouteValidateBeforeCall( + organizationId, areaId, createNetworkAreaRoutePayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create new network routes. (asynchronously) Create one or several new network routes in a + * network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param createNetworkAreaRoutePayload Request an addition of routes to an area. (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
202 Create request for network routes has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call createNetworkAreaRouteAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull CreateNetworkAreaRoutePayload createNetworkAreaRoutePayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createNetworkAreaRouteValidateBeforeCall( + organizationId, areaId, createNetworkAreaRoutePayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for createNic + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param createNicPayload Request a network interface creation. (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 Network interface was created successfully. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
429 Too Many Requests. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call createNicCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull CreateNicPayload createNicPayload, + 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 = createNicPayload; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/networks/{networkId}/nics" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "networkId" + "}", + localVarApiClient.escapeString(networkId.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call createNicValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull CreateNicPayload createNicPayload, + 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 createNic(Async)"); + } + + // verify the required parameter 'networkId' is set + if (networkId == null) { + throw new ApiException( + "Missing the required parameter 'networkId' when calling createNic(Async)"); + } + + // verify the required parameter 'createNicPayload' is set + if (createNicPayload == null) { + throw new ApiException( + "Missing the required parameter 'createNicPayload' when calling createNic(Async)"); + } + + return createNicCall(projectId, networkId, createNicPayload, _callback); + } + + /** + * Create new network interface. Create a new network interface in a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param createNicPayload Request a network interface creation. (required) + * @return NIC + * @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 Network interface was created successfully. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
429 Too Many Requests. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public NIC createNic( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull CreateNicPayload createNicPayload) + throws ApiException { + ApiResponse localVarResp = + createNicWithHttpInfo(projectId, networkId, createNicPayload); + return localVarResp.getData(); + } + + /** + * Create new network interface. Create a new network interface in a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param createNicPayload Request a network interface creation. (required) + * @return ApiResponse<NIC> + * @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 Network interface was created successfully. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
429 Too Many Requests. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse createNicWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull CreateNicPayload createNicPayload) + throws ApiException { + okhttp3.Call localVarCall = + createNicValidateBeforeCall(projectId, networkId, createNicPayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create new network interface. (asynchronously) Create a new network interface in a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param createNicPayload Request a network interface creation. (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 Network interface was created successfully. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
429 Too Many Requests. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call createNicAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull CreateNicPayload createNicPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createNicValidateBeforeCall(projectId, networkId, createNicPayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for createPublicIP + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param createPublicIPPayload Request a public IP creation. (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 The public IP has been created. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
429 Too Many Requests. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call createPublicIPCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull CreatePublicIPPayload createPublicIPPayload, + 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 = createPublicIPPayload; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/public-ips" + .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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call createPublicIPValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull CreatePublicIPPayload createPublicIPPayload, + 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 createPublicIP(Async)"); + } + + // verify the required parameter 'createPublicIPPayload' is set + if (createPublicIPPayload == null) { + throw new ApiException( + "Missing the required parameter 'createPublicIPPayload' when calling createPublicIP(Async)"); + } + + return createPublicIPCall(projectId, createPublicIPPayload, _callback); + } + + /** + * Create new public IP. Create a new public IP in a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param createPublicIPPayload Request a public IP creation. (required) + * @return PublicIp + * @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 The public IP has been created. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
429 Too Many Requests. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public PublicIp createPublicIP( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull CreatePublicIPPayload createPublicIPPayload) + throws ApiException { + ApiResponse localVarResp = + createPublicIPWithHttpInfo(projectId, createPublicIPPayload); + return localVarResp.getData(); + } + + /** + * Create new public IP. Create a new public IP in a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param createPublicIPPayload Request a public IP creation. (required) + * @return ApiResponse<PublicIp> + * @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 The public IP has been created. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
429 Too Many Requests. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse createPublicIPWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull CreatePublicIPPayload createPublicIPPayload) + throws ApiException { + okhttp3.Call localVarCall = + createPublicIPValidateBeforeCall(projectId, createPublicIPPayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create new public IP. (asynchronously) Create a new public IP in a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param createPublicIPPayload Request a public IP creation. (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 The public IP has been created. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
429 Too Many Requests. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call createPublicIPAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull CreatePublicIPPayload createPublicIPPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createPublicIPValidateBeforeCall(projectId, createPublicIPPayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for createSecurityGroup + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param createSecurityGroupPayload Request a security group creation. (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 Security group create has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call createSecurityGroupCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull CreateSecurityGroupPayload createSecurityGroupPayload, + 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 = createSecurityGroupPayload; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/security-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 = {"application/json"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call createSecurityGroupValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull CreateSecurityGroupPayload createSecurityGroupPayload, + 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 createSecurityGroup(Async)"); + } + + // verify the required parameter 'createSecurityGroupPayload' is set + if (createSecurityGroupPayload == null) { + throw new ApiException( + "Missing the required parameter 'createSecurityGroupPayload' when calling createSecurityGroup(Async)"); + } + + return createSecurityGroupCall(projectId, createSecurityGroupPayload, _callback); + } + + /** + * Create new security group. Create a new security group in a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param createSecurityGroupPayload Request a security group creation. (required) + * @return SecurityGroup + * @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 Security group create has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public SecurityGroup createSecurityGroup( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull CreateSecurityGroupPayload createSecurityGroupPayload) + throws ApiException { + ApiResponse localVarResp = + createSecurityGroupWithHttpInfo(projectId, createSecurityGroupPayload); + return localVarResp.getData(); + } + + /** + * Create new security group. Create a new security group in a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param createSecurityGroupPayload Request a security group creation. (required) + * @return ApiResponse<SecurityGroup> + * @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 Security group create has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse createSecurityGroupWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull CreateSecurityGroupPayload createSecurityGroupPayload) + throws ApiException { + okhttp3.Call localVarCall = + createSecurityGroupValidateBeforeCall(projectId, createSecurityGroupPayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create new security group. (asynchronously) Create a new security group in a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param createSecurityGroupPayload Request a security group creation. (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 Security group create has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call createSecurityGroupAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull CreateSecurityGroupPayload createSecurityGroupPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createSecurityGroupValidateBeforeCall( + projectId, createSecurityGroupPayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for createSecurityGroupRule + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security Group. (required) + * @param createSecurityGroupRulePayload Request for a security group rule creation. (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 Security group rule create has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call createSecurityGroupRuleCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID securityGroupId, + @javax.annotation.Nonnull CreateSecurityGroupRulePayload createSecurityGroupRulePayload, + 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 = createSecurityGroupRulePayload; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/security-groups/{securityGroupId}/rules" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "securityGroupId" + "}", + localVarApiClient.escapeString(securityGroupId.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call createSecurityGroupRuleValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID securityGroupId, + @javax.annotation.Nonnull CreateSecurityGroupRulePayload createSecurityGroupRulePayload, + 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 createSecurityGroupRule(Async)"); + } + + // verify the required parameter 'securityGroupId' is set + if (securityGroupId == null) { + throw new ApiException( + "Missing the required parameter 'securityGroupId' when calling createSecurityGroupRule(Async)"); + } + + // verify the required parameter 'createSecurityGroupRulePayload' is set + if (createSecurityGroupRulePayload == null) { + throw new ApiException( + "Missing the required parameter 'createSecurityGroupRulePayload' when calling createSecurityGroupRule(Async)"); + } + + return createSecurityGroupRuleCall( + projectId, securityGroupId, createSecurityGroupRulePayload, _callback); + } + + /** + * Create new security group rule. Create a new security group rule in a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security Group. (required) + * @param createSecurityGroupRulePayload Request for a security group rule creation. (required) + * @return SecurityGroupRule + * @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 Security group rule create has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public SecurityGroupRule createSecurityGroupRule( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID securityGroupId, + @javax.annotation.Nonnull CreateSecurityGroupRulePayload createSecurityGroupRulePayload) + throws ApiException { + ApiResponse localVarResp = + createSecurityGroupRuleWithHttpInfo( + projectId, securityGroupId, createSecurityGroupRulePayload); + return localVarResp.getData(); + } + + /** + * Create new security group rule. Create a new security group rule in a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security Group. (required) + * @param createSecurityGroupRulePayload Request for a security group rule creation. (required) + * @return ApiResponse<SecurityGroupRule> + * @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 Security group rule create has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse createSecurityGroupRuleWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID securityGroupId, + @javax.annotation.Nonnull CreateSecurityGroupRulePayload createSecurityGroupRulePayload) + throws ApiException { + okhttp3.Call localVarCall = + createSecurityGroupRuleValidateBeforeCall( + projectId, securityGroupId, createSecurityGroupRulePayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create new security group rule. (asynchronously) Create a new security group rule in a + * project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security Group. (required) + * @param createSecurityGroupRulePayload Request for a security group rule creation. (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 Security group rule create has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call createSecurityGroupRuleAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID securityGroupId, + @javax.annotation.Nonnull CreateSecurityGroupRulePayload createSecurityGroupRulePayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createSecurityGroupRuleValidateBeforeCall( + projectId, securityGroupId, createSecurityGroupRulePayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for createServer + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param createServerPayload Request a server creation. (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 Create request for server accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call createServerCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull CreateServerPayload createServerPayload, + 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 = createServerPayload; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/servers" + .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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call createServerValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull CreateServerPayload createServerPayload, + 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 createServer(Async)"); + } + + // verify the required parameter 'createServerPayload' is set + if (createServerPayload == null) { + throw new ApiException( + "Missing the required parameter 'createServerPayload' when calling createServer(Async)"); + } + + return createServerCall(projectId, createServerPayload, _callback); + } + + /** + * Create new server. Create a new server in a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param createServerPayload Request a server creation. (required) + * @return Server + * @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 Create request for server accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public Server createServer( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull CreateServerPayload createServerPayload) + throws ApiException { + ApiResponse localVarResp = createServerWithHttpInfo(projectId, createServerPayload); + return localVarResp.getData(); + } + + /** + * Create new server. Create a new server in a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param createServerPayload Request a server creation. (required) + * @return ApiResponse<Server> + * @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 Create request for server accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse createServerWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull CreateServerPayload createServerPayload) + throws ApiException { + okhttp3.Call localVarCall = + createServerValidateBeforeCall(projectId, createServerPayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create new server. (asynchronously) Create a new server in a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param createServerPayload Request a server creation. (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 Create request for server accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call createServerAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull CreateServerPayload createServerPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createServerValidateBeforeCall(projectId, createServerPayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for createSnapshot + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param createSnapshotPayload Request a snapshot creation. (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 Create request for Snapshot accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call createSnapshotCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull CreateSnapshotPayload createSnapshotPayload, + 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 = createSnapshotPayload; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/snapshots" + .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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call createSnapshotValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull CreateSnapshotPayload createSnapshotPayload, + 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 createSnapshot(Async)"); + } + + // verify the required parameter 'createSnapshotPayload' is set + if (createSnapshotPayload == null) { + throw new ApiException( + "Missing the required parameter 'createSnapshotPayload' when calling createSnapshot(Async)"); + } + + return createSnapshotCall(projectId, createSnapshotPayload, _callback); + } + + /** + * Create new Snapshot. Create a new Snapshot from a Volume in a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param createSnapshotPayload Request a snapshot creation. (required) + * @return Snapshot + * @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 Create request for Snapshot accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public Snapshot createSnapshot( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull CreateSnapshotPayload createSnapshotPayload) + throws ApiException { + ApiResponse localVarResp = + createSnapshotWithHttpInfo(projectId, createSnapshotPayload); + return localVarResp.getData(); + } + + /** + * Create new Snapshot. Create a new Snapshot from a Volume in a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param createSnapshotPayload Request a snapshot creation. (required) + * @return ApiResponse<Snapshot> + * @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 Create request for Snapshot accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse createSnapshotWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull CreateSnapshotPayload createSnapshotPayload) + throws ApiException { + okhttp3.Call localVarCall = + createSnapshotValidateBeforeCall(projectId, createSnapshotPayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create new Snapshot. (asynchronously) Create a new Snapshot from a Volume in a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param createSnapshotPayload Request a snapshot creation. (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 Create request for Snapshot accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call createSnapshotAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull CreateSnapshotPayload createSnapshotPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createSnapshotValidateBeforeCall(projectId, createSnapshotPayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for createVolume + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param createVolumePayload Request a volume creation. (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 Create request for volume accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call createVolumeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull CreateVolumePayload createVolumePayload, + 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 = createVolumePayload; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/volumes" + .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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call createVolumeValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull CreateVolumePayload createVolumePayload, + 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 createVolume(Async)"); + } + + // verify the required parameter 'createVolumePayload' is set + if (createVolumePayload == null) { + throw new ApiException( + "Missing the required parameter 'createVolumePayload' when calling createVolume(Async)"); + } + + return createVolumeCall(projectId, createVolumePayload, _callback); + } + + /** + * Create new volume. Create a new volume in a project. If a volume source is not provided, an + * empty volume will be created. The size property is required if no source or an image source + * is provided. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param createVolumePayload Request a volume creation. (required) + * @return Volume + * @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 Create request for volume accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public Volume createVolume( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull CreateVolumePayload createVolumePayload) + throws ApiException { + ApiResponse localVarResp = createVolumeWithHttpInfo(projectId, createVolumePayload); + return localVarResp.getData(); + } + + /** + * Create new volume. Create a new volume in a project. If a volume source is not provided, an + * empty volume will be created. The size property is required if no source or an image source + * is provided. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param createVolumePayload Request a volume creation. (required) + * @return ApiResponse<Volume> + * @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 Create request for volume accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse createVolumeWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull CreateVolumePayload createVolumePayload) + throws ApiException { + okhttp3.Call localVarCall = + createVolumeValidateBeforeCall(projectId, createVolumePayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create new volume. (asynchronously) Create a new volume in a project. If a volume source is + * not provided, an empty volume will be created. The size property is required if no source or + * an image source is provided. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param createVolumePayload Request a volume creation. (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 Create request for volume accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call createVolumeAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull CreateVolumePayload createVolumePayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createVolumeValidateBeforeCall(projectId, createVolumePayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for deallocateServer + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (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
202 Server deallocation request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call deallocateServerCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/servers/{serverId}/deallocate" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call deallocateServerValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'projectId' is set + if (projectId == null) { + throw new ApiException( + "Missing the required parameter 'projectId' when calling deallocateServer(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling deallocateServer(Async)"); + } + + return deallocateServerCall(projectId, serverId, _callback); + } + + /** + * Deallocate an existing server. Deallocate an existing server. The server will be removed from + * the hypervisor so only the volume will be billed. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Server deallocation request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public void deallocateServer( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull UUID serverId) + throws ApiException { + deallocateServerWithHttpInfo(projectId, serverId); + } + + /** + * Deallocate an existing server. Deallocate an existing server. The server will be removed from + * the hypervisor so only the volume will be billed. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Server deallocation request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse deallocateServerWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull UUID serverId) + throws ApiException { + okhttp3.Call localVarCall = deallocateServerValidateBeforeCall(projectId, serverId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Deallocate an existing server. (asynchronously) Deallocate an existing server. The server + * will be removed from the hypervisor so only the volume will be billed. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (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
202 Server deallocation request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call deallocateServerAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + deallocateServerValidateBeforeCall(projectId, serverId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for deleteAffinityGroup + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param affinityGroupId The identifier (ID) of a STACKIT Affinity 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
204 Delete request for an server group was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call deleteAffinityGroupCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID affinityGroupId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/affinity-groups/{affinityGroupId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "affinityGroupId" + "}", + localVarApiClient.escapeString(affinityGroupId.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteAffinityGroupValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID affinityGroupId, + 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 deleteAffinityGroup(Async)"); + } + + // verify the required parameter 'affinityGroupId' is set + if (affinityGroupId == null) { + throw new ApiException( + "Missing the required parameter 'affinityGroupId' when calling deleteAffinityGroup(Async)"); + } + + return deleteAffinityGroupCall(projectId, affinityGroupId, _callback); + } + + /** + * Delete a affinity group in a project. Delete a affinity group in the given project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param affinityGroupId The identifier (ID) of a STACKIT Affinity Group. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Delete request for an server group was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public void deleteAffinityGroup( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID affinityGroupId) + throws ApiException { + deleteAffinityGroupWithHttpInfo(projectId, affinityGroupId); + } + + /** + * Delete a affinity group in a project. Delete a affinity group in the given project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param affinityGroupId The identifier (ID) of a STACKIT Affinity Group. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Delete request for an server group was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse deleteAffinityGroupWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID affinityGroupId) + throws ApiException { + okhttp3.Call localVarCall = + deleteAffinityGroupValidateBeforeCall(projectId, affinityGroupId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete a affinity group in a project. (asynchronously) Delete a affinity group in the given + * project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param affinityGroupId The identifier (ID) of a STACKIT Affinity 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
204 Delete request for an server group was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call deleteAffinityGroupAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID affinityGroupId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + deleteAffinityGroupValidateBeforeCall(projectId, affinityGroupId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for deleteBackup + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param backupId The identifier (ID) of a STACKIT Backup. (required) + * @param force Force action. (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
204 Backup delete request has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call deleteBackupCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID backupId, + @javax.annotation.Nullable Boolean force, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/backups/{backupId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "backupId" + "}", + localVarApiClient.escapeString(backupId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (force != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("force", force)); + } + + 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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteBackupValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID backupId, + @javax.annotation.Nullable Boolean force, + 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 deleteBackup(Async)"); + } + + // verify the required parameter 'backupId' is set + if (backupId == null) { + throw new ApiException( + "Missing the required parameter 'backupId' when calling deleteBackup(Async)"); + } + + return deleteBackupCall(projectId, backupId, force, _callback); + } + + /** + * Delete a backup. Delete a backup that is part of the project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param backupId The identifier (ID) of a STACKIT Backup. (required) + * @param force Force action. (optional, default to false) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Backup delete request has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public void deleteBackup( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID backupId, + @javax.annotation.Nullable Boolean force) + throws ApiException { + deleteBackupWithHttpInfo(projectId, backupId, force); + } + + /** + * Delete a backup. Delete a backup that is part of the project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param backupId The identifier (ID) of a STACKIT Backup. (required) + * @param force Force action. (optional, default to false) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Backup delete request has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse deleteBackupWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID backupId, + @javax.annotation.Nullable Boolean force) + throws ApiException { + okhttp3.Call localVarCall = + deleteBackupValidateBeforeCall(projectId, backupId, force, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete a backup. (asynchronously) Delete a backup that is part of the project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param backupId The identifier (ID) of a STACKIT Backup. (required) + * @param force Force action. (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
204 Backup delete request has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call deleteBackupAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID backupId, + @javax.annotation.Nullable Boolean force, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + deleteBackupValidateBeforeCall(projectId, backupId, force, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for deleteImage + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Image delete request has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call deleteImageCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID imageId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/images/{imageId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "imageId" + "}", + localVarApiClient.escapeString(imageId.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteImageValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID imageId, + 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 deleteImage(Async)"); + } + + // verify the required parameter 'imageId' is set + if (imageId == null) { + throw new ApiException( + "Missing the required parameter 'imageId' when calling deleteImage(Async)"); + } + + return deleteImageCall(projectId, imageId, _callback); + } + + /** + * Delete an Image. Delete an image that is part of the project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Image delete request has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public void deleteImage( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull UUID imageId) + throws ApiException { + deleteImageWithHttpInfo(projectId, imageId); + } + + /** + * Delete an Image. Delete an image that is part of the project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Image delete request has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse deleteImageWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull UUID imageId) + throws ApiException { + okhttp3.Call localVarCall = deleteImageValidateBeforeCall(projectId, imageId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete an Image. (asynchronously) Delete an image that is part of the project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Image delete request has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call deleteImageAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID imageId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = deleteImageValidateBeforeCall(projectId, imageId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for deleteImageShare + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Image share removed. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call deleteImageShareCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID imageId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/images/{imageId}/share" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "imageId" + "}", + localVarApiClient.escapeString(imageId.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteImageShareValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID imageId, + 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 deleteImageShare(Async)"); + } + + // verify the required parameter 'imageId' is set + if (imageId == null) { + throw new ApiException( + "Missing the required parameter 'imageId' when calling deleteImageShare(Async)"); + } + + return deleteImageShareCall(projectId, imageId, _callback); + } + + /** + * Remove image share. Remove the image share. New scope will be local. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Image share removed. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public void deleteImageShare( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull UUID imageId) + throws ApiException { + deleteImageShareWithHttpInfo(projectId, imageId); + } + + /** + * Remove image share. Remove the image share. New scope will be local. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Image share removed. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse deleteImageShareWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull UUID imageId) + throws ApiException { + okhttp3.Call localVarCall = deleteImageShareValidateBeforeCall(projectId, imageId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Remove image share. (asynchronously) Remove the image share. New scope will be local. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Image share removed. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call deleteImageShareAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID imageId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + deleteImageShareValidateBeforeCall(projectId, imageId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for deleteImageShareConsumer + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @param consumerProjectId The identifier (ID) of a STACKIT Project that consumes an image + * share. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Image share consumer removed. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call deleteImageShareConsumerCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID imageId, + @javax.annotation.Nonnull UUID consumerProjectId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/images/{imageId}/share/{consumerProjectId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "imageId" + "}", + localVarApiClient.escapeString(imageId.toString())) + .replace( + "{" + "consumerProjectId" + "}", + localVarApiClient.escapeString(consumerProjectId.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteImageShareConsumerValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID imageId, + @javax.annotation.Nonnull UUID consumerProjectId, + 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 deleteImageShareConsumer(Async)"); + } + + // verify the required parameter 'imageId' is set + if (imageId == null) { + throw new ApiException( + "Missing the required parameter 'imageId' when calling deleteImageShareConsumer(Async)"); + } + + // verify the required parameter 'consumerProjectId' is set + if (consumerProjectId == null) { + throw new ApiException( + "Missing the required parameter 'consumerProjectId' when calling deleteImageShareConsumer(Async)"); + } + + return deleteImageShareConsumerCall(projectId, imageId, consumerProjectId, _callback); + } + + /** + * Remove an image share consumer. Remove consumer from a shared image. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @param consumerProjectId The identifier (ID) of a STACKIT Project that consumes an image + * share. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Image share consumer removed. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public void deleteImageShareConsumer( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID imageId, + @javax.annotation.Nonnull UUID consumerProjectId) + throws ApiException { + deleteImageShareConsumerWithHttpInfo(projectId, imageId, consumerProjectId); + } + + /** + * Remove an image share consumer. Remove consumer from a shared image. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @param consumerProjectId The identifier (ID) of a STACKIT Project that consumes an image + * share. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Image share consumer removed. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse deleteImageShareConsumerWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID imageId, + @javax.annotation.Nonnull UUID consumerProjectId) + throws ApiException { + okhttp3.Call localVarCall = + deleteImageShareConsumerValidateBeforeCall( + projectId, imageId, consumerProjectId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Remove an image share consumer. (asynchronously) Remove consumer from a shared image. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @param consumerProjectId The identifier (ID) of a STACKIT Project that consumes an image + * share. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Image share consumer removed. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call deleteImageShareConsumerAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID imageId, + @javax.annotation.Nonnull UUID consumerProjectId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + deleteImageShareConsumerValidateBeforeCall( + projectId, imageId, consumerProjectId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for deleteKeyPair + * + * @param keypairName The name of an SSH keypair. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Delete request for an SSH keypair was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call deleteKeyPairCall( + @javax.annotation.Nonnull String keypairName, 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/keypairs/{keypairName}" + .replace( + "{" + "keypairName" + "}", + localVarApiClient.escapeString(keypairName.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteKeyPairValidateBeforeCall( + @javax.annotation.Nonnull String keypairName, final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'keypairName' is set + if (keypairName == null) { + throw new ApiException( + "Missing the required parameter 'keypairName' when calling deleteKeyPair(Async)"); + } + + return deleteKeyPairCall(keypairName, _callback); + } + + /** + * Delete an SSH keypair. Delete an SSH keypair from a user. + * + * @param keypairName The name of an SSH keypair. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Delete request for an SSH keypair was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public void deleteKeyPair(@javax.annotation.Nonnull String keypairName) throws ApiException { + deleteKeyPairWithHttpInfo(keypairName); + } + + /** + * Delete an SSH keypair. Delete an SSH keypair from a user. + * + * @param keypairName The name of an SSH keypair. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Delete request for an SSH keypair was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse deleteKeyPairWithHttpInfo(@javax.annotation.Nonnull String keypairName) + throws ApiException { + okhttp3.Call localVarCall = deleteKeyPairValidateBeforeCall(keypairName, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete an SSH keypair. (asynchronously) Delete an SSH keypair from a user. + * + * @param keypairName The name of an SSH keypair. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Delete request for an SSH keypair was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call deleteKeyPairAsync( + @javax.annotation.Nonnull String keypairName, final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = deleteKeyPairValidateBeforeCall(keypairName, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for deleteNetwork + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (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
202 Delete request for network has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call deleteNetworkCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID networkId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/networks/{networkId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "networkId" + "}", + localVarApiClient.escapeString(networkId.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteNetworkValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID networkId, + 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 deleteNetwork(Async)"); + } + + // verify the required parameter 'networkId' is set + if (networkId == null) { + throw new ApiException( + "Missing the required parameter 'networkId' when calling deleteNetwork(Async)"); + } + + return deleteNetworkCall(projectId, networkId, _callback); + } + + /** + * Delete network. Delete a network. If the network is still in use, the deletion will fail. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Delete request for network has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public void deleteNetwork( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull UUID networkId) + throws ApiException { + deleteNetworkWithHttpInfo(projectId, networkId); + } + + /** + * Delete network. Delete a network. If the network is still in use, the deletion will fail. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Delete request for network has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse deleteNetworkWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull UUID networkId) + throws ApiException { + okhttp3.Call localVarCall = deleteNetworkValidateBeforeCall(projectId, networkId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete network. (asynchronously) Delete a network. If the network is still in use, the + * deletion will fail. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (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
202 Delete request for network has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call deleteNetworkAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID networkId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + deleteNetworkValidateBeforeCall(projectId, networkId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for deleteNetworkArea + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (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
202 Delete request for area has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call deleteNetworkAreaCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + 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/organizations/{organizationId}/network-areas/{areaId}" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "areaId" + "}", + localVarApiClient.escapeString(areaId.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteNetworkAreaValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling deleteNetworkArea(Async)"); + } + + // verify the required parameter 'areaId' is set + if (areaId == null) { + throw new ApiException( + "Missing the required parameter 'areaId' when calling deleteNetworkArea(Async)"); + } + + return deleteNetworkAreaCall(organizationId, areaId, _callback); + } + + /** + * Delete a network area. Delete an existing network area in an organization. This is only + * possible if no projects are using the area anymore. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Delete request for area has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public void deleteNetworkArea( + @javax.annotation.Nonnull UUID organizationId, @javax.annotation.Nonnull UUID areaId) + throws ApiException { + deleteNetworkAreaWithHttpInfo(organizationId, areaId); + } + + /** + * Delete a network area. Delete an existing network area in an organization. This is only + * possible if no projects are using the area anymore. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Delete request for area has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse deleteNetworkAreaWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, @javax.annotation.Nonnull UUID areaId) + throws ApiException { + okhttp3.Call localVarCall = + deleteNetworkAreaValidateBeforeCall(organizationId, areaId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete a network area. (asynchronously) Delete an existing network area in an organization. + * This is only possible if no projects are using the area anymore. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (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
202 Delete request for area has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call deleteNetworkAreaAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + deleteNetworkAreaValidateBeforeCall(organizationId, areaId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for deleteNetworkAreaRange + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param networkRangeId The identifier (ID) of a STACKIT Network Range. (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
202 Delete request for network range has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call deleteNetworkAreaRangeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull UUID networkRangeId, + 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/organizations/{organizationId}/network-areas/{areaId}/network-ranges/{networkRangeId}" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "areaId" + "}", + localVarApiClient.escapeString(areaId.toString())) + .replace( + "{" + "networkRangeId" + "}", + localVarApiClient.escapeString(networkRangeId.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteNetworkAreaRangeValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull UUID networkRangeId, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling deleteNetworkAreaRange(Async)"); + } + + // verify the required parameter 'areaId' is set + if (areaId == null) { + throw new ApiException( + "Missing the required parameter 'areaId' when calling deleteNetworkAreaRange(Async)"); + } + + // verify the required parameter 'networkRangeId' is set + if (networkRangeId == null) { + throw new ApiException( + "Missing the required parameter 'networkRangeId' when calling deleteNetworkAreaRange(Async)"); + } + + return deleteNetworkAreaRangeCall(organizationId, areaId, networkRangeId, _callback); + } + + /** + * Delete a network range. Delete a network range of a network area. The deletion will fail if + * the network range is still used. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param networkRangeId The identifier (ID) of a STACKIT Network Range. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Delete request for network range has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public void deleteNetworkAreaRange( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull UUID networkRangeId) + throws ApiException { + deleteNetworkAreaRangeWithHttpInfo(organizationId, areaId, networkRangeId); + } + + /** + * Delete a network range. Delete a network range of a network area. The deletion will fail if + * the network range is still used. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param networkRangeId The identifier (ID) of a STACKIT Network Range. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Delete request for network range has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse deleteNetworkAreaRangeWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull UUID networkRangeId) + throws ApiException { + okhttp3.Call localVarCall = + deleteNetworkAreaRangeValidateBeforeCall( + organizationId, areaId, networkRangeId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete a network range. (asynchronously) Delete a network range of a network area. The + * deletion will fail if the network range is still used. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param networkRangeId The identifier (ID) of a STACKIT Network Range. (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
202 Delete request for network range has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call deleteNetworkAreaRangeAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull UUID networkRangeId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + deleteNetworkAreaRangeValidateBeforeCall( + organizationId, areaId, networkRangeId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for deleteNetworkAreaRoute + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param routeId The identifier (ID) of a STACKIT Route. (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
202 Delete request for network route has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call deleteNetworkAreaRouteCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull UUID routeId, + 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/organizations/{organizationId}/network-areas/{areaId}/routes/{routeId}" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "areaId" + "}", + localVarApiClient.escapeString(areaId.toString())) + .replace( + "{" + "routeId" + "}", + localVarApiClient.escapeString(routeId.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteNetworkAreaRouteValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull UUID routeId, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling deleteNetworkAreaRoute(Async)"); + } + + // verify the required parameter 'areaId' is set + if (areaId == null) { + throw new ApiException( + "Missing the required parameter 'areaId' when calling deleteNetworkAreaRoute(Async)"); + } + + // verify the required parameter 'routeId' is set + if (routeId == null) { + throw new ApiException( + "Missing the required parameter 'routeId' when calling deleteNetworkAreaRoute(Async)"); + } + + return deleteNetworkAreaRouteCall(organizationId, areaId, routeId, _callback); + } + + /** + * Delete a network route. Delete a network route of a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param routeId The identifier (ID) of a STACKIT Route. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Delete request for network route has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public void deleteNetworkAreaRoute( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull UUID routeId) + throws ApiException { + deleteNetworkAreaRouteWithHttpInfo(organizationId, areaId, routeId); + } + + /** + * Delete a network route. Delete a network route of a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param routeId The identifier (ID) of a STACKIT Route. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Delete request for network route has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse deleteNetworkAreaRouteWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull UUID routeId) + throws ApiException { + okhttp3.Call localVarCall = + deleteNetworkAreaRouteValidateBeforeCall(organizationId, areaId, routeId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete a network route. (asynchronously) Delete a network route of a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param routeId The identifier (ID) of a STACKIT Route. (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
202 Delete request for network route has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call deleteNetworkAreaRouteAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull UUID routeId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + deleteNetworkAreaRouteValidateBeforeCall( + organizationId, areaId, routeId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for deleteNic + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param nicId The identifier (ID) of a network interface. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Network interface delete request has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call deleteNicCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull UUID nicId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/networks/{networkId}/nics/{nicId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "networkId" + "}", + localVarApiClient.escapeString(networkId.toString())) + .replace( + "{" + "nicId" + "}", + localVarApiClient.escapeString(nicId.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteNicValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull UUID nicId, + 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 deleteNic(Async)"); + } + + // verify the required parameter 'networkId' is set + if (networkId == null) { + throw new ApiException( + "Missing the required parameter 'networkId' when calling deleteNic(Async)"); + } + + // verify the required parameter 'nicId' is set + if (nicId == null) { + throw new ApiException( + "Missing the required parameter 'nicId' when calling deleteNic(Async)"); + } + + return deleteNicCall(projectId, networkId, nicId, _callback); + } + + /** + * Delete a network interface. Delete a network interface that is part of the project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param nicId The identifier (ID) of a network interface. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Network interface delete request has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public void deleteNic( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull UUID nicId) + throws ApiException { + deleteNicWithHttpInfo(projectId, networkId, nicId); + } + + /** + * Delete a network interface. Delete a network interface that is part of the project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param nicId The identifier (ID) of a network interface. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Network interface delete request has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse deleteNicWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull UUID nicId) + throws ApiException { + okhttp3.Call localVarCall = deleteNicValidateBeforeCall(projectId, networkId, nicId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete a network interface. (asynchronously) Delete a network interface that is part of the + * project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param nicId The identifier (ID) of a network interface. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Network interface delete request has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call deleteNicAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull UUID nicId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + deleteNicValidateBeforeCall(projectId, networkId, nicId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for deletePublicIP + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param publicIpId The identifier (ID) of a Public IP. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 The public IP has been deleted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call deletePublicIPCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID publicIpId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/public-ips/{publicIpId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "publicIpId" + "}", + localVarApiClient.escapeString(publicIpId.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call deletePublicIPValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID publicIpId, + 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 deletePublicIP(Async)"); + } + + // verify the required parameter 'publicIpId' is set + if (publicIpId == null) { + throw new ApiException( + "Missing the required parameter 'publicIpId' when calling deletePublicIP(Async)"); + } + + return deletePublicIPCall(projectId, publicIpId, _callback); + } + + /** + * Delete a public IP. Delete a public IP that is part of the project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param publicIpId The identifier (ID) of a Public IP. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 The public IP has been deleted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public void deletePublicIP( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull UUID publicIpId) + throws ApiException { + deletePublicIPWithHttpInfo(projectId, publicIpId); + } + + /** + * Delete a public IP. Delete a public IP that is part of the project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param publicIpId The identifier (ID) of a Public IP. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 The public IP has been deleted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse deletePublicIPWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull UUID publicIpId) + throws ApiException { + okhttp3.Call localVarCall = deletePublicIPValidateBeforeCall(projectId, publicIpId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete a public IP. (asynchronously) Delete a public IP that is part of the project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param publicIpId The identifier (ID) of a Public IP. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 The public IP has been deleted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call deletePublicIPAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID publicIpId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + deletePublicIPValidateBeforeCall(projectId, publicIpId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for deleteSecurityGroup + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security 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
204 Delete request for security group has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call deleteSecurityGroupCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID securityGroupId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/security-groups/{securityGroupId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "securityGroupId" + "}", + localVarApiClient.escapeString(securityGroupId.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteSecurityGroupValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID securityGroupId, + 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 deleteSecurityGroup(Async)"); + } + + // verify the required parameter 'securityGroupId' is set + if (securityGroupId == null) { + throw new ApiException( + "Missing the required parameter 'securityGroupId' when calling deleteSecurityGroup(Async)"); + } + + return deleteSecurityGroupCall(projectId, securityGroupId, _callback); + } + + /** + * Delete security group. Delete a security group. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security Group. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Delete request for security group has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public void deleteSecurityGroup( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID securityGroupId) + throws ApiException { + deleteSecurityGroupWithHttpInfo(projectId, securityGroupId); + } + + /** + * Delete security group. Delete a security group. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security Group. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Delete request for security group has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse deleteSecurityGroupWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID securityGroupId) + throws ApiException { + okhttp3.Call localVarCall = + deleteSecurityGroupValidateBeforeCall(projectId, securityGroupId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete security group. (asynchronously) Delete a security group. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security 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
204 Delete request for security group has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call deleteSecurityGroupAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID securityGroupId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + deleteSecurityGroupValidateBeforeCall(projectId, securityGroupId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for deleteSecurityGroupRule + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security Group. (required) + * @param securityGroupRuleId The identifier (ID) of a STACKIT Security Group Rule. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Delete request for security group rule has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call deleteSecurityGroupRuleCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID securityGroupId, + @javax.annotation.Nonnull UUID securityGroupRuleId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/security-groups/{securityGroupId}/rules/{securityGroupRuleId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "securityGroupId" + "}", + localVarApiClient.escapeString(securityGroupId.toString())) + .replace( + "{" + "securityGroupRuleId" + "}", + localVarApiClient.escapeString(securityGroupRuleId.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteSecurityGroupRuleValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID securityGroupId, + @javax.annotation.Nonnull UUID securityGroupRuleId, + 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 deleteSecurityGroupRule(Async)"); + } + + // verify the required parameter 'securityGroupId' is set + if (securityGroupId == null) { + throw new ApiException( + "Missing the required parameter 'securityGroupId' when calling deleteSecurityGroupRule(Async)"); + } + + // verify the required parameter 'securityGroupRuleId' is set + if (securityGroupRuleId == null) { + throw new ApiException( + "Missing the required parameter 'securityGroupRuleId' when calling deleteSecurityGroupRule(Async)"); + } + + return deleteSecurityGroupRuleCall( + projectId, securityGroupId, securityGroupRuleId, _callback); + } + + /** + * Delete security group rule. Delete a security group rule. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security Group. (required) + * @param securityGroupRuleId The identifier (ID) of a STACKIT Security Group Rule. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Delete request for security group rule has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public void deleteSecurityGroupRule( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID securityGroupId, + @javax.annotation.Nonnull UUID securityGroupRuleId) + throws ApiException { + deleteSecurityGroupRuleWithHttpInfo(projectId, securityGroupId, securityGroupRuleId); + } + + /** + * Delete security group rule. Delete a security group rule. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security Group. (required) + * @param securityGroupRuleId The identifier (ID) of a STACKIT Security Group Rule. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Delete request for security group rule has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse deleteSecurityGroupRuleWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID securityGroupId, + @javax.annotation.Nonnull UUID securityGroupRuleId) + throws ApiException { + okhttp3.Call localVarCall = + deleteSecurityGroupRuleValidateBeforeCall( + projectId, securityGroupId, securityGroupRuleId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete security group rule. (asynchronously) Delete a security group rule. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security Group. (required) + * @param securityGroupRuleId The identifier (ID) of a STACKIT Security Group Rule. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Delete request for security group rule has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call deleteSecurityGroupRuleAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID securityGroupId, + @javax.annotation.Nonnull UUID securityGroupRuleId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + deleteSecurityGroupRuleValidateBeforeCall( + projectId, securityGroupId, securityGroupRuleId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for deleteServer + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Delete request for server accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call deleteServerCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/servers/{serverId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = {"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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteServerValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'projectId' is set + if (projectId == null) { + throw new ApiException( + "Missing the required parameter 'projectId' when calling deleteServer(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling deleteServer(Async)"); + } + + return deleteServerCall(projectId, serverId, _callback); + } + + /** + * Delete a server. Delete a server. Volumes won't be deleted. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Delete request for server accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public void deleteServer( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull UUID serverId) + throws ApiException { + deleteServerWithHttpInfo(projectId, serverId); + } + + /** + * Delete a server. Delete a server. Volumes won't be deleted. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Delete request for server accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse deleteServerWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull UUID serverId) + throws ApiException { + okhttp3.Call localVarCall = deleteServerValidateBeforeCall(projectId, serverId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete a server. (asynchronously) Delete a server. Volumes won't be deleted. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Delete request for server accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call deleteServerAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = deleteServerValidateBeforeCall(projectId, serverId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for deleteSnapshot + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param snapshotId The identifier (ID) of a STACKIT Snapshot. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Snapshot delete request has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call deleteSnapshotCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID snapshotId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/snapshots/{snapshotId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "snapshotId" + "}", + localVarApiClient.escapeString(snapshotId.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteSnapshotValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID snapshotId, + 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 deleteSnapshot(Async)"); + } + + // verify the required parameter 'snapshotId' is set + if (snapshotId == null) { + throw new ApiException( + "Missing the required parameter 'snapshotId' when calling deleteSnapshot(Async)"); + } + + return deleteSnapshotCall(projectId, snapshotId, _callback); + } + + /** + * Delete a snapshot. Delete a snapshot that is part of the project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param snapshotId The identifier (ID) of a STACKIT Snapshot. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Snapshot delete request has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public void deleteSnapshot( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull UUID snapshotId) + throws ApiException { + deleteSnapshotWithHttpInfo(projectId, snapshotId); + } + + /** + * Delete a snapshot. Delete a snapshot that is part of the project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param snapshotId The identifier (ID) of a STACKIT Snapshot. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Snapshot delete request has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse deleteSnapshotWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull UUID snapshotId) + throws ApiException { + okhttp3.Call localVarCall = deleteSnapshotValidateBeforeCall(projectId, snapshotId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete a snapshot. (asynchronously) Delete a snapshot that is part of the project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param snapshotId The identifier (ID) of a STACKIT Snapshot. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Snapshot delete request has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call deleteSnapshotAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID snapshotId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + deleteSnapshotValidateBeforeCall(projectId, snapshotId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for deleteVolume + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @param cascade Cascade action. (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
204 Volume delete request has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call deleteVolumeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID volumeId, + @javax.annotation.Nullable Boolean cascade, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/volumes/{volumeId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "volumeId" + "}", + localVarApiClient.escapeString(volumeId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (cascade != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("cascade", cascade)); + } + + 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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteVolumeValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID volumeId, + @javax.annotation.Nullable Boolean cascade, + 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 deleteVolume(Async)"); + } + + // verify the required parameter 'volumeId' is set + if (volumeId == null) { + throw new ApiException( + "Missing the required parameter 'volumeId' when calling deleteVolume(Async)"); + } + + return deleteVolumeCall(projectId, volumeId, cascade, _callback); + } + + /** + * Delete a volume. Delete a volume inside a project. The deletion will fail if the volume is + * still in use. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @param cascade Cascade action. (optional, default to false) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Volume delete request has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public void deleteVolume( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID volumeId, + @javax.annotation.Nullable Boolean cascade) + throws ApiException { + deleteVolumeWithHttpInfo(projectId, volumeId, cascade); + } + + /** + * Delete a volume. Delete a volume inside a project. The deletion will fail if the volume is + * still in use. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @param cascade Cascade action. (optional, default to false) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Volume delete request has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse deleteVolumeWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID volumeId, + @javax.annotation.Nullable Boolean cascade) + throws ApiException { + okhttp3.Call localVarCall = + deleteVolumeValidateBeforeCall(projectId, volumeId, cascade, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete a volume. (asynchronously) Delete a volume inside a project. The deletion will fail if + * the volume is still in use. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @param cascade Cascade action. (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
204 Volume delete request has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call deleteVolumeAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID volumeId, + @javax.annotation.Nullable Boolean cascade, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + deleteVolumeValidateBeforeCall(projectId, volumeId, cascade, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for getAffinityGroup + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param affinityGroupId The identifier (ID) of a STACKIT Affinity 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 Show affinity group details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call getAffinityGroupCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID affinityGroupId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/affinity-groups/{affinityGroupId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "affinityGroupId" + "}", + localVarApiClient.escapeString(affinityGroupId.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call getAffinityGroupValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID affinityGroupId, + 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 getAffinityGroup(Async)"); + } + + // verify the required parameter 'affinityGroupId' is set + if (affinityGroupId == null) { + throw new ApiException( + "Missing the required parameter 'affinityGroupId' when calling getAffinityGroup(Async)"); + } + + return getAffinityGroupCall(projectId, affinityGroupId, _callback); + } + + /** + * Get the affinity group. Get the affinity group created in a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param affinityGroupId The identifier (ID) of a STACKIT Affinity Group. (required) + * @return AffinityGroup + * @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 Show affinity group details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public AffinityGroup getAffinityGroup( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID affinityGroupId) + throws ApiException { + ApiResponse localVarResp = + getAffinityGroupWithHttpInfo(projectId, affinityGroupId); + return localVarResp.getData(); + } + + /** + * Get the affinity group. Get the affinity group created in a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param affinityGroupId The identifier (ID) of a STACKIT Affinity Group. (required) + * @return ApiResponse<AffinityGroup> + * @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 Show affinity group details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse getAffinityGroupWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID affinityGroupId) + throws ApiException { + okhttp3.Call localVarCall = + getAffinityGroupValidateBeforeCall(projectId, affinityGroupId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get the affinity group. (asynchronously) Get the affinity group created in a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param affinityGroupId The identifier (ID) of a STACKIT Affinity 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 Show affinity group details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call getAffinityGroupAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID affinityGroupId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getAffinityGroupValidateBeforeCall(projectId, affinityGroupId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getAttachedVolume + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (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 Get details about a volume attachment. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call getAttachedVolumeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID volumeId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/servers/{serverId}/volume-attachments/{volumeId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())) + .replace( + "{" + "volumeId" + "}", + localVarApiClient.escapeString(volumeId.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call getAttachedVolumeValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID volumeId, + 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 getAttachedVolume(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling getAttachedVolume(Async)"); + } + + // verify the required parameter 'volumeId' is set + if (volumeId == null) { + throw new ApiException( + "Missing the required parameter 'volumeId' when calling getAttachedVolume(Async)"); + } + + return getAttachedVolumeCall(projectId, serverId, volumeId, _callback); + } + + /** + * Get Volume Attachment details. Get the details of an existing Volume Attachment. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @return VolumeAttachment + * @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 Get details about a volume attachment. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public VolumeAttachment getAttachedVolume( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID volumeId) + throws ApiException { + ApiResponse localVarResp = + getAttachedVolumeWithHttpInfo(projectId, serverId, volumeId); + return localVarResp.getData(); + } + + /** + * Get Volume Attachment details. Get the details of an existing Volume Attachment. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @return ApiResponse<VolumeAttachment> + * @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 Get details about a volume attachment. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse getAttachedVolumeWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID volumeId) + throws ApiException { + okhttp3.Call localVarCall = + getAttachedVolumeValidateBeforeCall(projectId, serverId, volumeId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Volume Attachment details. (asynchronously) Get the details of an existing Volume + * Attachment. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (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 Get details about a volume attachment. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call getAttachedVolumeAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID volumeId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getAttachedVolumeValidateBeforeCall(projectId, serverId, volumeId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getBackup + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param backupId The identifier (ID) of a STACKIT Backup. (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 Show backup details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call getBackupCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID backupId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/backups/{backupId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "backupId" + "}", + localVarApiClient.escapeString(backupId.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call getBackupValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID backupId, + 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 getBackup(Async)"); + } + + // verify the required parameter 'backupId' is set + if (backupId == null) { + throw new ApiException( + "Missing the required parameter 'backupId' when calling getBackup(Async)"); + } + + return getBackupCall(projectId, backupId, _callback); + } + + /** + * Get details about a backup. Get details about a block device backup. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param backupId The identifier (ID) of a STACKIT Backup. (required) + * @return Backup + * @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 Show backup details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public Backup getBackup( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull UUID backupId) + throws ApiException { + ApiResponse localVarResp = getBackupWithHttpInfo(projectId, backupId); + return localVarResp.getData(); + } + + /** + * Get details about a backup. Get details about a block device backup. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param backupId The identifier (ID) of a STACKIT Backup. (required) + * @return ApiResponse<Backup> + * @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 Show backup details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse getBackupWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull UUID backupId) + throws ApiException { + okhttp3.Call localVarCall = getBackupValidateBeforeCall(projectId, backupId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get details about a backup. (asynchronously) Get details about a block device backup. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param backupId The identifier (ID) of a STACKIT Backup. (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 Show backup details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call getBackupAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID backupId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = getBackupValidateBeforeCall(projectId, backupId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getImage + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (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 Show Image details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call getImageCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID imageId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/images/{imageId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "imageId" + "}", + localVarApiClient.escapeString(imageId.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call getImageValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID imageId, + 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 getImage(Async)"); + } + + // verify the required parameter 'imageId' is set + if (imageId == null) { + throw new ApiException( + "Missing the required parameter 'imageId' when calling getImage(Async)"); + } + + return getImageCall(projectId, imageId, _callback); + } + + /** + * Get details about an image. Get details about a specific Image inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @return Image + * @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 Show Image details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public Image getImage( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull UUID imageId) + throws ApiException { + ApiResponse localVarResp = getImageWithHttpInfo(projectId, imageId); + return localVarResp.getData(); + } + + /** + * Get details about an image. Get details about a specific Image inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @return ApiResponse<Image> + * @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 Show Image details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse getImageWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull UUID imageId) + throws ApiException { + okhttp3.Call localVarCall = getImageValidateBeforeCall(projectId, imageId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get details about an image. (asynchronously) Get details about a specific Image inside a + * project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (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 Show Image details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call getImageAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID imageId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = getImageValidateBeforeCall(projectId, imageId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getImageShare + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (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 Show Image share details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call getImageShareCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID imageId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/images/{imageId}/share" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "imageId" + "}", + localVarApiClient.escapeString(imageId.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call getImageShareValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID imageId, + 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 getImageShare(Async)"); + } + + // verify the required parameter 'imageId' is set + if (imageId == null) { + throw new ApiException( + "Missing the required parameter 'imageId' when calling getImageShare(Async)"); + } + + return getImageShareCall(projectId, imageId, _callback); + } + + /** + * Get share details of an image. Get share details about an shared image. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @return ImageShare + * @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 Show Image share details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ImageShare getImageShare( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull UUID imageId) + throws ApiException { + ApiResponse localVarResp = getImageShareWithHttpInfo(projectId, imageId); + return localVarResp.getData(); + } + + /** + * Get share details of an image. Get share details about an shared image. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @return ApiResponse<ImageShare> + * @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 Show Image share details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse getImageShareWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull UUID imageId) + throws ApiException { + okhttp3.Call localVarCall = getImageShareValidateBeforeCall(projectId, imageId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get share details of an image. (asynchronously) Get share details about an shared image. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (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 Show Image share details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call getImageShareAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID imageId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = getImageShareValidateBeforeCall(projectId, imageId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getImageShareConsumer + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @param consumerProjectId The identifier (ID) of a STACKIT Project that consumes an image + * share. (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 Show Image share consumer details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call getImageShareConsumerCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID imageId, + @javax.annotation.Nonnull UUID consumerProjectId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/images/{imageId}/share/{consumerProjectId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "imageId" + "}", + localVarApiClient.escapeString(imageId.toString())) + .replace( + "{" + "consumerProjectId" + "}", + localVarApiClient.escapeString(consumerProjectId.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call getImageShareConsumerValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID imageId, + @javax.annotation.Nonnull UUID consumerProjectId, + 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 getImageShareConsumer(Async)"); + } + + // verify the required parameter 'imageId' is set + if (imageId == null) { + throw new ApiException( + "Missing the required parameter 'imageId' when calling getImageShareConsumer(Async)"); + } + + // verify the required parameter 'consumerProjectId' is set + if (consumerProjectId == null) { + throw new ApiException( + "Missing the required parameter 'consumerProjectId' when calling getImageShareConsumer(Async)"); + } + + return getImageShareConsumerCall(projectId, imageId, consumerProjectId, _callback); + } + + /** + * Get image share consumer. Get details about an image share consumer. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @param consumerProjectId The identifier (ID) of a STACKIT Project that consumes an image + * share. (required) + * @return ImageShareConsumer + * @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 Show Image share consumer details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ImageShareConsumer getImageShareConsumer( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID imageId, + @javax.annotation.Nonnull UUID consumerProjectId) + throws ApiException { + ApiResponse localVarResp = + getImageShareConsumerWithHttpInfo(projectId, imageId, consumerProjectId); + return localVarResp.getData(); + } + + /** + * Get image share consumer. Get details about an image share consumer. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @param consumerProjectId The identifier (ID) of a STACKIT Project that consumes an image + * share. (required) + * @return ApiResponse<ImageShareConsumer> + * @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 Show Image share consumer details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse getImageShareConsumerWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID imageId, + @javax.annotation.Nonnull UUID consumerProjectId) + throws ApiException { + okhttp3.Call localVarCall = + getImageShareConsumerValidateBeforeCall( + projectId, imageId, consumerProjectId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get image share consumer. (asynchronously) Get details about an image share consumer. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @param consumerProjectId The identifier (ID) of a STACKIT Project that consumes an image + * share. (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 Show Image share consumer details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call getImageShareConsumerAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID imageId, + @javax.annotation.Nonnull UUID consumerProjectId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getImageShareConsumerValidateBeforeCall( + projectId, imageId, consumerProjectId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getKeyPair + * + * @param keypairName The name of an SSH keypair. (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 Show SSH keypair details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call getKeyPairCall( + @javax.annotation.Nonnull String keypairName, 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/keypairs/{keypairName}" + .replace( + "{" + "keypairName" + "}", + localVarApiClient.escapeString(keypairName.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call getKeyPairValidateBeforeCall( + @javax.annotation.Nonnull String keypairName, final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'keypairName' is set + if (keypairName == null) { + throw new ApiException( + "Missing the required parameter 'keypairName' when calling getKeyPair(Async)"); + } + + return getKeyPairCall(keypairName, _callback); + } + + /** + * Get SSH keypair details. Get details about an SSH keypair. + * + * @param keypairName The name of an SSH keypair. (required) + * @return Keypair + * @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 Show SSH keypair details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public Keypair getKeyPair(@javax.annotation.Nonnull String keypairName) throws ApiException { + ApiResponse localVarResp = getKeyPairWithHttpInfo(keypairName); + return localVarResp.getData(); + } + + /** + * Get SSH keypair details. Get details about an SSH keypair. + * + * @param keypairName The name of an SSH keypair. (required) + * @return ApiResponse<Keypair> + * @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 Show SSH keypair details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse getKeyPairWithHttpInfo(@javax.annotation.Nonnull String keypairName) + throws ApiException { + okhttp3.Call localVarCall = getKeyPairValidateBeforeCall(keypairName, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get SSH keypair details. (asynchronously) Get details about an SSH keypair. + * + * @param keypairName The name of an SSH keypair. (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 Show SSH keypair details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call getKeyPairAsync( + @javax.annotation.Nonnull String keypairName, final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = getKeyPairValidateBeforeCall(keypairName, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getMachineType + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param machineType STACKIT machine type Name. (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 Show machine type details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call getMachineTypeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String machineType, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/machine-types/{machineType}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "machineType" + "}", + localVarApiClient.escapeString(machineType.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call getMachineTypeValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String machineType, + 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 getMachineType(Async)"); + } + + // verify the required parameter 'machineType' is set + if (machineType == null) { + throw new ApiException( + "Missing the required parameter 'machineType' when calling getMachineType(Async)"); + } + + return getMachineTypeCall(projectId, machineType, _callback); + } + + /** + * Get details about a machine type. Get details about a specific machine type. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param machineType STACKIT machine type Name. (required) + * @return MachineType + * @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 Show machine type details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public MachineType getMachineType( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull String machineType) + throws ApiException { + ApiResponse localVarResp = getMachineTypeWithHttpInfo(projectId, machineType); + return localVarResp.getData(); + } + + /** + * Get details about a machine type. Get details about a specific machine type. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param machineType STACKIT machine type Name. (required) + * @return ApiResponse<MachineType> + * @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 Show machine type details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse getMachineTypeWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull String machineType) + throws ApiException { + okhttp3.Call localVarCall = getMachineTypeValidateBeforeCall(projectId, machineType, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get details about a machine type. (asynchronously) Get details about a specific machine type. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param machineType STACKIT machine type Name. (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 Show machine type details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call getMachineTypeAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String machineType, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getMachineTypeValidateBeforeCall(projectId, machineType, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getNetwork + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (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 Show network details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call getNetworkCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID networkId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/networks/{networkId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "networkId" + "}", + localVarApiClient.escapeString(networkId.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call getNetworkValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID networkId, + 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 getNetwork(Async)"); + } + + // verify the required parameter 'networkId' is set + if (networkId == null) { + throw new ApiException( + "Missing the required parameter 'networkId' when calling getNetwork(Async)"); + } + + return getNetworkCall(projectId, networkId, _callback); + } + + /** + * Get network details. Get details about a network of a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @return Network + * @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 Show network details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public Network getNetwork( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull UUID networkId) + throws ApiException { + ApiResponse localVarResp = getNetworkWithHttpInfo(projectId, networkId); + return localVarResp.getData(); + } + + /** + * Get network details. Get details about a network of a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @return ApiResponse<Network> + * @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 Show network details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse getNetworkWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull UUID networkId) + throws ApiException { + okhttp3.Call localVarCall = getNetworkValidateBeforeCall(projectId, networkId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get network details. (asynchronously) Get details about a network of a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (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 Show network details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call getNetworkAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID networkId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = getNetworkValidateBeforeCall(projectId, networkId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getNetworkArea + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (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 Show network area details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call getNetworkAreaCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + 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/organizations/{organizationId}/network-areas/{areaId}" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "areaId" + "}", + localVarApiClient.escapeString(areaId.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call getNetworkAreaValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling getNetworkArea(Async)"); + } + + // verify the required parameter 'areaId' is set + if (areaId == null) { + throw new ApiException( + "Missing the required parameter 'areaId' when calling getNetworkArea(Async)"); + } + + return getNetworkAreaCall(organizationId, areaId, _callback); + } + + /** + * Get details about a network area. Get details about a network area in an organization. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @return NetworkArea + * @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 Show network area details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public NetworkArea getNetworkArea( + @javax.annotation.Nonnull UUID organizationId, @javax.annotation.Nonnull UUID areaId) + throws ApiException { + ApiResponse localVarResp = getNetworkAreaWithHttpInfo(organizationId, areaId); + return localVarResp.getData(); + } + + /** + * Get details about a network area. Get details about a network area in an organization. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @return ApiResponse<NetworkArea> + * @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 Show network area details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse getNetworkAreaWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, @javax.annotation.Nonnull UUID areaId) + throws ApiException { + okhttp3.Call localVarCall = getNetworkAreaValidateBeforeCall(organizationId, areaId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get details about a network area. (asynchronously) Get details about a network area in an + * organization. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (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 Show network area details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call getNetworkAreaAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getNetworkAreaValidateBeforeCall(organizationId, areaId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getNetworkAreaRange + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param networkRangeId The identifier (ID) of a STACKIT Network Range. (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 Show network range details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call getNetworkAreaRangeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull UUID networkRangeId, + 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/organizations/{organizationId}/network-areas/{areaId}/network-ranges/{networkRangeId}" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "areaId" + "}", + localVarApiClient.escapeString(areaId.toString())) + .replace( + "{" + "networkRangeId" + "}", + localVarApiClient.escapeString(networkRangeId.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call getNetworkAreaRangeValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull UUID networkRangeId, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling getNetworkAreaRange(Async)"); + } + + // verify the required parameter 'areaId' is set + if (areaId == null) { + throw new ApiException( + "Missing the required parameter 'areaId' when calling getNetworkAreaRange(Async)"); + } + + // verify the required parameter 'networkRangeId' is set + if (networkRangeId == null) { + throw new ApiException( + "Missing the required parameter 'networkRangeId' when calling getNetworkAreaRange(Async)"); + } + + return getNetworkAreaRangeCall(organizationId, areaId, networkRangeId, _callback); + } + + /** + * Get details about a network range. Get details about a network range in a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param networkRangeId The identifier (ID) of a STACKIT Network Range. (required) + * @return NetworkRange + * @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 Show network range details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public NetworkRange getNetworkAreaRange( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull UUID networkRangeId) + throws ApiException { + ApiResponse localVarResp = + getNetworkAreaRangeWithHttpInfo(organizationId, areaId, networkRangeId); + return localVarResp.getData(); + } + + /** + * Get details about a network range. Get details about a network range in a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param networkRangeId The identifier (ID) of a STACKIT Network Range. (required) + * @return ApiResponse<NetworkRange> + * @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 Show network range details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse getNetworkAreaRangeWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull UUID networkRangeId) + throws ApiException { + okhttp3.Call localVarCall = + getNetworkAreaRangeValidateBeforeCall(organizationId, areaId, networkRangeId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get details about a network range. (asynchronously) Get details about a network range in a + * network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param networkRangeId The identifier (ID) of a STACKIT Network Range. (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 Show network range details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call getNetworkAreaRangeAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull UUID networkRangeId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getNetworkAreaRangeValidateBeforeCall( + organizationId, areaId, networkRangeId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getNetworkAreaRoute + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param routeId The identifier (ID) of a STACKIT Route. (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 Show route details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call getNetworkAreaRouteCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull UUID routeId, + 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/organizations/{organizationId}/network-areas/{areaId}/routes/{routeId}" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "areaId" + "}", + localVarApiClient.escapeString(areaId.toString())) + .replace( + "{" + "routeId" + "}", + localVarApiClient.escapeString(routeId.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call getNetworkAreaRouteValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull UUID routeId, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling getNetworkAreaRoute(Async)"); + } + + // verify the required parameter 'areaId' is set + if (areaId == null) { + throw new ApiException( + "Missing the required parameter 'areaId' when calling getNetworkAreaRoute(Async)"); + } + + // verify the required parameter 'routeId' is set + if (routeId == null) { + throw new ApiException( + "Missing the required parameter 'routeId' when calling getNetworkAreaRoute(Async)"); + } + + return getNetworkAreaRouteCall(organizationId, areaId, routeId, _callback); + } + + /** + * Get details about a network route. Get details about a network route defined in a network + * area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param routeId The identifier (ID) of a STACKIT Route. (required) + * @return Route + * @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 Show route details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public Route getNetworkAreaRoute( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull UUID routeId) + throws ApiException { + ApiResponse localVarResp = + getNetworkAreaRouteWithHttpInfo(organizationId, areaId, routeId); + return localVarResp.getData(); + } + + /** + * Get details about a network route. Get details about a network route defined in a network + * area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param routeId The identifier (ID) of a STACKIT Route. (required) + * @return ApiResponse<Route> + * @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 Show route details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse getNetworkAreaRouteWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull UUID routeId) + throws ApiException { + okhttp3.Call localVarCall = + getNetworkAreaRouteValidateBeforeCall(organizationId, areaId, routeId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get details about a network route. (asynchronously) Get details about a network route defined + * in a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param routeId The identifier (ID) of a STACKIT Route. (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 Show route details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call getNetworkAreaRouteAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull UUID routeId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getNetworkAreaRouteValidateBeforeCall(organizationId, areaId, routeId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getNic + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param nicId The identifier (ID) of a network interface. (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 Show network interface details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call getNicCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull UUID nicId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/networks/{networkId}/nics/{nicId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "networkId" + "}", + localVarApiClient.escapeString(networkId.toString())) + .replace( + "{" + "nicId" + "}", + localVarApiClient.escapeString(nicId.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call getNicValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull UUID nicId, + 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 getNic(Async)"); + } + + // verify the required parameter 'networkId' is set + if (networkId == null) { + throw new ApiException( + "Missing the required parameter 'networkId' when calling getNic(Async)"); + } + + // verify the required parameter 'nicId' is set + if (nicId == null) { + throw new ApiException( + "Missing the required parameter 'nicId' when calling getNic(Async)"); + } + + return getNicCall(projectId, networkId, nicId, _callback); + } + + /** + * Get details about a network interface of a network. Get details about a network interface + * inside a network. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param nicId The identifier (ID) of a network interface. (required) + * @return NIC + * @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 Show network interface details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public NIC getNic( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull UUID nicId) + throws ApiException { + ApiResponse localVarResp = getNicWithHttpInfo(projectId, networkId, nicId); + return localVarResp.getData(); + } + + /** + * Get details about a network interface of a network. Get details about a network interface + * inside a network. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param nicId The identifier (ID) of a network interface. (required) + * @return ApiResponse<NIC> + * @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 Show network interface details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse getNicWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull UUID nicId) + throws ApiException { + okhttp3.Call localVarCall = getNicValidateBeforeCall(projectId, networkId, nicId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get details about a network interface of a network. (asynchronously) Get details about a + * network interface inside a network. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param nicId The identifier (ID) of a network interface. (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 Show network interface details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call getNicAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull UUID nicId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getNicValidateBeforeCall(projectId, networkId, nicId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getOrganizationRequest + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param requestId The identifier (ID) of a STACKIT Request. (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 Show organization request details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call getOrganizationRequestCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull String requestId, + 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/organizations/{organizationId}/requests/{requestId}" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "requestId" + "}", + localVarApiClient.escapeString(requestId.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call getOrganizationRequestValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull String requestId, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling getOrganizationRequest(Async)"); + } + + // verify the required parameter 'requestId' is set + if (requestId == null) { + throw new ApiException( + "Missing the required parameter 'requestId' when calling getOrganizationRequest(Async)"); + } + + return getOrganizationRequestCall(organizationId, requestId, _callback); + } + + /** + * Lookup an organization request ID. Lookup an organization request ID from a previous request. + * This allows to find resource IDs of resources generated during a organization request. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param requestId The identifier (ID) of a STACKIT Request. (required) + * @return Request + * @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 Show organization request details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public Request getOrganizationRequest( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull String requestId) + throws ApiException { + ApiResponse localVarResp = + getOrganizationRequestWithHttpInfo(organizationId, requestId); + return localVarResp.getData(); + } + + /** + * Lookup an organization request ID. Lookup an organization request ID from a previous request. + * This allows to find resource IDs of resources generated during a organization request. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param requestId The identifier (ID) of a STACKIT Request. (required) + * @return ApiResponse<Request> + * @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 Show organization request details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse getOrganizationRequestWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull String requestId) + throws ApiException { + okhttp3.Call localVarCall = + getOrganizationRequestValidateBeforeCall(organizationId, requestId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Lookup an organization request ID. (asynchronously) Lookup an organization request ID from a + * previous request. This allows to find resource IDs of resources generated during a + * organization request. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param requestId The identifier (ID) of a STACKIT Request. (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 Show organization request details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call getOrganizationRequestAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull String requestId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getOrganizationRequestValidateBeforeCall(organizationId, requestId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getProjectDetails + * + * @param projectId The identifier (ID) of a STACKIT Project. (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 Show project details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call getProjectDetailsCall( + @javax.annotation.Nonnull UUID projectId, final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}" + .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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call getProjectDetailsValidateBeforeCall( + @javax.annotation.Nonnull UUID 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 getProjectDetails(Async)"); + } + + return getProjectDetailsCall(projectId, _callback); + } + + /** + * Get project details. Get details about a STACKIT project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @return Project + * @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 Show project details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public Project getProjectDetails(@javax.annotation.Nonnull UUID projectId) throws ApiException { + ApiResponse localVarResp = getProjectDetailsWithHttpInfo(projectId); + return localVarResp.getData(); + } + + /** + * Get project details. Get details about a STACKIT project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @return ApiResponse<Project> + * @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 Show project details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse getProjectDetailsWithHttpInfo( + @javax.annotation.Nonnull UUID projectId) throws ApiException { + okhttp3.Call localVarCall = getProjectDetailsValidateBeforeCall(projectId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get project details. (asynchronously) Get details about a STACKIT project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (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 Show project details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call getProjectDetailsAsync( + @javax.annotation.Nonnull UUID projectId, final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = getProjectDetailsValidateBeforeCall(projectId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getProjectNIC + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param nicId The identifier (ID) of a network interface. (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 Show details of network interface. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call getProjectNICCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID nicId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/nics/{nicId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "nicId" + "}", + localVarApiClient.escapeString(nicId.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call getProjectNICValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID nicId, + 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 getProjectNIC(Async)"); + } + + // verify the required parameter 'nicId' is set + if (nicId == null) { + throw new ApiException( + "Missing the required parameter 'nicId' when calling getProjectNIC(Async)"); + } + + return getProjectNICCall(projectId, nicId, _callback); + } + + /** + * Get details about a network interface of a project. Get details about a network interface + * inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param nicId The identifier (ID) of a network interface. (required) + * @return NIC + * @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 Show details of network interface. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public NIC getProjectNIC( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull UUID nicId) + throws ApiException { + ApiResponse localVarResp = getProjectNICWithHttpInfo(projectId, nicId); + return localVarResp.getData(); + } + + /** + * Get details about a network interface of a project. Get details about a network interface + * inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param nicId The identifier (ID) of a network interface. (required) + * @return ApiResponse<NIC> + * @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 Show details of network interface. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse getProjectNICWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull UUID nicId) + throws ApiException { + okhttp3.Call localVarCall = getProjectNICValidateBeforeCall(projectId, nicId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get details about a network interface of a project. (asynchronously) Get details about a + * network interface inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param nicId The identifier (ID) of a network interface. (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 Show details of network interface. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call getProjectNICAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID nicId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = getProjectNICValidateBeforeCall(projectId, nicId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getProjectRequest + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param requestId The identifier (ID) of a STACKIT Request. (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 Show project request details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call getProjectRequestCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String requestId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/requests/{requestId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "requestId" + "}", + localVarApiClient.escapeString(requestId.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call getProjectRequestValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String requestId, + 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 getProjectRequest(Async)"); + } + + // verify the required parameter 'requestId' is set + if (requestId == null) { + throw new ApiException( + "Missing the required parameter 'requestId' when calling getProjectRequest(Async)"); + } + + return getProjectRequestCall(projectId, requestId, _callback); + } + + /** + * Lookup a project request ID. Lookup a project request ID from a previous request. This allows + * to find resource IDs of resources generated during a projects request. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param requestId The identifier (ID) of a STACKIT Request. (required) + * @return Request + * @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 Show project request details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public Request getProjectRequest( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull String requestId) + throws ApiException { + ApiResponse localVarResp = getProjectRequestWithHttpInfo(projectId, requestId); + return localVarResp.getData(); + } + + /** + * Lookup a project request ID. Lookup a project request ID from a previous request. This allows + * to find resource IDs of resources generated during a projects request. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param requestId The identifier (ID) of a STACKIT Request. (required) + * @return ApiResponse<Request> + * @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 Show project request details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse getProjectRequestWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull String requestId) + throws ApiException { + okhttp3.Call localVarCall = getProjectRequestValidateBeforeCall(projectId, requestId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Lookup a project request ID. (asynchronously) Lookup a project request ID from a previous + * request. This allows to find resource IDs of resources generated during a projects request. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param requestId The identifier (ID) of a STACKIT Request. (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 Show project request details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call getProjectRequestAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String requestId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getProjectRequestValidateBeforeCall(projectId, requestId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getPublicIP + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param publicIpId The identifier (ID) of a Public IP. (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 Show public IP details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call getPublicIPCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID publicIpId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/public-ips/{publicIpId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "publicIpId" + "}", + localVarApiClient.escapeString(publicIpId.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call getPublicIPValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID publicIpId, + 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 getPublicIP(Async)"); + } + + // verify the required parameter 'publicIpId' is set + if (publicIpId == null) { + throw new ApiException( + "Missing the required parameter 'publicIpId' when calling getPublicIP(Async)"); + } + + return getPublicIPCall(projectId, publicIpId, _callback); + } + + /** + * Get details about a public IP. Get details about a public IP inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param publicIpId The identifier (ID) of a Public IP. (required) + * @return PublicIp + * @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 Show public IP details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public PublicIp getPublicIP( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull UUID publicIpId) + throws ApiException { + ApiResponse localVarResp = getPublicIPWithHttpInfo(projectId, publicIpId); + return localVarResp.getData(); + } + + /** + * Get details about a public IP. Get details about a public IP inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param publicIpId The identifier (ID) of a Public IP. (required) + * @return ApiResponse<PublicIp> + * @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 Show public IP details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse getPublicIPWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull UUID publicIpId) + throws ApiException { + okhttp3.Call localVarCall = getPublicIPValidateBeforeCall(projectId, publicIpId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get details about a public IP. (asynchronously) Get details about a public IP inside a + * project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param publicIpId The identifier (ID) of a Public IP. (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 Show public IP details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call getPublicIPAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID publicIpId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = getPublicIPValidateBeforeCall(projectId, publicIpId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getSecurityGroup + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security 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 Show security group details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call getSecurityGroupCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID securityGroupId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/security-groups/{securityGroupId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "securityGroupId" + "}", + localVarApiClient.escapeString(securityGroupId.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call getSecurityGroupValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID securityGroupId, + 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 getSecurityGroup(Async)"); + } + + // verify the required parameter 'securityGroupId' is set + if (securityGroupId == null) { + throw new ApiException( + "Missing the required parameter 'securityGroupId' when calling getSecurityGroup(Async)"); + } + + return getSecurityGroupCall(projectId, securityGroupId, _callback); + } + + /** + * Get security group details. Get details about a security group of a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security Group. (required) + * @return SecurityGroup + * @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 Show security group details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public SecurityGroup getSecurityGroup( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID securityGroupId) + throws ApiException { + ApiResponse localVarResp = + getSecurityGroupWithHttpInfo(projectId, securityGroupId); + return localVarResp.getData(); + } + + /** + * Get security group details. Get details about a security group of a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security Group. (required) + * @return ApiResponse<SecurityGroup> + * @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 Show security group details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse getSecurityGroupWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID securityGroupId) + throws ApiException { + okhttp3.Call localVarCall = + getSecurityGroupValidateBeforeCall(projectId, securityGroupId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get security group details. (asynchronously) Get details about a security group of a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security 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 Show security group details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call getSecurityGroupAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID securityGroupId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getSecurityGroupValidateBeforeCall(projectId, securityGroupId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getSecurityGroupRule + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security Group. (required) + * @param securityGroupRuleId The identifier (ID) of a STACKIT Security Group Rule. (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 Show security group rule details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call getSecurityGroupRuleCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID securityGroupId, + @javax.annotation.Nonnull UUID securityGroupRuleId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/security-groups/{securityGroupId}/rules/{securityGroupRuleId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "securityGroupId" + "}", + localVarApiClient.escapeString(securityGroupId.toString())) + .replace( + "{" + "securityGroupRuleId" + "}", + localVarApiClient.escapeString(securityGroupRuleId.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call getSecurityGroupRuleValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID securityGroupId, + @javax.annotation.Nonnull UUID securityGroupRuleId, + 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 getSecurityGroupRule(Async)"); + } + + // verify the required parameter 'securityGroupId' is set + if (securityGroupId == null) { + throw new ApiException( + "Missing the required parameter 'securityGroupId' when calling getSecurityGroupRule(Async)"); + } + + // verify the required parameter 'securityGroupRuleId' is set + if (securityGroupRuleId == null) { + throw new ApiException( + "Missing the required parameter 'securityGroupRuleId' when calling getSecurityGroupRule(Async)"); + } + + return getSecurityGroupRuleCall(projectId, securityGroupId, securityGroupRuleId, _callback); + } + + /** + * Get security group rule details. Get details about a security group rule of a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security Group. (required) + * @param securityGroupRuleId The identifier (ID) of a STACKIT Security Group Rule. (required) + * @return SecurityGroupRule + * @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 Show security group rule details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public SecurityGroupRule getSecurityGroupRule( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID securityGroupId, + @javax.annotation.Nonnull UUID securityGroupRuleId) + throws ApiException { + ApiResponse localVarResp = + getSecurityGroupRuleWithHttpInfo(projectId, securityGroupId, securityGroupRuleId); + return localVarResp.getData(); + } + + /** + * Get security group rule details. Get details about a security group rule of a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security Group. (required) + * @param securityGroupRuleId The identifier (ID) of a STACKIT Security Group Rule. (required) + * @return ApiResponse<SecurityGroupRule> + * @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 Show security group rule details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse getSecurityGroupRuleWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID securityGroupId, + @javax.annotation.Nonnull UUID securityGroupRuleId) + throws ApiException { + okhttp3.Call localVarCall = + getSecurityGroupRuleValidateBeforeCall( + projectId, securityGroupId, securityGroupRuleId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get security group rule details. (asynchronously) Get details about a security group rule of + * a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security Group. (required) + * @param securityGroupRuleId The identifier (ID) of a STACKIT Security Group Rule. (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 Show security group rule details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call getSecurityGroupRuleAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID securityGroupId, + @javax.annotation.Nonnull UUID securityGroupRuleId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getSecurityGroupRuleValidateBeforeCall( + projectId, securityGroupId, securityGroupRuleId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getServer + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param details Show detailed information about server. (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
200 Show server details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call getServerCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nullable Boolean details, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/servers/{serverId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (details != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("details", details)); + } + + 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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call getServerValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nullable Boolean details, + 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 getServer(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling getServer(Async)"); + } + + return getServerCall(projectId, serverId, details, _callback); + } + + /** + * Get server details. Get details about a server by its ID. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param details Show detailed information about server. (optional, default to false) + * @return Server + * @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 Show server details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public Server getServer( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nullable Boolean details) + throws ApiException { + ApiResponse localVarResp = getServerWithHttpInfo(projectId, serverId, details); + return localVarResp.getData(); + } + + /** + * Get server details. Get details about a server by its ID. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param details Show detailed information about server. (optional, default to false) + * @return ApiResponse<Server> + * @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 Show server details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse getServerWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nullable Boolean details) + throws ApiException { + okhttp3.Call localVarCall = getServerValidateBeforeCall(projectId, serverId, details, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get server details. (asynchronously) Get details about a server by its ID. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param details Show detailed information about server. (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
200 Show server details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call getServerAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nullable Boolean details, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getServerValidateBeforeCall(projectId, serverId, details, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getServerConsole + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (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 Show server console URL. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call getServerConsoleCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/servers/{serverId}/console" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call getServerConsoleValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'projectId' is set + if (projectId == null) { + throw new ApiException( + "Missing the required parameter 'projectId' when calling getServerConsole(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling getServerConsole(Async)"); + } + + return getServerConsoleCall(projectId, serverId, _callback); + } + + /** + * Get server console. Get a URL for server remote console. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @return ServerConsoleUrl + * @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 Show server console URL. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ServerConsoleUrl getServerConsole( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull UUID serverId) + throws ApiException { + ApiResponse localVarResp = + getServerConsoleWithHttpInfo(projectId, serverId); + return localVarResp.getData(); + } + + /** + * Get server console. Get a URL for server remote console. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @return ApiResponse<ServerConsoleUrl> + * @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 Show server console URL. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse getServerConsoleWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull UUID serverId) + throws ApiException { + okhttp3.Call localVarCall = getServerConsoleValidateBeforeCall(projectId, serverId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get server console. (asynchronously) Get a URL for server remote console. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (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 Show server console URL. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call getServerConsoleAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getServerConsoleValidateBeforeCall(projectId, serverId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getServerLog + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param length Request the server log. By default the length is limited to 2000 lines. Set to + * 0 to retrieve the complete log. (optional, default to 2000) + * @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 Show server console log. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call getServerLogCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nullable Long length, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/servers/{serverId}/log" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (length != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("length", length)); + } + + 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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call getServerLogValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nullable Long length, + 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 getServerLog(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling getServerLog(Async)"); + } + + return getServerLogCall(projectId, serverId, length, _callback); + } + + /** + * Get server log. Get server console log. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param length Request the server log. By default the length is limited to 2000 lines. Set to + * 0 to retrieve the complete log. (optional, default to 2000) + * @return GetServerLog200Response + * @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 Show server console log. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public GetServerLog200Response getServerLog( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nullable Long length) + throws ApiException { + ApiResponse localVarResp = + getServerLogWithHttpInfo(projectId, serverId, length); + return localVarResp.getData(); + } + + /** + * Get server log. Get server console log. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param length Request the server log. By default the length is limited to 2000 lines. Set to + * 0 to retrieve the complete log. (optional, default to 2000) + * @return ApiResponse<GetServerLog200Response> + * @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 Show server console log. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse getServerLogWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nullable Long length) + throws ApiException { + okhttp3.Call localVarCall = + getServerLogValidateBeforeCall(projectId, serverId, length, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get server log. (asynchronously) Get server console log. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param length Request the server log. By default the length is limited to 2000 lines. Set to + * 0 to retrieve the complete log. (optional, default to 2000) + * @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 Show server console log. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call getServerLogAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nullable Long length, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getServerLogValidateBeforeCall(projectId, serverId, length, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getSnapshot + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param snapshotId The identifier (ID) of a STACKIT Snapshot. (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 Show snapshot details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call getSnapshotCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID snapshotId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/snapshots/{snapshotId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "snapshotId" + "}", + localVarApiClient.escapeString(snapshotId.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call getSnapshotValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID snapshotId, + 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 getSnapshot(Async)"); + } + + // verify the required parameter 'snapshotId' is set + if (snapshotId == null) { + throw new ApiException( + "Missing the required parameter 'snapshotId' when calling getSnapshot(Async)"); + } + + return getSnapshotCall(projectId, snapshotId, _callback); + } + + /** + * Get details about a snapshot. Get details about a block device snapshot. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param snapshotId The identifier (ID) of a STACKIT Snapshot. (required) + * @return Snapshot + * @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 Show snapshot details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public Snapshot getSnapshot( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull UUID snapshotId) + throws ApiException { + ApiResponse localVarResp = getSnapshotWithHttpInfo(projectId, snapshotId); + return localVarResp.getData(); + } + + /** + * Get details about a snapshot. Get details about a block device snapshot. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param snapshotId The identifier (ID) of a STACKIT Snapshot. (required) + * @return ApiResponse<Snapshot> + * @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 Show snapshot details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse getSnapshotWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull UUID snapshotId) + throws ApiException { + okhttp3.Call localVarCall = getSnapshotValidateBeforeCall(projectId, snapshotId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get details about a snapshot. (asynchronously) Get details about a block device snapshot. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param snapshotId The identifier (ID) of a STACKIT Snapshot. (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 Show snapshot details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call getSnapshotAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID snapshotId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = getSnapshotValidateBeforeCall(projectId, snapshotId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getVolume + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (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 Show volume details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call getVolumeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID volumeId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/volumes/{volumeId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "volumeId" + "}", + localVarApiClient.escapeString(volumeId.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call getVolumeValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID volumeId, + 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 getVolume(Async)"); + } + + // verify the required parameter 'volumeId' is set + if (volumeId == null) { + throw new ApiException( + "Missing the required parameter 'volumeId' when calling getVolume(Async)"); + } + + return getVolumeCall(projectId, volumeId, _callback); + } + + /** + * Get details about a volume. Get details about a block device volume. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @return Volume + * @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 Show volume details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public Volume getVolume( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull UUID volumeId) + throws ApiException { + ApiResponse localVarResp = getVolumeWithHttpInfo(projectId, volumeId); + return localVarResp.getData(); + } + + /** + * Get details about a volume. Get details about a block device volume. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @return ApiResponse<Volume> + * @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 Show volume details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse getVolumeWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull UUID volumeId) + throws ApiException { + okhttp3.Call localVarCall = getVolumeValidateBeforeCall(projectId, volumeId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get details about a volume. (asynchronously) Get details about a block device volume. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (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 Show volume details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call getVolumeAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID volumeId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = getVolumeValidateBeforeCall(projectId, volumeId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getVolumePerformanceClass + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param volumePerformanceClass The name of a STACKIT Volume performance class. (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 Show volume performance class details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call getVolumePerformanceClassCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String volumePerformanceClass, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/volume-performance-classes/{volumePerformanceClass}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "volumePerformanceClass" + "}", + localVarApiClient.escapeString(volumePerformanceClass.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call getVolumePerformanceClassValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String volumePerformanceClass, + 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 getVolumePerformanceClass(Async)"); + } + + // verify the required parameter 'volumePerformanceClass' is set + if (volumePerformanceClass == null) { + throw new ApiException( + "Missing the required parameter 'volumePerformanceClass' when calling getVolumePerformanceClass(Async)"); + } + + return getVolumePerformanceClassCall(projectId, volumePerformanceClass, _callback); + } + + /** + * Get details about a volume performance class. Get details about a specific volume performance + * class. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param volumePerformanceClass The name of a STACKIT Volume performance class. (required) + * @return VolumePerformanceClass + * @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 Show volume performance class details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public VolumePerformanceClass getVolumePerformanceClass( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String volumePerformanceClass) + throws ApiException { + ApiResponse localVarResp = + getVolumePerformanceClassWithHttpInfo(projectId, volumePerformanceClass); + return localVarResp.getData(); + } + + /** + * Get details about a volume performance class. Get details about a specific volume performance + * class. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param volumePerformanceClass The name of a STACKIT Volume performance class. (required) + * @return ApiResponse<VolumePerformanceClass> + * @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 Show volume performance class details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse getVolumePerformanceClassWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String volumePerformanceClass) + throws ApiException { + okhttp3.Call localVarCall = + getVolumePerformanceClassValidateBeforeCall( + projectId, volumePerformanceClass, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get details about a volume performance class. (asynchronously) Get details about a specific + * volume performance class. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param volumePerformanceClass The name of a STACKIT Volume performance class. (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 Show volume performance class details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call getVolumePerformanceClassAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String volumePerformanceClass, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getVolumePerformanceClassValidateBeforeCall( + projectId, volumePerformanceClass, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listAffinityGroups + * + * @param projectId The identifier (ID) of a STACKIT Project. (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 List affinity groups. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call listAffinityGroupsCall( + @javax.annotation.Nonnull UUID projectId, final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/affinity-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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call listAffinityGroupsValidateBeforeCall( + @javax.annotation.Nonnull UUID 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 listAffinityGroups(Async)"); + } + + return listAffinityGroupsCall(projectId, _callback); + } + + /** + * Get the affinity groups setup for a project. Get the affinity groups created in a project. + * Affinity groups are an indication of locality of a server relative to another group of + * servers. They can be either running on the same host (affinity) or on different ones + * (anti-affinity). + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @return AffinityGroupListResponse + * @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 List affinity groups. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public AffinityGroupListResponse listAffinityGroups(@javax.annotation.Nonnull UUID projectId) + throws ApiException { + ApiResponse localVarResp = + listAffinityGroupsWithHttpInfo(projectId); + return localVarResp.getData(); + } + + /** + * Get the affinity groups setup for a project. Get the affinity groups created in a project. + * Affinity groups are an indication of locality of a server relative to another group of + * servers. They can be either running on the same host (affinity) or on different ones + * (anti-affinity). + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @return ApiResponse<AffinityGroupListResponse> + * @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 List affinity groups. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse listAffinityGroupsWithHttpInfo( + @javax.annotation.Nonnull UUID projectId) throws ApiException { + okhttp3.Call localVarCall = listAffinityGroupsValidateBeforeCall(projectId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get the affinity groups setup for a project. (asynchronously) Get the affinity groups created + * in a project. Affinity groups are an indication of locality of a server relative to another + * group of servers. They can be either running on the same host (affinity) or on different ones + * (anti-affinity). + * + * @param projectId The identifier (ID) of a STACKIT Project. (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 List affinity groups. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call listAffinityGroupsAsync( + @javax.annotation.Nonnull UUID projectId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = listAffinityGroupsValidateBeforeCall(projectId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listAttachedVolumes + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (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 List volume attachments. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call listAttachedVolumesCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/servers/{serverId}/volume-attachments" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call listAttachedVolumesValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'projectId' is set + if (projectId == null) { + throw new ApiException( + "Missing the required parameter 'projectId' when calling listAttachedVolumes(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling listAttachedVolumes(Async)"); + } + + return listAttachedVolumesCall(projectId, serverId, _callback); + } + + /** + * List all volume attachments of a server. Get a list of all volume attachments of a server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @return VolumeAttachmentListResponse + * @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 List volume attachments. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public VolumeAttachmentListResponse listAttachedVolumes( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull UUID serverId) + throws ApiException { + ApiResponse localVarResp = + listAttachedVolumesWithHttpInfo(projectId, serverId); + return localVarResp.getData(); + } + + /** + * List all volume attachments of a server. Get a list of all volume attachments of a server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @return ApiResponse<VolumeAttachmentListResponse> + * @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 List volume attachments. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse listAttachedVolumesWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull UUID serverId) + throws ApiException { + okhttp3.Call localVarCall = + listAttachedVolumesValidateBeforeCall(projectId, serverId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List all volume attachments of a server. (asynchronously) Get a list of all volume + * attachments of a server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (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 List volume attachments. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call listAttachedVolumesAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listAttachedVolumesValidateBeforeCall(projectId, serverId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listAvailabilityZones + * + * @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 Get a list of availability zones. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call listAvailabilityZonesCall(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/availability-zones"; + + 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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call listAvailabilityZonesValidateBeforeCall(final ApiCallback _callback) + throws ApiException { + return listAvailabilityZonesCall(_callback); + } + + /** + * List all availability zones. Get a list of all availability zones. + * + * @return AvailabilityZoneListResponse + * @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 Get a list of availability zones. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public AvailabilityZoneListResponse listAvailabilityZones() throws ApiException { + ApiResponse localVarResp = + listAvailabilityZonesWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * List all availability zones. Get a list of all availability zones. + * + * @return ApiResponse<AvailabilityZoneListResponse> + * @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 Get a list of availability zones. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse listAvailabilityZonesWithHttpInfo() + throws ApiException { + okhttp3.Call localVarCall = listAvailabilityZonesValidateBeforeCall(null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List all availability zones. (asynchronously) Get a list of all availability zones. + * + * @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 Get a list of availability zones. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call listAvailabilityZonesAsync( + final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = listAvailabilityZonesValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listBackups + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param labelSelector Filter resources by labels. (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 List project backups. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call listBackupsCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nullable String labelSelector, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/backups" + .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 (labelSelector != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("label_selector", labelSelector)); + } + + 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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call listBackupsValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nullable String labelSelector, + 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 listBackups(Async)"); + } + + return listBackupsCall(projectId, labelSelector, _callback); + } + + /** + * List all backups inside a project. Get a list of all backups inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return BackupListResponse + * @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 List project backups. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public BackupListResponse listBackups( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + ApiResponse localVarResp = + listBackupsWithHttpInfo(projectId, labelSelector); + return localVarResp.getData(); + } + + /** + * List all backups inside a project. Get a list of all backups inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return ApiResponse<BackupListResponse> + * @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 List project backups. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse listBackupsWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + okhttp3.Call localVarCall = listBackupsValidateBeforeCall(projectId, labelSelector, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List all backups inside a project. (asynchronously) Get a list of all backups inside a + * project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param labelSelector Filter resources by labels. (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 List project backups. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call listBackupsAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nullable String labelSelector, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listBackupsValidateBeforeCall(projectId, labelSelector, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listImages + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param all List all Images. (optional, default to false) + * @param labelSelector Filter resources by labels. (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 List project images. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call listImagesCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nullable Boolean all, + @javax.annotation.Nullable String labelSelector, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/images" + .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 (all != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("all", all)); + } + + if (labelSelector != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("label_selector", labelSelector)); + } + + 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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call listImagesValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nullable Boolean all, + @javax.annotation.Nullable String labelSelector, + 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 listImages(Async)"); + } + + return listImagesCall(projectId, all, labelSelector, _callback); + } + + /** + * List all Images inside a project. Get a list of all images inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param all List all Images. (optional, default to false) + * @param labelSelector Filter resources by labels. (optional) + * @return ImageListResponse + * @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 List project images. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ImageListResponse listImages( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nullable Boolean all, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + ApiResponse localVarResp = + listImagesWithHttpInfo(projectId, all, labelSelector); + return localVarResp.getData(); + } + + /** + * List all Images inside a project. Get a list of all images inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param all List all Images. (optional, default to false) + * @param labelSelector Filter resources by labels. (optional) + * @return ApiResponse<ImageListResponse> + * @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 List project images. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse listImagesWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nullable Boolean all, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + okhttp3.Call localVarCall = + listImagesValidateBeforeCall(projectId, all, labelSelector, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List all Images inside a project. (asynchronously) Get a list of all images inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param all List all Images. (optional, default to false) + * @param labelSelector Filter resources by labels. (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 List project images. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call listImagesAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nullable Boolean all, + @javax.annotation.Nullable String labelSelector, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listImagesValidateBeforeCall(projectId, all, labelSelector, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listKeyPairs + * + * @param labelSelector Filter resources by labels. (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 List SSH keypairs. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call listKeyPairsCall( + @javax.annotation.Nullable String labelSelector, 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/keypairs"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (labelSelector != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("label_selector", labelSelector)); + } + + 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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call listKeyPairsValidateBeforeCall( + @javax.annotation.Nullable String labelSelector, final ApiCallback _callback) + throws ApiException { + return listKeyPairsCall(labelSelector, _callback); + } + + /** + * List all SSH keypairs for the requesting user. Get a list of all SSH keypairs assigned to the + * requesting user. + * + * @param labelSelector Filter resources by labels. (optional) + * @return KeyPairListResponse + * @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 List SSH keypairs. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public KeyPairListResponse listKeyPairs(@javax.annotation.Nullable String labelSelector) + throws ApiException { + ApiResponse localVarResp = listKeyPairsWithHttpInfo(labelSelector); + return localVarResp.getData(); + } + + /** + * List all SSH keypairs for the requesting user. Get a list of all SSH keypairs assigned to the + * requesting user. + * + * @param labelSelector Filter resources by labels. (optional) + * @return ApiResponse<KeyPairListResponse> + * @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 List SSH keypairs. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse listKeyPairsWithHttpInfo( + @javax.annotation.Nullable String labelSelector) throws ApiException { + okhttp3.Call localVarCall = listKeyPairsValidateBeforeCall(labelSelector, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List all SSH keypairs for the requesting user. (asynchronously) Get a list of all SSH + * keypairs assigned to the requesting user. + * + * @param labelSelector Filter resources by labels. (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 List SSH keypairs. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call listKeyPairsAsync( + @javax.annotation.Nullable String labelSelector, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = listKeyPairsValidateBeforeCall(labelSelector, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listMachineTypes + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param filter Filter resources by fields. A subset of expr-lang is supported. See + * https://expr-lang.org/docs/language-definition for usage details. (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 List of machine types. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call listMachineTypesCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nullable String filter, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/machine-types" + .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 (filter != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("filter", filter)); + } + + 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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call listMachineTypesValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nullable String filter, + 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 listMachineTypes(Async)"); + } + + return listMachineTypesCall(projectId, filter, _callback); + } + + /** + * List all machine types available for a project. Get a list of all machine type available in a + * project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param filter Filter resources by fields. A subset of expr-lang is supported. See + * https://expr-lang.org/docs/language-definition for usage details. (optional) + * @return MachineTypeListResponse + * @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 List of machine types. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public MachineTypeListResponse listMachineTypes( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nullable String filter) + throws ApiException { + ApiResponse localVarResp = + listMachineTypesWithHttpInfo(projectId, filter); + return localVarResp.getData(); + } + + /** + * List all machine types available for a project. Get a list of all machine type available in a + * project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param filter Filter resources by fields. A subset of expr-lang is supported. See + * https://expr-lang.org/docs/language-definition for usage details. (optional) + * @return ApiResponse<MachineTypeListResponse> + * @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 List of machine types. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse listMachineTypesWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nullable String filter) + throws ApiException { + okhttp3.Call localVarCall = listMachineTypesValidateBeforeCall(projectId, filter, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List all machine types available for a project. (asynchronously) Get a list of all machine + * type available in a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param filter Filter resources by fields. A subset of expr-lang is supported. See + * https://expr-lang.org/docs/language-definition for usage details. (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 List of machine types. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call listMachineTypesAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nullable String filter, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listMachineTypesValidateBeforeCall(projectId, filter, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listNetworkAreaProjects + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (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 List projects for a network area. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call listNetworkAreaProjectsCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + 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/organizations/{organizationId}/network-areas/{areaId}/projects" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "areaId" + "}", + localVarApiClient.escapeString(areaId.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call listNetworkAreaProjectsValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling listNetworkAreaProjects(Async)"); + } + + // verify the required parameter 'areaId' is set + if (areaId == null) { + throw new ApiException( + "Missing the required parameter 'areaId' when calling listNetworkAreaProjects(Async)"); + } + + return listNetworkAreaProjectsCall(organizationId, areaId, _callback); + } + + /** + * List all projects using a network area. Get a list of all projects using a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @return ProjectListResponse + * @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 List projects for a network area. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ProjectListResponse listNetworkAreaProjects( + @javax.annotation.Nonnull UUID organizationId, @javax.annotation.Nonnull UUID areaId) + throws ApiException { + ApiResponse localVarResp = + listNetworkAreaProjectsWithHttpInfo(organizationId, areaId); + return localVarResp.getData(); + } + + /** + * List all projects using a network area. Get a list of all projects using a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @return ApiResponse<ProjectListResponse> + * @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 List projects for a network area. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse listNetworkAreaProjectsWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, @javax.annotation.Nonnull UUID areaId) + throws ApiException { + okhttp3.Call localVarCall = + listNetworkAreaProjectsValidateBeforeCall(organizationId, areaId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List all projects using a network area. (asynchronously) Get a list of all projects using a + * network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (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 List projects for a network area. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call listNetworkAreaProjectsAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listNetworkAreaProjectsValidateBeforeCall(organizationId, areaId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listNetworkAreaRanges + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (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 List all network ranges. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call listNetworkAreaRangesCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + 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/organizations/{organizationId}/network-areas/{areaId}/network-ranges" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "areaId" + "}", + localVarApiClient.escapeString(areaId.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call listNetworkAreaRangesValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling listNetworkAreaRanges(Async)"); + } + + // verify the required parameter 'areaId' is set + if (areaId == null) { + throw new ApiException( + "Missing the required parameter 'areaId' when calling listNetworkAreaRanges(Async)"); + } + + return listNetworkAreaRangesCall(organizationId, areaId, _callback); + } + + /** + * List all network ranges in a network area. Get a list of all network ranges in a network + * area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @return NetworkRangeListResponse + * @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 List all network ranges. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public NetworkRangeListResponse listNetworkAreaRanges( + @javax.annotation.Nonnull UUID organizationId, @javax.annotation.Nonnull UUID areaId) + throws ApiException { + ApiResponse localVarResp = + listNetworkAreaRangesWithHttpInfo(organizationId, areaId); + return localVarResp.getData(); + } + + /** + * List all network ranges in a network area. Get a list of all network ranges in a network + * area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @return ApiResponse<NetworkRangeListResponse> + * @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 List all network ranges. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse listNetworkAreaRangesWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, @javax.annotation.Nonnull UUID areaId) + throws ApiException { + okhttp3.Call localVarCall = + listNetworkAreaRangesValidateBeforeCall(organizationId, areaId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List all network ranges in a network area. (asynchronously) Get a list of all network ranges + * in a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (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 List all network ranges. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call listNetworkAreaRangesAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listNetworkAreaRangesValidateBeforeCall(organizationId, areaId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listNetworkAreaRoutes + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param labelSelector Filter resources by labels. (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 List network routes. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call listNetworkAreaRoutesCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nullable String labelSelector, + 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/organizations/{organizationId}/network-areas/{areaId}/routes" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "areaId" + "}", + localVarApiClient.escapeString(areaId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (labelSelector != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("label_selector", labelSelector)); + } + + 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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call listNetworkAreaRoutesValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nullable String labelSelector, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling listNetworkAreaRoutes(Async)"); + } + + // verify the required parameter 'areaId' is set + if (areaId == null) { + throw new ApiException( + "Missing the required parameter 'areaId' when calling listNetworkAreaRoutes(Async)"); + } + + return listNetworkAreaRoutesCall(organizationId, areaId, labelSelector, _callback); + } + + /** + * List all network routes in a network area. Get a list of all network routes defined in a + * network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return RouteListResponse + * @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 List network routes. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public RouteListResponse listNetworkAreaRoutes( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + ApiResponse localVarResp = + listNetworkAreaRoutesWithHttpInfo(organizationId, areaId, labelSelector); + return localVarResp.getData(); + } + + /** + * List all network routes in a network area. Get a list of all network routes defined in a + * network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return ApiResponse<RouteListResponse> + * @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 List network routes. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse listNetworkAreaRoutesWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + okhttp3.Call localVarCall = + listNetworkAreaRoutesValidateBeforeCall( + organizationId, areaId, labelSelector, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List all network routes in a network area. (asynchronously) Get a list of all network routes + * defined in a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param labelSelector Filter resources by labels. (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 List network routes. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call listNetworkAreaRoutesAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nullable String labelSelector, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listNetworkAreaRoutesValidateBeforeCall( + organizationId, areaId, labelSelector, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listNetworkAreas + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param labelSelector Filter resources by labels. (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 Get a list of all network areas. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call listNetworkAreasCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nullable String labelSelector, + 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/organizations/{organizationId}/network-areas" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (labelSelector != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("label_selector", labelSelector)); + } + + 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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call listNetworkAreasValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nullable String labelSelector, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling listNetworkAreas(Async)"); + } + + return listNetworkAreasCall(organizationId, labelSelector, _callback); + } + + /** + * List all network areas in an organization. Get a list of all visible network areas defined in + * an organization. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return NetworkAreaListResponse + * @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 Get a list of all network areas. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public NetworkAreaListResponse listNetworkAreas( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + ApiResponse localVarResp = + listNetworkAreasWithHttpInfo(organizationId, labelSelector); + return localVarResp.getData(); + } + + /** + * List all network areas in an organization. Get a list of all visible network areas defined in + * an organization. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return ApiResponse<NetworkAreaListResponse> + * @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 Get a list of all network areas. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse listNetworkAreasWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + okhttp3.Call localVarCall = + listNetworkAreasValidateBeforeCall(organizationId, labelSelector, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List all network areas in an organization. (asynchronously) Get a list of all visible network + * areas defined in an organization. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param labelSelector Filter resources by labels. (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 Get a list of all network areas. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call listNetworkAreasAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nullable String labelSelector, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listNetworkAreasValidateBeforeCall(organizationId, labelSelector, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listNetworks + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param labelSelector Filter resources by labels. (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 List all networks of a project. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call listNetworksCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nullable String labelSelector, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/networks" + .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 (labelSelector != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("label_selector", labelSelector)); + } + + 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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call listNetworksValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nullable String labelSelector, + 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 listNetworks(Async)"); + } + + return listNetworksCall(projectId, labelSelector, _callback); + } + + /** + * List all networks inside a project. Get a list of all networks inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return NetworkListResponse + * @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 List all networks of a project. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public NetworkListResponse listNetworks( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + ApiResponse localVarResp = + listNetworksWithHttpInfo(projectId, labelSelector); + return localVarResp.getData(); + } + + /** + * List all networks inside a project. Get a list of all networks inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return ApiResponse<NetworkListResponse> + * @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 List all networks of a project. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse listNetworksWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + okhttp3.Call localVarCall = listNetworksValidateBeforeCall(projectId, labelSelector, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List all networks inside a project. (asynchronously) Get a list of all networks inside a + * project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param labelSelector Filter resources by labels. (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 List all networks of a project. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call listNetworksAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nullable String labelSelector, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listNetworksValidateBeforeCall(projectId, labelSelector, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listNics + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param labelSelector Filter resources by labels. (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 List network interfaces of the network. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call listNicsCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nullable String labelSelector, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/networks/{networkId}/nics" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "networkId" + "}", + localVarApiClient.escapeString(networkId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (labelSelector != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("label_selector", labelSelector)); + } + + 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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call listNicsValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nullable String labelSelector, + 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 listNics(Async)"); + } + + // verify the required parameter 'networkId' is set + if (networkId == null) { + throw new ApiException( + "Missing the required parameter 'networkId' when calling listNics(Async)"); + } + + return listNicsCall(projectId, networkId, labelSelector, _callback); + } + + /** + * List all network interfaces inside a network. Get a list of all network interfaces inside a + * network. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return NICListResponse + * @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 List network interfaces of the network. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public NICListResponse listNics( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + ApiResponse localVarResp = + listNicsWithHttpInfo(projectId, networkId, labelSelector); + return localVarResp.getData(); + } + + /** + * List all network interfaces inside a network. Get a list of all network interfaces inside a + * network. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return ApiResponse<NICListResponse> + * @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 List network interfaces of the network. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse listNicsWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + okhttp3.Call localVarCall = + listNicsValidateBeforeCall(projectId, networkId, labelSelector, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List all network interfaces inside a network. (asynchronously) Get a list of all network + * interfaces inside a network. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param labelSelector Filter resources by labels. (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 List network interfaces of the network. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call listNicsAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nullable String labelSelector, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listNicsValidateBeforeCall(projectId, networkId, labelSelector, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listProjectNICs + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param labelSelector Filter resources by labels. (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 List network interfaces of the project. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call listProjectNICsCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nullable String labelSelector, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/nics" + .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 (labelSelector != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("label_selector", labelSelector)); + } + + 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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call listProjectNICsValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nullable String labelSelector, + 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 listProjectNICs(Async)"); + } + + return listProjectNICsCall(projectId, labelSelector, _callback); + } + + /** + * List all network interfaces inside a project. Get a list of all network interfaces inside a + * project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return NICListResponse + * @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 List network interfaces of the project. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public NICListResponse listProjectNICs( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + ApiResponse localVarResp = + listProjectNICsWithHttpInfo(projectId, labelSelector); + return localVarResp.getData(); + } + + /** + * List all network interfaces inside a project. Get a list of all network interfaces inside a + * project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return ApiResponse<NICListResponse> + * @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 List network interfaces of the project. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse listProjectNICsWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + okhttp3.Call localVarCall = + listProjectNICsValidateBeforeCall(projectId, labelSelector, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List all network interfaces inside a project. (asynchronously) Get a list of all network + * interfaces inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param labelSelector Filter resources by labels. (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 List network interfaces of the project. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call listProjectNICsAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nullable String labelSelector, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listProjectNICsValidateBeforeCall(projectId, labelSelector, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listPublicIPRanges + * + * @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 List public IP ranges. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call listPublicIPRangesCall(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/networks/public-ip-ranges"; + + 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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call listPublicIPRangesValidateBeforeCall(final ApiCallback _callback) + throws ApiException { + return listPublicIPRangesCall(_callback); + } + + /** + * List all public IP ranges. Get a list of all public IP ranges that STACKIT uses. + * + * @return PublicNetworkListResponse + * @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 List public IP ranges. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public PublicNetworkListResponse listPublicIPRanges() throws ApiException { + ApiResponse localVarResp = listPublicIPRangesWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * List all public IP ranges. Get a list of all public IP ranges that STACKIT uses. + * + * @return ApiResponse<PublicNetworkListResponse> + * @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 List public IP ranges. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse listPublicIPRangesWithHttpInfo() + throws ApiException { + okhttp3.Call localVarCall = listPublicIPRangesValidateBeforeCall(null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List all public IP ranges. (asynchronously) Get a list of all public IP ranges that STACKIT + * uses. + * + * @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 List public IP ranges. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call listPublicIPRangesAsync( + final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = listPublicIPRangesValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listPublicIPs + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param labelSelector Filter resources by labels. (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 List project public IPs. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call listPublicIPsCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nullable String labelSelector, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/public-ips" + .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 (labelSelector != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("label_selector", labelSelector)); + } + + 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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call listPublicIPsValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nullable String labelSelector, + 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 listPublicIPs(Async)"); + } + + return listPublicIPsCall(projectId, labelSelector, _callback); + } + + /** + * List all public IPs inside a project. Get a list of all public IPs inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return PublicIpListResponse + * @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 List project public IPs. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public PublicIpListResponse listPublicIPs( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + ApiResponse localVarResp = + listPublicIPsWithHttpInfo(projectId, labelSelector); + return localVarResp.getData(); + } + + /** + * List all public IPs inside a project. Get a list of all public IPs inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return ApiResponse<PublicIpListResponse> + * @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 List project public IPs. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse listPublicIPsWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + okhttp3.Call localVarCall = listPublicIPsValidateBeforeCall(projectId, labelSelector, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List all public IPs inside a project. (asynchronously) Get a list of all public IPs inside a + * project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param labelSelector Filter resources by labels. (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 List project public IPs. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call listPublicIPsAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nullable String labelSelector, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listPublicIPsValidateBeforeCall(projectId, labelSelector, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listQuotas + * + * @param projectId The identifier (ID) of a STACKIT Project. (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 List quotas. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call listQuotasCall( + @javax.annotation.Nonnull UUID projectId, final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/quotas" + .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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call listQuotasValidateBeforeCall( + @javax.annotation.Nonnull UUID 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 listQuotas(Async)"); + } + + return listQuotasCall(projectId, _callback); + } + + /** + * List project quotas. List quota limits and usage for project resources. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @return QuotaListResponse + * @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 List quotas. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public QuotaListResponse listQuotas(@javax.annotation.Nonnull UUID projectId) + throws ApiException { + ApiResponse localVarResp = listQuotasWithHttpInfo(projectId); + return localVarResp.getData(); + } + + /** + * List project quotas. List quota limits and usage for project resources. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @return ApiResponse<QuotaListResponse> + * @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 List quotas. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse listQuotasWithHttpInfo( + @javax.annotation.Nonnull UUID projectId) throws ApiException { + okhttp3.Call localVarCall = listQuotasValidateBeforeCall(projectId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List project quotas. (asynchronously) List quota limits and usage for project resources. + * + * @param projectId The identifier (ID) of a STACKIT Project. (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 List quotas. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call listQuotasAsync( + @javax.annotation.Nonnull UUID projectId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = listQuotasValidateBeforeCall(projectId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listSecurityGroupRules + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security 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 List all rules of a security group. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call listSecurityGroupRulesCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID securityGroupId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/security-groups/{securityGroupId}/rules" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "securityGroupId" + "}", + localVarApiClient.escapeString(securityGroupId.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call listSecurityGroupRulesValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID securityGroupId, + 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 listSecurityGroupRules(Async)"); + } + + // verify the required parameter 'securityGroupId' is set + if (securityGroupId == null) { + throw new ApiException( + "Missing the required parameter 'securityGroupId' when calling listSecurityGroupRules(Async)"); + } + + return listSecurityGroupRulesCall(projectId, securityGroupId, _callback); + } + + /** + * List all rules for a security group. Get a list of all rules inside a security group. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security Group. (required) + * @return SecurityGroupRuleListResponse + * @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 List all rules of a security group. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public SecurityGroupRuleListResponse listSecurityGroupRules( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID securityGroupId) + throws ApiException { + ApiResponse localVarResp = + listSecurityGroupRulesWithHttpInfo(projectId, securityGroupId); + return localVarResp.getData(); + } + + /** + * List all rules for a security group. Get a list of all rules inside a security group. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security Group. (required) + * @return ApiResponse<SecurityGroupRuleListResponse> + * @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 List all rules of a security group. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse listSecurityGroupRulesWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID securityGroupId) + throws ApiException { + okhttp3.Call localVarCall = + listSecurityGroupRulesValidateBeforeCall(projectId, securityGroupId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List all rules for a security group. (asynchronously) Get a list of all rules inside a + * security group. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security 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 List all rules of a security group. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call listSecurityGroupRulesAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID securityGroupId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listSecurityGroupRulesValidateBeforeCall(projectId, securityGroupId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listSecurityGroups + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param labelSelector Filter resources by labels. (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 List all security groups of a project. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call listSecurityGroupsCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nullable String labelSelector, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/security-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(); + + if (labelSelector != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("label_selector", labelSelector)); + } + + 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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call listSecurityGroupsValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nullable String labelSelector, + 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 listSecurityGroups(Async)"); + } + + return listSecurityGroupsCall(projectId, labelSelector, _callback); + } + + /** + * List all security groups inside a project. Get a list of all security groups inside a + * project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return SecurityGroupListResponse + * @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 List all security groups of a project. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public SecurityGroupListResponse listSecurityGroups( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + ApiResponse localVarResp = + listSecurityGroupsWithHttpInfo(projectId, labelSelector); + return localVarResp.getData(); + } + + /** + * List all security groups inside a project. Get a list of all security groups inside a + * project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return ApiResponse<SecurityGroupListResponse> + * @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 List all security groups of a project. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse listSecurityGroupsWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + okhttp3.Call localVarCall = + listSecurityGroupsValidateBeforeCall(projectId, labelSelector, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List all security groups inside a project. (asynchronously) Get a list of all security groups + * inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param labelSelector Filter resources by labels. (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 List all security groups of a project. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call listSecurityGroupsAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nullable String labelSelector, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listSecurityGroupsValidateBeforeCall(projectId, labelSelector, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listServerNics + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (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 List network interfaces. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call listServerNicsCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/servers/{serverId}/nics" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call listServerNicsValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'projectId' is set + if (projectId == null) { + throw new ApiException( + "Missing the required parameter 'projectId' when calling listServerNics(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling listServerNics(Async)"); + } + + return listServerNicsCall(projectId, serverId, _callback); + } + + /** + * Get all network interfaces. Get all network interfaces attached to the server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @return NICListResponse + * @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 List network interfaces. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public NICListResponse listServerNics( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull UUID serverId) + throws ApiException { + ApiResponse localVarResp = listServerNicsWithHttpInfo(projectId, serverId); + return localVarResp.getData(); + } + + /** + * Get all network interfaces. Get all network interfaces attached to the server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @return ApiResponse<NICListResponse> + * @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 List network interfaces. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse listServerNicsWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull UUID serverId) + throws ApiException { + okhttp3.Call localVarCall = listServerNicsValidateBeforeCall(projectId, serverId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get all network interfaces. (asynchronously) Get all network interfaces attached to the + * server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (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 List network interfaces. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call listServerNicsAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listServerNicsValidateBeforeCall(projectId, serverId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listServerServiceAccounts + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (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 List service accounts. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call listServerServiceAccountsCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/servers/{serverId}/service-accounts" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call listServerServiceAccountsValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'projectId' is set + if (projectId == null) { + throw new ApiException( + "Missing the required parameter 'projectId' when calling listServerServiceAccounts(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling listServerServiceAccounts(Async)"); + } + + return listServerServiceAccountsCall(projectId, serverId, _callback); + } + + /** + * List all service accounts of the Server. Get the list of the service accounts of the server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @return ServiceAccountMailListResponse + * @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 List service accounts. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ServiceAccountMailListResponse listServerServiceAccounts( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull UUID serverId) + throws ApiException { + ApiResponse localVarResp = + listServerServiceAccountsWithHttpInfo(projectId, serverId); + return localVarResp.getData(); + } + + /** + * List all service accounts of the Server. Get the list of the service accounts of the server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @return ApiResponse<ServiceAccountMailListResponse> + * @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 List service accounts. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse listServerServiceAccountsWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull UUID serverId) + throws ApiException { + okhttp3.Call localVarCall = + listServerServiceAccountsValidateBeforeCall(projectId, serverId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List all service accounts of the Server. (asynchronously) Get the list of the service + * accounts of the server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (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 List service accounts. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call listServerServiceAccountsAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listServerServiceAccountsValidateBeforeCall(projectId, serverId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listServers + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param details Show detailed information about server. (optional, default to false) + * @param labelSelector Filter resources by labels. (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 List all servers of a project. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call listServersCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nullable Boolean details, + @javax.annotation.Nullable String labelSelector, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/servers" + .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 (details != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("details", details)); + } + + if (labelSelector != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("label_selector", labelSelector)); + } + + 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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call listServersValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nullable Boolean details, + @javax.annotation.Nullable String labelSelector, + 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 listServers(Async)"); + } + + return listServersCall(projectId, details, labelSelector, _callback); + } + + /** + * List all servers inside a project. Get a list of all servers inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param details Show detailed information about server. (optional, default to false) + * @param labelSelector Filter resources by labels. (optional) + * @return ServerListResponse + * @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 List all servers of a project. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ServerListResponse listServers( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nullable Boolean details, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + ApiResponse localVarResp = + listServersWithHttpInfo(projectId, details, labelSelector); + return localVarResp.getData(); + } + + /** + * List all servers inside a project. Get a list of all servers inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param details Show detailed information about server. (optional, default to false) + * @param labelSelector Filter resources by labels. (optional) + * @return ApiResponse<ServerListResponse> + * @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 List all servers of a project. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse listServersWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nullable Boolean details, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + okhttp3.Call localVarCall = + listServersValidateBeforeCall(projectId, details, labelSelector, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List all servers inside a project. (asynchronously) Get a list of all servers inside a + * project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param details Show detailed information about server. (optional, default to false) + * @param labelSelector Filter resources by labels. (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 List all servers of a project. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call listServersAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nullable Boolean details, + @javax.annotation.Nullable String labelSelector, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listServersValidateBeforeCall(projectId, details, labelSelector, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listSnapshots + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param labelSelector Filter resources by labels. (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 List project snapshots. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call listSnapshotsCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nullable String labelSelector, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/snapshots" + .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 (labelSelector != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("label_selector", labelSelector)); + } + + 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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call listSnapshotsValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nullable String labelSelector, + 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 listSnapshots(Async)"); + } + + return listSnapshotsCall(projectId, labelSelector, _callback); + } + + /** + * List all snapshots inside a project. Get a list of all snapshots inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return SnapshotListResponse + * @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 List project snapshots. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public SnapshotListResponse listSnapshots( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + ApiResponse localVarResp = + listSnapshotsWithHttpInfo(projectId, labelSelector); + return localVarResp.getData(); + } + + /** + * List all snapshots inside a project. Get a list of all snapshots inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return ApiResponse<SnapshotListResponse> + * @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 List project snapshots. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse listSnapshotsWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + okhttp3.Call localVarCall = listSnapshotsValidateBeforeCall(projectId, labelSelector, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List all snapshots inside a project. (asynchronously) Get a list of all snapshots inside a + * project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param labelSelector Filter resources by labels. (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 List project snapshots. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call listSnapshotsAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nullable String labelSelector, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listSnapshotsValidateBeforeCall(projectId, labelSelector, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listVolumePerformanceClasses + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param labelSelector Filter resources by labels. (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 List volume performance classes. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call listVolumePerformanceClassesCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nullable String labelSelector, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/volume-performance-classes" + .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 (labelSelector != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("label_selector", labelSelector)); + } + + 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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call listVolumePerformanceClassesValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nullable String labelSelector, + 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 listVolumePerformanceClasses(Async)"); + } + + return listVolumePerformanceClassesCall(projectId, labelSelector, _callback); + } + + /** + * List all volume performance classes available for a project. Get a list of all volume + * performance classes available inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return VolumePerformanceClassListResponse + * @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 List volume performance classes. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public VolumePerformanceClassListResponse listVolumePerformanceClasses( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + ApiResponse localVarResp = + listVolumePerformanceClassesWithHttpInfo(projectId, labelSelector); + return localVarResp.getData(); + } + + /** + * List all volume performance classes available for a project. Get a list of all volume + * performance classes available inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return ApiResponse<VolumePerformanceClassListResponse> + * @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 List volume performance classes. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse listVolumePerformanceClassesWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + okhttp3.Call localVarCall = + listVolumePerformanceClassesValidateBeforeCall(projectId, labelSelector, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List all volume performance classes available for a project. (asynchronously) Get a list of + * all volume performance classes available inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param labelSelector Filter resources by labels. (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 List volume performance classes. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call listVolumePerformanceClassesAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nullable String labelSelector, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listVolumePerformanceClassesValidateBeforeCall(projectId, labelSelector, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listVolumes + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param labelSelector Filter resources by labels. (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 List project volumes. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call listVolumesCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nullable String labelSelector, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/volumes" + .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 (labelSelector != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("label_selector", labelSelector)); + } + + 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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call listVolumesValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nullable String labelSelector, + 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 listVolumes(Async)"); + } + + return listVolumesCall(projectId, labelSelector, _callback); + } + + /** + * List all volumes inside a project. Get a list of all volumes inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return VolumeListResponse + * @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 List project volumes. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public VolumeListResponse listVolumes( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + ApiResponse localVarResp = + listVolumesWithHttpInfo(projectId, labelSelector); + return localVarResp.getData(); + } + + /** + * List all volumes inside a project. Get a list of all volumes inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return ApiResponse<VolumeListResponse> + * @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 List project volumes. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse listVolumesWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + okhttp3.Call localVarCall = listVolumesValidateBeforeCall(projectId, labelSelector, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List all volumes inside a project. (asynchronously) Get a list of all volumes inside a + * project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param labelSelector Filter resources by labels. (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 List project volumes. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call listVolumesAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nullable String labelSelector, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listVolumesValidateBeforeCall(projectId, labelSelector, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for partialUpdateNetwork + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param partialUpdateNetworkPayload Request an update of a network. (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
202 An update was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call partialUpdateNetworkCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull PartialUpdateNetworkPayload partialUpdateNetworkPayload, + 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 = partialUpdateNetworkPayload; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/networks/{networkId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "networkId" + "}", + localVarApiClient.escapeString(networkId.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, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call partialUpdateNetworkValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull PartialUpdateNetworkPayload partialUpdateNetworkPayload, + 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 partialUpdateNetwork(Async)"); + } + + // verify the required parameter 'networkId' is set + if (networkId == null) { + throw new ApiException( + "Missing the required parameter 'networkId' when calling partialUpdateNetwork(Async)"); + } + + // verify the required parameter 'partialUpdateNetworkPayload' is set + if (partialUpdateNetworkPayload == null) { + throw new ApiException( + "Missing the required parameter 'partialUpdateNetworkPayload' when calling partialUpdateNetwork(Async)"); + } + + return partialUpdateNetworkCall( + projectId, networkId, partialUpdateNetworkPayload, _callback); + } + + /** + * Update network settings. Update the settings of a network inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param partialUpdateNetworkPayload Request an update of a network. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 An update was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public void partialUpdateNetwork( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull PartialUpdateNetworkPayload partialUpdateNetworkPayload) + throws ApiException { + partialUpdateNetworkWithHttpInfo(projectId, networkId, partialUpdateNetworkPayload); + } + + /** + * Update network settings. Update the settings of a network inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param partialUpdateNetworkPayload Request an update of a network. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 An update was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse partialUpdateNetworkWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull PartialUpdateNetworkPayload partialUpdateNetworkPayload) + throws ApiException { + okhttp3.Call localVarCall = + partialUpdateNetworkValidateBeforeCall( + projectId, networkId, partialUpdateNetworkPayload, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Update network settings. (asynchronously) Update the settings of a network inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param partialUpdateNetworkPayload Request an update of a network. (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
202 An update was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call partialUpdateNetworkAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull PartialUpdateNetworkPayload partialUpdateNetworkPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + partialUpdateNetworkValidateBeforeCall( + projectId, networkId, partialUpdateNetworkPayload, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for partialUpdateNetworkArea + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param partialUpdateNetworkAreaPayload Request to update an area. (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 Area has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call partialUpdateNetworkAreaCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull + PartialUpdateNetworkAreaPayload partialUpdateNetworkAreaPayload, + 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 = partialUpdateNetworkAreaPayload; + + // create path and map variables + String localVarPath = + "/v1/organizations/{organizationId}/network-areas/{areaId}" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "areaId" + "}", + localVarApiClient.escapeString(areaId.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, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call partialUpdateNetworkAreaValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull + PartialUpdateNetworkAreaPayload partialUpdateNetworkAreaPayload, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling partialUpdateNetworkArea(Async)"); + } + + // verify the required parameter 'areaId' is set + if (areaId == null) { + throw new ApiException( + "Missing the required parameter 'areaId' when calling partialUpdateNetworkArea(Async)"); + } + + // verify the required parameter 'partialUpdateNetworkAreaPayload' is set + if (partialUpdateNetworkAreaPayload == null) { + throw new ApiException( + "Missing the required parameter 'partialUpdateNetworkAreaPayload' when calling partialUpdateNetworkArea(Async)"); + } + + return partialUpdateNetworkAreaCall( + organizationId, areaId, partialUpdateNetworkAreaPayload, _callback); + } + + /** + * Update network area settings. Update the settings of a network area in an organization. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param partialUpdateNetworkAreaPayload Request to update an area. (required) + * @return NetworkArea + * @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 Area has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public NetworkArea partialUpdateNetworkArea( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull + PartialUpdateNetworkAreaPayload partialUpdateNetworkAreaPayload) + throws ApiException { + ApiResponse localVarResp = + partialUpdateNetworkAreaWithHttpInfo( + organizationId, areaId, partialUpdateNetworkAreaPayload); + return localVarResp.getData(); + } + + /** + * Update network area settings. Update the settings of a network area in an organization. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param partialUpdateNetworkAreaPayload Request to update an area. (required) + * @return ApiResponse<NetworkArea> + * @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 Area has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse partialUpdateNetworkAreaWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull + PartialUpdateNetworkAreaPayload partialUpdateNetworkAreaPayload) + throws ApiException { + okhttp3.Call localVarCall = + partialUpdateNetworkAreaValidateBeforeCall( + organizationId, areaId, partialUpdateNetworkAreaPayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update network area settings. (asynchronously) Update the settings of a network area in an + * organization. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param partialUpdateNetworkAreaPayload Request to update an area. (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 Area has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call partialUpdateNetworkAreaAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull + PartialUpdateNetworkAreaPayload partialUpdateNetworkAreaPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + partialUpdateNetworkAreaValidateBeforeCall( + organizationId, areaId, partialUpdateNetworkAreaPayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for rebootServer + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param action Defines if it is a soft or a hard reboot. (optional, default to soft) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Server reboot request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call rebootServerCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nullable String action, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/servers/{serverId}/reboot" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (action != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("action", action)); + } + + 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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call rebootServerValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nullable String action, + 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 rebootServer(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling rebootServer(Async)"); + } + + return rebootServerCall(projectId, serverId, action, _callback); + } + + /** + * Reboot the server. Reboot the server. A soft reboot will attempt to gracefully shut down the + * server by passing the command to the operating system. A hard reboot will power cycle the + * server without waiting for the operating system to shutdown properly. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param action Defines if it is a soft or a hard reboot. (optional, default to soft) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Server reboot request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public void rebootServer( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nullable String action) + throws ApiException { + rebootServerWithHttpInfo(projectId, serverId, action); + } + + /** + * Reboot the server. Reboot the server. A soft reboot will attempt to gracefully shut down the + * server by passing the command to the operating system. A hard reboot will power cycle the + * server without waiting for the operating system to shutdown properly. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param action Defines if it is a soft or a hard reboot. (optional, default to soft) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Server reboot request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse rebootServerWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nullable String action) + throws ApiException { + okhttp3.Call localVarCall = + rebootServerValidateBeforeCall(projectId, serverId, action, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Reboot the server. (asynchronously) Reboot the server. A soft reboot will attempt to + * gracefully shut down the server by passing the command to the operating system. A hard reboot + * will power cycle the server without waiting for the operating system to shutdown properly. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param action Defines if it is a soft or a hard reboot. (optional, default to soft) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Server reboot request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call rebootServerAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nullable String action, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + rebootServerValidateBeforeCall(projectId, serverId, action, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for removeNetworkFromServer + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Detach and delete network interface was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call removeNetworkFromServerCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID networkId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/servers/{serverId}/networks/{networkId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())) + .replace( + "{" + "networkId" + "}", + localVarApiClient.escapeString(networkId.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call removeNetworkFromServerValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID networkId, + 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 removeNetworkFromServer(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling removeNetworkFromServer(Async)"); + } + + // verify the required parameter 'networkId' is set + if (networkId == null) { + throw new ApiException( + "Missing the required parameter 'networkId' when calling removeNetworkFromServer(Async)"); + } + + return removeNetworkFromServerCall(projectId, serverId, networkId, _callback); + } + + /** + * Detach and delete all network interfaces associated with the specified network. Detach and + * delete all network interfaces associated with the specified network from the server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Detach and delete network interface was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public void removeNetworkFromServer( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID networkId) + throws ApiException { + removeNetworkFromServerWithHttpInfo(projectId, serverId, networkId); + } + + /** + * Detach and delete all network interfaces associated with the specified network. Detach and + * delete all network interfaces associated with the specified network from the server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Detach and delete network interface was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse removeNetworkFromServerWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID networkId) + throws ApiException { + okhttp3.Call localVarCall = + removeNetworkFromServerValidateBeforeCall(projectId, serverId, networkId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Detach and delete all network interfaces associated with the specified network. + * (asynchronously) Detach and delete all network interfaces associated with the specified + * network from the server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Detach and delete network interface was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call removeNetworkFromServerAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID networkId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + removeNetworkFromServerValidateBeforeCall( + projectId, serverId, networkId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for removeNicFromServer + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param nicId The identifier (ID) of a network interface. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Network interface detachment request was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call removeNicFromServerCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID nicId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/servers/{serverId}/nics/{nicId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())) + .replace( + "{" + "nicId" + "}", + localVarApiClient.escapeString(nicId.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call removeNicFromServerValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID nicId, + 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 removeNicFromServer(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling removeNicFromServer(Async)"); + } + + // verify the required parameter 'nicId' is set + if (nicId == null) { + throw new ApiException( + "Missing the required parameter 'nicId' when calling removeNicFromServer(Async)"); + } + + return removeNicFromServerCall(projectId, serverId, nicId, _callback); + } + + /** + * Detach a network interface. Detach a network interface from a server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param nicId The identifier (ID) of a network interface. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Network interface detachment request was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public void removeNicFromServer( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID nicId) + throws ApiException { + removeNicFromServerWithHttpInfo(projectId, serverId, nicId); + } + + /** + * Detach a network interface. Detach a network interface from a server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param nicId The identifier (ID) of a network interface. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Network interface detachment request was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse removeNicFromServerWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID nicId) + throws ApiException { + okhttp3.Call localVarCall = + removeNicFromServerValidateBeforeCall(projectId, serverId, nicId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Detach a network interface. (asynchronously) Detach a network interface from a server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param nicId The identifier (ID) of a network interface. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Network interface detachment request was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call removeNicFromServerAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID nicId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + removeNicFromServerValidateBeforeCall(projectId, serverId, nicId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for removePublicIpFromServer + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param publicIpId The identifier (ID) of a Public IP. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Detach Public IP from server was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The server or public IP was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call removePublicIpFromServerCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID publicIpId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/servers/{serverId}/public-ips/{publicIpId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())) + .replace( + "{" + "publicIpId" + "}", + localVarApiClient.escapeString(publicIpId.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call removePublicIpFromServerValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID publicIpId, + 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 removePublicIpFromServer(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling removePublicIpFromServer(Async)"); + } + + // verify the required parameter 'publicIpId' is set + if (publicIpId == null) { + throw new ApiException( + "Missing the required parameter 'publicIpId' when calling removePublicIpFromServer(Async)"); + } + + return removePublicIpFromServerCall(projectId, serverId, publicIpId, _callback); + } + + /** + * Dissociate a public IP from a server. Dissociate a public IP on an existing server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param publicIpId The identifier (ID) of a Public IP. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Detach Public IP from server was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The server or public IP was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public void removePublicIpFromServer( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID publicIpId) + throws ApiException { + removePublicIpFromServerWithHttpInfo(projectId, serverId, publicIpId); + } + + /** + * Dissociate a public IP from a server. Dissociate a public IP on an existing server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param publicIpId The identifier (ID) of a Public IP. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Detach Public IP from server was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The server or public IP was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse removePublicIpFromServerWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID publicIpId) + throws ApiException { + okhttp3.Call localVarCall = + removePublicIpFromServerValidateBeforeCall(projectId, serverId, publicIpId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Dissociate a public IP from a server. (asynchronously) Dissociate a public IP on an existing + * server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param publicIpId The identifier (ID) of a Public IP. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Detach Public IP from server was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The server or public IP was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call removePublicIpFromServerAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID publicIpId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + removePublicIpFromServerValidateBeforeCall( + projectId, serverId, publicIpId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for removeSecurityGroupFromServer + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security 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
204 Security group detachment request was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call removeSecurityGroupFromServerCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID securityGroupId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/servers/{serverId}/security-groups/{securityGroupId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())) + .replace( + "{" + "securityGroupId" + "}", + localVarApiClient.escapeString(securityGroupId.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call removeSecurityGroupFromServerValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID securityGroupId, + 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 removeSecurityGroupFromServer(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling removeSecurityGroupFromServer(Async)"); + } + + // verify the required parameter 'securityGroupId' is set + if (securityGroupId == null) { + throw new ApiException( + "Missing the required parameter 'securityGroupId' when calling removeSecurityGroupFromServer(Async)"); + } + + return removeSecurityGroupFromServerCall(projectId, serverId, securityGroupId, _callback); + } + + /** + * Remove a server from a security group. Remove a server from a attached security group. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security Group. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Security group detachment request was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public void removeSecurityGroupFromServer( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID securityGroupId) + throws ApiException { + removeSecurityGroupFromServerWithHttpInfo(projectId, serverId, securityGroupId); + } + + /** + * Remove a server from a security group. Remove a server from a attached security group. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security Group. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Security group detachment request was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse removeSecurityGroupFromServerWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID securityGroupId) + throws ApiException { + okhttp3.Call localVarCall = + removeSecurityGroupFromServerValidateBeforeCall( + projectId, serverId, securityGroupId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Remove a server from a security group. (asynchronously) Remove a server from a attached + * security group. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security 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
204 Security group detachment request was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call removeSecurityGroupFromServerAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID securityGroupId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + removeSecurityGroupFromServerValidateBeforeCall( + projectId, serverId, securityGroupId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for removeServiceAccountFromServer + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param serviceAccountMail The e-mail address of a service account. (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 Service account detached from the server. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call removeServiceAccountFromServerCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull String serviceAccountMail, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/servers/{serverId}/service-accounts/{serviceAccountMail}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())) + .replace( + "{" + "serviceAccountMail" + "}", + localVarApiClient.escapeString(serviceAccountMail.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call removeServiceAccountFromServerValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull String serviceAccountMail, + 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 removeServiceAccountFromServer(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling removeServiceAccountFromServer(Async)"); + } + + // verify the required parameter 'serviceAccountMail' is set + if (serviceAccountMail == null) { + throw new ApiException( + "Missing the required parameter 'serviceAccountMail' when calling removeServiceAccountFromServer(Async)"); + } + + return removeServiceAccountFromServerCall( + projectId, serverId, serviceAccountMail, _callback); + } + + /** + * Detach a service account from a server. Detach an additional service account from the server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param serviceAccountMail The e-mail address of a service account. (required) + * @return ServiceAccountMailListResponse + * @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 Service account detached from the server. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ServiceAccountMailListResponse removeServiceAccountFromServer( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull String serviceAccountMail) + throws ApiException { + ApiResponse localVarResp = + removeServiceAccountFromServerWithHttpInfo(projectId, serverId, serviceAccountMail); + return localVarResp.getData(); + } + + /** + * Detach a service account from a server. Detach an additional service account from the server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param serviceAccountMail The e-mail address of a service account. (required) + * @return ApiResponse<ServiceAccountMailListResponse> + * @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 Service account detached from the server. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse removeServiceAccountFromServerWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull String serviceAccountMail) + throws ApiException { + okhttp3.Call localVarCall = + removeServiceAccountFromServerValidateBeforeCall( + projectId, serverId, serviceAccountMail, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Detach a service account from a server. (asynchronously) Detach an additional service account + * from the server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param serviceAccountMail The e-mail address of a service account. (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 Service account detached from the server. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call removeServiceAccountFromServerAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull String serviceAccountMail, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + removeServiceAccountFromServerValidateBeforeCall( + projectId, serverId, serviceAccountMail, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for removeVolumeFromServer + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Volume detachment request was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call removeVolumeFromServerCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID volumeId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/servers/{serverId}/volume-attachments/{volumeId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())) + .replace( + "{" + "volumeId" + "}", + localVarApiClient.escapeString(volumeId.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call removeVolumeFromServerValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID volumeId, + 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 removeVolumeFromServer(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling removeVolumeFromServer(Async)"); + } + + // verify the required parameter 'volumeId' is set + if (volumeId == null) { + throw new ApiException( + "Missing the required parameter 'volumeId' when calling removeVolumeFromServer(Async)"); + } + + return removeVolumeFromServerCall(projectId, serverId, volumeId, _callback); + } + + /** + * Detach a volume from a server. Detach an existing volume from an existing server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Volume detachment request was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public void removeVolumeFromServer( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID volumeId) + throws ApiException { + removeVolumeFromServerWithHttpInfo(projectId, serverId, volumeId); + } + + /** + * Detach a volume from a server. Detach an existing volume from an existing server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Volume detachment request was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse removeVolumeFromServerWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID volumeId) + throws ApiException { + okhttp3.Call localVarCall = + removeVolumeFromServerValidateBeforeCall(projectId, serverId, volumeId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Detach a volume from a server. (asynchronously) Detach an existing volume from an existing + * server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Volume detachment request was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call removeVolumeFromServerAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID volumeId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + removeVolumeFromServerValidateBeforeCall(projectId, serverId, volumeId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for rescueServer + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param rescueServerPayload Request a server rescue. (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
202 Server rescue request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call rescueServerCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull RescueServerPayload rescueServerPayload, + 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 = rescueServerPayload; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/servers/{serverId}/rescue" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/json"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call rescueServerValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull RescueServerPayload rescueServerPayload, + 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 rescueServer(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling rescueServer(Async)"); + } + + // verify the required parameter 'rescueServerPayload' is set + if (rescueServerPayload == null) { + throw new ApiException( + "Missing the required parameter 'rescueServerPayload' when calling rescueServer(Async)"); + } + + return rescueServerCall(projectId, serverId, rescueServerPayload, _callback); + } + + /** + * Rescue an existing server. Rescue an existing server. It is shutdown and the initial image is + * attached as the boot volume, while the boot volume is attached as secondary volume and the + * server is booted. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param rescueServerPayload Request a server rescue. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Server rescue request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public void rescueServer( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull RescueServerPayload rescueServerPayload) + throws ApiException { + rescueServerWithHttpInfo(projectId, serverId, rescueServerPayload); + } + + /** + * Rescue an existing server. Rescue an existing server. It is shutdown and the initial image is + * attached as the boot volume, while the boot volume is attached as secondary volume and the + * server is booted. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param rescueServerPayload Request a server rescue. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Server rescue request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse rescueServerWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull RescueServerPayload rescueServerPayload) + throws ApiException { + okhttp3.Call localVarCall = + rescueServerValidateBeforeCall(projectId, serverId, rescueServerPayload, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Rescue an existing server. (asynchronously) Rescue an existing server. It is shutdown and the + * initial image is attached as the boot volume, while the boot volume is attached as secondary + * volume and the server is booted. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param rescueServerPayload Request a server rescue. (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
202 Server rescue request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call rescueServerAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull RescueServerPayload rescueServerPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + rescueServerValidateBeforeCall(projectId, serverId, rescueServerPayload, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for resizeServer + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param resizeServerPayload Request a resize of a server. (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
202 Server resize request is accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call resizeServerCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull ResizeServerPayload resizeServerPayload, + 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 = resizeServerPayload; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/servers/{serverId}/resize" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/json"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call resizeServerValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull ResizeServerPayload resizeServerPayload, + 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 resizeServer(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling resizeServer(Async)"); + } + + // verify the required parameter 'resizeServerPayload' is set + if (resizeServerPayload == null) { + throw new ApiException( + "Missing the required parameter 'resizeServerPayload' when calling resizeServer(Async)"); + } + + return resizeServerCall(projectId, serverId, resizeServerPayload, _callback); + } + + /** + * Resize a server. Resize the server to the given machine type. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param resizeServerPayload Request a resize of a server. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Server resize request is accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public void resizeServer( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull ResizeServerPayload resizeServerPayload) + throws ApiException { + resizeServerWithHttpInfo(projectId, serverId, resizeServerPayload); + } + + /** + * Resize a server. Resize the server to the given machine type. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param resizeServerPayload Request a resize of a server. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Server resize request is accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse resizeServerWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull ResizeServerPayload resizeServerPayload) + throws ApiException { + okhttp3.Call localVarCall = + resizeServerValidateBeforeCall(projectId, serverId, resizeServerPayload, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Resize a server. (asynchronously) Resize the server to the given machine type. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param resizeServerPayload Request a resize of a server. (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
202 Server resize request is accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call resizeServerAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull ResizeServerPayload resizeServerPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + resizeServerValidateBeforeCall(projectId, serverId, resizeServerPayload, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for resizeVolume + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @param resizeVolumePayload Request a volume resize. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Volume resize request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call resizeVolumeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID volumeId, + @javax.annotation.Nullable ResizeVolumePayload resizeVolumePayload, + 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 = resizeVolumePayload; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/volumes/{volumeId}/resize" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "volumeId" + "}", + localVarApiClient.escapeString(volumeId.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call resizeVolumeValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID volumeId, + @javax.annotation.Nullable ResizeVolumePayload resizeVolumePayload, + 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 resizeVolume(Async)"); + } + + // verify the required parameter 'volumeId' is set + if (volumeId == null) { + throw new ApiException( + "Missing the required parameter 'volumeId' when calling resizeVolume(Async)"); + } + + return resizeVolumeCall(projectId, volumeId, resizeVolumePayload, _callback); + } + + /** + * Update the size of a volume. Update the size of a block device volume. The new volume size + * must be larger than the current size. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @param resizeVolumePayload Request a volume resize. (optional) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Volume resize request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public void resizeVolume( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID volumeId, + @javax.annotation.Nullable ResizeVolumePayload resizeVolumePayload) + throws ApiException { + resizeVolumeWithHttpInfo(projectId, volumeId, resizeVolumePayload); + } + + /** + * Update the size of a volume. Update the size of a block device volume. The new volume size + * must be larger than the current size. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @param resizeVolumePayload Request a volume resize. (optional) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Volume resize request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse resizeVolumeWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID volumeId, + @javax.annotation.Nullable ResizeVolumePayload resizeVolumePayload) + throws ApiException { + okhttp3.Call localVarCall = + resizeVolumeValidateBeforeCall(projectId, volumeId, resizeVolumePayload, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Update the size of a volume. (asynchronously) Update the size of a block device volume. The + * new volume size must be larger than the current size. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @param resizeVolumePayload Request a volume resize. (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Volume resize request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call resizeVolumeAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID volumeId, + @javax.annotation.Nullable ResizeVolumePayload resizeVolumePayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + resizeVolumeValidateBeforeCall(projectId, volumeId, resizeVolumePayload, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for restoreBackup + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param backupId The identifier (ID) of a STACKIT Backup. (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
202 Backup restore request has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call restoreBackupCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID backupId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/backups/{backupId}/restore" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "backupId" + "}", + localVarApiClient.escapeString(backupId.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call restoreBackupValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID backupId, + 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 restoreBackup(Async)"); + } + + // verify the required parameter 'backupId' is set + if (backupId == null) { + throw new ApiException( + "Missing the required parameter 'backupId' when calling restoreBackup(Async)"); + } + + return restoreBackupCall(projectId, backupId, _callback); + } + + /** + * Restore Backup to the referenced source Volume. Restores a Backup to the existing Volume it + * references to. The use of this endpoint is disruptive as the volume needs to be detached. If + * a new volume is to be created use the volumes endpoint with the option to create from backup. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param backupId The identifier (ID) of a STACKIT Backup. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Backup restore request has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public void restoreBackup( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull UUID backupId) + throws ApiException { + restoreBackupWithHttpInfo(projectId, backupId); + } + + /** + * Restore Backup to the referenced source Volume. Restores a Backup to the existing Volume it + * references to. The use of this endpoint is disruptive as the volume needs to be detached. If + * a new volume is to be created use the volumes endpoint with the option to create from backup. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param backupId The identifier (ID) of a STACKIT Backup. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Backup restore request has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse restoreBackupWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull UUID backupId) + throws ApiException { + okhttp3.Call localVarCall = restoreBackupValidateBeforeCall(projectId, backupId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Restore Backup to the referenced source Volume. (asynchronously) Restores a Backup to the + * existing Volume it references to. The use of this endpoint is disruptive as the volume needs + * to be detached. If a new volume is to be created use the volumes endpoint with the option to + * create from backup. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param backupId The identifier (ID) of a STACKIT Backup. (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
202 Backup restore request has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call restoreBackupAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID backupId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = restoreBackupValidateBeforeCall(projectId, backupId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for setImageShare + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @param setImageSharePayload Settings for an Image Share. (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 Setting Image share successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call setImageShareCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID imageId, + @javax.annotation.Nonnull SetImageSharePayload setImageSharePayload, + 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 = setImageSharePayload; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/images/{imageId}/share" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "imageId" + "}", + localVarApiClient.escapeString(imageId.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call setImageShareValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID imageId, + @javax.annotation.Nonnull SetImageSharePayload setImageSharePayload, + 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 setImageShare(Async)"); + } + + // verify the required parameter 'imageId' is set + if (imageId == null) { + throw new ApiException( + "Missing the required parameter 'imageId' when calling setImageShare(Async)"); + } + + // verify the required parameter 'setImageSharePayload' is set + if (setImageSharePayload == null) { + throw new ApiException( + "Missing the required parameter 'setImageSharePayload' when calling setImageShare(Async)"); + } + + return setImageShareCall(projectId, imageId, setImageSharePayload, _callback); + } + + /** + * Set image share. Set share of an Image. New Options will replace existing settings. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @param setImageSharePayload Settings for an Image Share. (required) + * @return ImageShare + * @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 Setting Image share successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ImageShare setImageShare( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID imageId, + @javax.annotation.Nonnull SetImageSharePayload setImageSharePayload) + throws ApiException { + ApiResponse localVarResp = + setImageShareWithHttpInfo(projectId, imageId, setImageSharePayload); + return localVarResp.getData(); + } + + /** + * Set image share. Set share of an Image. New Options will replace existing settings. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @param setImageSharePayload Settings for an Image Share. (required) + * @return ApiResponse<ImageShare> + * @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 Setting Image share successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse setImageShareWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID imageId, + @javax.annotation.Nonnull SetImageSharePayload setImageSharePayload) + throws ApiException { + okhttp3.Call localVarCall = + setImageShareValidateBeforeCall(projectId, imageId, setImageSharePayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Set image share. (asynchronously) Set share of an Image. New Options will replace existing + * settings. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @param setImageSharePayload Settings for an Image Share. (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 Setting Image share successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call setImageShareAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID imageId, + @javax.annotation.Nonnull SetImageSharePayload setImageSharePayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + setImageShareValidateBeforeCall( + projectId, imageId, setImageSharePayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for startServer + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (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
202 Server start request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call startServerCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/servers/{serverId}/start" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call startServerValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'projectId' is set + if (projectId == null) { + throw new ApiException( + "Missing the required parameter 'projectId' when calling startServer(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling startServer(Async)"); + } + + return startServerCall(projectId, serverId, _callback); + } + + /** + * Boot up a server. Start an existing server or allocates the server if deallocated. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Server start request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public void startServer( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull UUID serverId) + throws ApiException { + startServerWithHttpInfo(projectId, serverId); + } + + /** + * Boot up a server. Start an existing server or allocates the server if deallocated. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Server start request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse startServerWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull UUID serverId) + throws ApiException { + okhttp3.Call localVarCall = startServerValidateBeforeCall(projectId, serverId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Boot up a server. (asynchronously) Start an existing server or allocates the server if + * deallocated. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (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
202 Server start request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call startServerAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = startServerValidateBeforeCall(projectId, serverId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for stopServer + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (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
202 Server stop request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call stopServerCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/servers/{serverId}/stop" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call stopServerValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'projectId' is set + if (projectId == null) { + throw new ApiException( + "Missing the required parameter 'projectId' when calling stopServer(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling stopServer(Async)"); + } + + return stopServerCall(projectId, serverId, _callback); + } + + /** + * Stop an existing server. Stops an existing server. The server will remain on the Hypervisor + * and will be charged full price for all resources attached to it. The attached resources will + * remain reserved. Useful particularly for vGPU servers. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Server stop request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public void stopServer( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull UUID serverId) + throws ApiException { + stopServerWithHttpInfo(projectId, serverId); + } + + /** + * Stop an existing server. Stops an existing server. The server will remain on the Hypervisor + * and will be charged full price for all resources attached to it. The attached resources will + * remain reserved. Useful particularly for vGPU servers. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Server stop request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse stopServerWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull UUID serverId) + throws ApiException { + okhttp3.Call localVarCall = stopServerValidateBeforeCall(projectId, serverId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Stop an existing server. (asynchronously) Stops an existing server. The server will remain on + * the Hypervisor and will be charged full price for all resources attached to it. The attached + * resources will remain reserved. Useful particularly for vGPU servers. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (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
202 Server stop request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call stopServerAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = stopServerValidateBeforeCall(projectId, serverId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for unrescueServer + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (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
202 Server unrescue request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call unrescueServerCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/servers/{serverId}/unrescue" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call unrescueServerValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'projectId' is set + if (projectId == null) { + throw new ApiException( + "Missing the required parameter 'projectId' when calling unrescueServer(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling unrescueServer(Async)"); + } + + return unrescueServerCall(projectId, serverId, _callback); + } + + /** + * Unrescue an existing server. Unrescue an existing server. The original boot volume is + * attached as boot volume of the server and the server is booted up. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Server unrescue request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public void unrescueServer( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull UUID serverId) + throws ApiException { + unrescueServerWithHttpInfo(projectId, serverId); + } + + /** + * Unrescue an existing server. Unrescue an existing server. The original boot volume is + * attached as boot volume of the server and the server is booted up. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Server unrescue request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse unrescueServerWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull UUID serverId) + throws ApiException { + okhttp3.Call localVarCall = unrescueServerValidateBeforeCall(projectId, serverId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Unrescue an existing server. (asynchronously) Unrescue an existing server. The original boot + * volume is attached as boot volume of the server and the server is booted up. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (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
202 Server unrescue request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call unrescueServerAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + unrescueServerValidateBeforeCall(projectId, serverId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for updateAttachedVolume + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @param updateAttachedVolumePayload Request a volume attachment update. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Response to update call. Provide the updated volume attachment object. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call updateAttachedVolumeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID volumeId, + @javax.annotation.Nonnull UpdateAttachedVolumePayload updateAttachedVolumePayload, + 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 = updateAttachedVolumePayload; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/servers/{serverId}/volume-attachments/{volumeId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())) + .replace( + "{" + "volumeId" + "}", + localVarApiClient.escapeString(volumeId.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, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call updateAttachedVolumeValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID volumeId, + @javax.annotation.Nonnull UpdateAttachedVolumePayload updateAttachedVolumePayload, + 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 updateAttachedVolume(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling updateAttachedVolume(Async)"); + } + + // verify the required parameter 'volumeId' is set + if (volumeId == null) { + throw new ApiException( + "Missing the required parameter 'volumeId' when calling updateAttachedVolume(Async)"); + } + + // verify the required parameter 'updateAttachedVolumePayload' is set + if (updateAttachedVolumePayload == null) { + throw new ApiException( + "Missing the required parameter 'updateAttachedVolumePayload' when calling updateAttachedVolume(Async)"); + } + + return updateAttachedVolumeCall( + projectId, serverId, volumeId, updateAttachedVolumePayload, _callback); + } + + /** + * Update Volume Attachment Parameters. Update the properties of an existing Volume Attachment. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @param updateAttachedVolumePayload Request a volume attachment update. (required) + * @return VolumeAttachment + * @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 Response to update call. Provide the updated volume attachment object. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public VolumeAttachment updateAttachedVolume( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID volumeId, + @javax.annotation.Nonnull UpdateAttachedVolumePayload updateAttachedVolumePayload) + throws ApiException { + ApiResponse localVarResp = + updateAttachedVolumeWithHttpInfo( + projectId, serverId, volumeId, updateAttachedVolumePayload); + return localVarResp.getData(); + } + + /** + * Update Volume Attachment Parameters. Update the properties of an existing Volume Attachment. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @param updateAttachedVolumePayload Request a volume attachment update. (required) + * @return ApiResponse<VolumeAttachment> + * @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 Response to update call. Provide the updated volume attachment object. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse updateAttachedVolumeWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID volumeId, + @javax.annotation.Nonnull UpdateAttachedVolumePayload updateAttachedVolumePayload) + throws ApiException { + okhttp3.Call localVarCall = + updateAttachedVolumeValidateBeforeCall( + projectId, serverId, volumeId, updateAttachedVolumePayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update Volume Attachment Parameters. (asynchronously) Update the properties of an existing + * Volume Attachment. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @param updateAttachedVolumePayload Request a volume attachment update. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Response to update call. Provide the updated volume attachment object. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call updateAttachedVolumeAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID volumeId, + @javax.annotation.Nonnull UpdateAttachedVolumePayload updateAttachedVolumePayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + updateAttachedVolumeValidateBeforeCall( + projectId, serverId, volumeId, updateAttachedVolumePayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for updateBackup + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param backupId The identifier (ID) of a STACKIT Backup. (required) + * @param updateBackupPayload Request an update of a backup. (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 Backup has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call updateBackupCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID backupId, + @javax.annotation.Nonnull UpdateBackupPayload updateBackupPayload, + 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 = updateBackupPayload; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/backups/{backupId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "backupId" + "}", + localVarApiClient.escapeString(backupId.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, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call updateBackupValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID backupId, + @javax.annotation.Nonnull UpdateBackupPayload updateBackupPayload, + 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 updateBackup(Async)"); + } + + // verify the required parameter 'backupId' is set + if (backupId == null) { + throw new ApiException( + "Missing the required parameter 'backupId' when calling updateBackup(Async)"); + } + + // verify the required parameter 'updateBackupPayload' is set + if (updateBackupPayload == null) { + throw new ApiException( + "Missing the required parameter 'updateBackupPayload' when calling updateBackup(Async)"); + } + + return updateBackupCall(projectId, backupId, updateBackupPayload, _callback); + } + + /** + * Update information of a backup. Update name or labels of the backup. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param backupId The identifier (ID) of a STACKIT Backup. (required) + * @param updateBackupPayload Request an update of a backup. (required) + * @return Backup + * @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 Backup has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public Backup updateBackup( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID backupId, + @javax.annotation.Nonnull UpdateBackupPayload updateBackupPayload) + throws ApiException { + ApiResponse localVarResp = + updateBackupWithHttpInfo(projectId, backupId, updateBackupPayload); + return localVarResp.getData(); + } + + /** + * Update information of a backup. Update name or labels of the backup. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param backupId The identifier (ID) of a STACKIT Backup. (required) + * @param updateBackupPayload Request an update of a backup. (required) + * @return ApiResponse<Backup> + * @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 Backup has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse updateBackupWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID backupId, + @javax.annotation.Nonnull UpdateBackupPayload updateBackupPayload) + throws ApiException { + okhttp3.Call localVarCall = + updateBackupValidateBeforeCall(projectId, backupId, updateBackupPayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update information of a backup. (asynchronously) Update name or labels of the backup. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param backupId The identifier (ID) of a STACKIT Backup. (required) + * @param updateBackupPayload Request an update of a backup. (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 Backup has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call updateBackupAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID backupId, + @javax.annotation.Nonnull UpdateBackupPayload updateBackupPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + updateBackupValidateBeforeCall(projectId, backupId, updateBackupPayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for updateImage + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @param updateImagePayload Request an update of an Image. (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 Response to update call. Provide the updated image object. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call updateImageCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID imageId, + @javax.annotation.Nonnull UpdateImagePayload updateImagePayload, + 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 = updateImagePayload; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/images/{imageId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "imageId" + "}", + localVarApiClient.escapeString(imageId.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, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call updateImageValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID imageId, + @javax.annotation.Nonnull UpdateImagePayload updateImagePayload, + 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 updateImage(Async)"); + } + + // verify the required parameter 'imageId' is set + if (imageId == null) { + throw new ApiException( + "Missing the required parameter 'imageId' when calling updateImage(Async)"); + } + + // verify the required parameter 'updateImagePayload' is set + if (updateImagePayload == null) { + throw new ApiException( + "Missing the required parameter 'updateImagePayload' when calling updateImage(Async)"); + } + + return updateImageCall(projectId, imageId, updateImagePayload, _callback); + } + + /** + * Update Image Parameters. Update the properties of an existing Image inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @param updateImagePayload Request an update of an Image. (required) + * @return Image + * @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 Response to update call. Provide the updated image object. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public Image updateImage( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID imageId, + @javax.annotation.Nonnull UpdateImagePayload updateImagePayload) + throws ApiException { + ApiResponse localVarResp = + updateImageWithHttpInfo(projectId, imageId, updateImagePayload); + return localVarResp.getData(); + } + + /** + * Update Image Parameters. Update the properties of an existing Image inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @param updateImagePayload Request an update of an Image. (required) + * @return ApiResponse<Image> + * @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 Response to update call. Provide the updated image object. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse updateImageWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID imageId, + @javax.annotation.Nonnull UpdateImagePayload updateImagePayload) + throws ApiException { + okhttp3.Call localVarCall = + updateImageValidateBeforeCall(projectId, imageId, updateImagePayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update Image Parameters. (asynchronously) Update the properties of an existing Image inside a + * project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @param updateImagePayload Request an update of an Image. (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 Response to update call. Provide the updated image object. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call updateImageAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID imageId, + @javax.annotation.Nonnull UpdateImagePayload updateImagePayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + updateImageValidateBeforeCall(projectId, imageId, updateImagePayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for updateImageScopeLocal + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (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 Response to update image-scope to local. Provide the updated image object. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call updateImageScopeLocalCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID imageId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/images/{imageId}/publish" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "imageId" + "}", + localVarApiClient.escapeString(imageId.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); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call updateImageScopeLocalValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID imageId, + 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 updateImageScopeLocal(Async)"); + } + + // verify the required parameter 'imageId' is set + if (imageId == null) { + throw new ApiException( + "Missing the required parameter 'imageId' when calling updateImageScopeLocal(Async)"); + } + + return updateImageScopeLocalCall(projectId, imageId, _callback); + } + + /** + * Update Image Scope to Local. Update the scope property of an existing Image inside a project + * to local. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @return Image + * @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 Response to update image-scope to local. Provide the updated image object. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public Image updateImageScopeLocal( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull UUID imageId) + throws ApiException { + ApiResponse localVarResp = updateImageScopeLocalWithHttpInfo(projectId, imageId); + return localVarResp.getData(); + } + + /** + * Update Image Scope to Local. Update the scope property of an existing Image inside a project + * to local. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @return ApiResponse<Image> + * @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 Response to update image-scope to local. Provide the updated image object. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse updateImageScopeLocalWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull UUID imageId) + throws ApiException { + okhttp3.Call localVarCall = + updateImageScopeLocalValidateBeforeCall(projectId, imageId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update Image Scope to Local. (asynchronously) Update the scope property of an existing Image + * inside a project to local. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (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 Response to update image-scope to local. Provide the updated image object. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call updateImageScopeLocalAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID imageId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + updateImageScopeLocalValidateBeforeCall(projectId, imageId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for updateImageScopePublic + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (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 Response to update image-scope to public. Provide the updated image object. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call updateImageScopePublicCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID imageId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/images/{imageId}/publish" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "imageId" + "}", + localVarApiClient.escapeString(imageId.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, + "PUT", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call updateImageScopePublicValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID imageId, + 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 updateImageScopePublic(Async)"); + } + + // verify the required parameter 'imageId' is set + if (imageId == null) { + throw new ApiException( + "Missing the required parameter 'imageId' when calling updateImageScopePublic(Async)"); + } + + return updateImageScopePublicCall(projectId, imageId, _callback); + } + + /** + * Update Image Scope to Public. Update the scope property of an existing Image inside a project + * to public. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @return Image + * @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 Response to update image-scope to public. Provide the updated image object. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public Image updateImageScopePublic( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull UUID imageId) + throws ApiException { + ApiResponse localVarResp = updateImageScopePublicWithHttpInfo(projectId, imageId); + return localVarResp.getData(); + } + + /** + * Update Image Scope to Public. Update the scope property of an existing Image inside a project + * to public. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @return ApiResponse<Image> + * @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 Response to update image-scope to public. Provide the updated image object. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse updateImageScopePublicWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull UUID imageId) + throws ApiException { + okhttp3.Call localVarCall = + updateImageScopePublicValidateBeforeCall(projectId, imageId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update Image Scope to Public. (asynchronously) Update the scope property of an existing Image + * inside a project to public. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (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 Response to update image-scope to public. Provide the updated image object. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call updateImageScopePublicAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID imageId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + updateImageScopePublicValidateBeforeCall(projectId, imageId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for updateImageShare + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @param updateImageSharePayload Update an Image Share. (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 Updating Image share successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call updateImageShareCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID imageId, + @javax.annotation.Nonnull UpdateImageSharePayload updateImageSharePayload, + 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 = updateImageSharePayload; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/images/{imageId}/share" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "imageId" + "}", + localVarApiClient.escapeString(imageId.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, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call updateImageShareValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID imageId, + @javax.annotation.Nonnull UpdateImageSharePayload updateImageSharePayload, + 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 updateImageShare(Async)"); + } + + // verify the required parameter 'imageId' is set + if (imageId == null) { + throw new ApiException( + "Missing the required parameter 'imageId' when calling updateImageShare(Async)"); + } + + // verify the required parameter 'updateImageSharePayload' is set + if (updateImageSharePayload == null) { + throw new ApiException( + "Missing the required parameter 'updateImageSharePayload' when calling updateImageShare(Async)"); + } + + return updateImageShareCall(projectId, imageId, updateImageSharePayload, _callback); + } + + /** + * Update image share. Update share of an Image. Projects will be appended to existing list. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @param updateImageSharePayload Update an Image Share. (required) + * @return ImageShare + * @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 Updating Image share successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ImageShare updateImageShare( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID imageId, + @javax.annotation.Nonnull UpdateImageSharePayload updateImageSharePayload) + throws ApiException { + ApiResponse localVarResp = + updateImageShareWithHttpInfo(projectId, imageId, updateImageSharePayload); + return localVarResp.getData(); + } + + /** + * Update image share. Update share of an Image. Projects will be appended to existing list. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @param updateImageSharePayload Update an Image Share. (required) + * @return ApiResponse<ImageShare> + * @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 Updating Image share successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse updateImageShareWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID imageId, + @javax.annotation.Nonnull UpdateImageSharePayload updateImageSharePayload) + throws ApiException { + okhttp3.Call localVarCall = + updateImageShareValidateBeforeCall( + projectId, imageId, updateImageSharePayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update image share. (asynchronously) Update share of an Image. Projects will be appended to + * existing list. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @param updateImageSharePayload Update an Image Share. (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 Updating Image share successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call updateImageShareAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID imageId, + @javax.annotation.Nonnull UpdateImageSharePayload updateImageSharePayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + updateImageShareValidateBeforeCall( + projectId, imageId, updateImageSharePayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for updateKeyPair + * + * @param keypairName The name of an SSH keypair. (required) + * @param updateKeyPairPayload Request an update of an SSH keypair. (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 SSH keypair has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call updateKeyPairCall( + @javax.annotation.Nonnull String keypairName, + @javax.annotation.Nonnull UpdateKeyPairPayload updateKeyPairPayload, + 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 = updateKeyPairPayload; + + // create path and map variables + String localVarPath = + "/v1/keypairs/{keypairName}" + .replace( + "{" + "keypairName" + "}", + localVarApiClient.escapeString(keypairName.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, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call updateKeyPairValidateBeforeCall( + @javax.annotation.Nonnull String keypairName, + @javax.annotation.Nonnull UpdateKeyPairPayload updateKeyPairPayload, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'keypairName' is set + if (keypairName == null) { + throw new ApiException( + "Missing the required parameter 'keypairName' when calling updateKeyPair(Async)"); + } + + // verify the required parameter 'updateKeyPairPayload' is set + if (updateKeyPairPayload == null) { + throw new ApiException( + "Missing the required parameter 'updateKeyPairPayload' when calling updateKeyPair(Async)"); + } + + return updateKeyPairCall(keypairName, updateKeyPairPayload, _callback); + } + + /** + * Update information of an SSH keypair. Update labels of the SSH keypair. + * + * @param keypairName The name of an SSH keypair. (required) + * @param updateKeyPairPayload Request an update of an SSH keypair. (required) + * @return Keypair + * @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 SSH keypair has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public Keypair updateKeyPair( + @javax.annotation.Nonnull String keypairName, + @javax.annotation.Nonnull UpdateKeyPairPayload updateKeyPairPayload) + throws ApiException { + ApiResponse localVarResp = + updateKeyPairWithHttpInfo(keypairName, updateKeyPairPayload); + return localVarResp.getData(); + } + + /** + * Update information of an SSH keypair. Update labels of the SSH keypair. + * + * @param keypairName The name of an SSH keypair. (required) + * @param updateKeyPairPayload Request an update of an SSH keypair. (required) + * @return ApiResponse<Keypair> + * @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 SSH keypair has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse updateKeyPairWithHttpInfo( + @javax.annotation.Nonnull String keypairName, + @javax.annotation.Nonnull UpdateKeyPairPayload updateKeyPairPayload) + throws ApiException { + okhttp3.Call localVarCall = + updateKeyPairValidateBeforeCall(keypairName, updateKeyPairPayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update information of an SSH keypair. (asynchronously) Update labels of the SSH keypair. + * + * @param keypairName The name of an SSH keypair. (required) + * @param updateKeyPairPayload Request an update of an SSH keypair. (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 SSH keypair has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call updateKeyPairAsync( + @javax.annotation.Nonnull String keypairName, + @javax.annotation.Nonnull UpdateKeyPairPayload updateKeyPairPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + updateKeyPairValidateBeforeCall(keypairName, updateKeyPairPayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for updateNetworkAreaRoute + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param routeId The identifier (ID) of a STACKIT Route. (required) + * @param updateNetworkAreaRoutePayload Request an update of a network route. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Update request for network successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call updateNetworkAreaRouteCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull UUID routeId, + @javax.annotation.Nonnull UpdateNetworkAreaRoutePayload updateNetworkAreaRoutePayload, + 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 = updateNetworkAreaRoutePayload; + + // create path and map variables + String localVarPath = + "/v1/organizations/{organizationId}/network-areas/{areaId}/routes/{routeId}" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "areaId" + "}", + localVarApiClient.escapeString(areaId.toString())) + .replace( + "{" + "routeId" + "}", + localVarApiClient.escapeString(routeId.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, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call updateNetworkAreaRouteValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull UUID routeId, + @javax.annotation.Nonnull UpdateNetworkAreaRoutePayload updateNetworkAreaRoutePayload, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling updateNetworkAreaRoute(Async)"); + } + + // verify the required parameter 'areaId' is set + if (areaId == null) { + throw new ApiException( + "Missing the required parameter 'areaId' when calling updateNetworkAreaRoute(Async)"); + } + + // verify the required parameter 'routeId' is set + if (routeId == null) { + throw new ApiException( + "Missing the required parameter 'routeId' when calling updateNetworkAreaRoute(Async)"); + } + + // verify the required parameter 'updateNetworkAreaRoutePayload' is set + if (updateNetworkAreaRoutePayload == null) { + throw new ApiException( + "Missing the required parameter 'updateNetworkAreaRoutePayload' when calling updateNetworkAreaRoute(Async)"); + } + + return updateNetworkAreaRouteCall( + organizationId, areaId, routeId, updateNetworkAreaRoutePayload, _callback); + } + + /** + * Update a network route. Update a network route defined in a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param routeId The identifier (ID) of a STACKIT Route. (required) + * @param updateNetworkAreaRoutePayload Request an update of a network route. (required) + * @return Route + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Update request for network successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public Route updateNetworkAreaRoute( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull UUID routeId, + @javax.annotation.Nonnull UpdateNetworkAreaRoutePayload updateNetworkAreaRoutePayload) + throws ApiException { + ApiResponse localVarResp = + updateNetworkAreaRouteWithHttpInfo( + organizationId, areaId, routeId, updateNetworkAreaRoutePayload); + return localVarResp.getData(); + } + + /** + * Update a network route. Update a network route defined in a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param routeId The identifier (ID) of a STACKIT Route. (required) + * @param updateNetworkAreaRoutePayload Request an update of a network route. (required) + * @return ApiResponse<Route> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Update request for network successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse updateNetworkAreaRouteWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull UUID routeId, + @javax.annotation.Nonnull UpdateNetworkAreaRoutePayload updateNetworkAreaRoutePayload) + throws ApiException { + okhttp3.Call localVarCall = + updateNetworkAreaRouteValidateBeforeCall( + organizationId, areaId, routeId, updateNetworkAreaRoutePayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update a network route. (asynchronously) Update a network route defined in a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param routeId The identifier (ID) of a STACKIT Route. (required) + * @param updateNetworkAreaRoutePayload Request an update of a network route. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Update request for network successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call updateNetworkAreaRouteAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull UUID routeId, + @javax.annotation.Nonnull UpdateNetworkAreaRoutePayload updateNetworkAreaRoutePayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + updateNetworkAreaRouteValidateBeforeCall( + organizationId, areaId, routeId, updateNetworkAreaRoutePayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for updateNic + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param nicId The identifier (ID) of a network interface. (required) + * @param updateNicPayload Request an update of a network interface. (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 Network interface has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call updateNicCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull UUID nicId, + @javax.annotation.Nonnull UpdateNicPayload updateNicPayload, + 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 = updateNicPayload; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/networks/{networkId}/nics/{nicId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "networkId" + "}", + localVarApiClient.escapeString(networkId.toString())) + .replace( + "{" + "nicId" + "}", + localVarApiClient.escapeString(nicId.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, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call updateNicValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull UUID nicId, + @javax.annotation.Nonnull UpdateNicPayload updateNicPayload, + 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 updateNic(Async)"); + } + + // verify the required parameter 'networkId' is set + if (networkId == null) { + throw new ApiException( + "Missing the required parameter 'networkId' when calling updateNic(Async)"); + } + + // verify the required parameter 'nicId' is set + if (nicId == null) { + throw new ApiException( + "Missing the required parameter 'nicId' when calling updateNic(Async)"); + } + + // verify the required parameter 'updateNicPayload' is set + if (updateNicPayload == null) { + throw new ApiException( + "Missing the required parameter 'updateNicPayload' when calling updateNic(Async)"); + } + + return updateNicCall(projectId, networkId, nicId, updateNicPayload, _callback); + } + + /** + * Update a network interface. Update the properties of an existing network interface inside a + * network. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param nicId The identifier (ID) of a network interface. (required) + * @param updateNicPayload Request an update of a network interface. (required) + * @return NIC + * @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 Network interface has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public NIC updateNic( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull UUID nicId, + @javax.annotation.Nonnull UpdateNicPayload updateNicPayload) + throws ApiException { + ApiResponse localVarResp = + updateNicWithHttpInfo(projectId, networkId, nicId, updateNicPayload); + return localVarResp.getData(); + } + + /** + * Update a network interface. Update the properties of an existing network interface inside a + * network. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param nicId The identifier (ID) of a network interface. (required) + * @param updateNicPayload Request an update of a network interface. (required) + * @return ApiResponse<NIC> + * @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 Network interface has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse updateNicWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull UUID nicId, + @javax.annotation.Nonnull UpdateNicPayload updateNicPayload) + throws ApiException { + okhttp3.Call localVarCall = + updateNicValidateBeforeCall(projectId, networkId, nicId, updateNicPayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update a network interface. (asynchronously) Update the properties of an existing network + * interface inside a network. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param nicId The identifier (ID) of a network interface. (required) + * @param updateNicPayload Request an update of a network interface. (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 Network interface has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call updateNicAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull UUID nicId, + @javax.annotation.Nonnull UpdateNicPayload updateNicPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + updateNicValidateBeforeCall( + projectId, networkId, nicId, updateNicPayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for updatePublicIP + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param publicIpId The identifier (ID) of a Public IP. (required) + * @param updatePublicIPPayload Request an update of a public IP. (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 Public IP has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call updatePublicIPCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID publicIpId, + @javax.annotation.Nonnull UpdatePublicIPPayload updatePublicIPPayload, + 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 = updatePublicIPPayload; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/public-ips/{publicIpId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "publicIpId" + "}", + localVarApiClient.escapeString(publicIpId.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, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call updatePublicIPValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID publicIpId, + @javax.annotation.Nonnull UpdatePublicIPPayload updatePublicIPPayload, + 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 updatePublicIP(Async)"); + } + + // verify the required parameter 'publicIpId' is set + if (publicIpId == null) { + throw new ApiException( + "Missing the required parameter 'publicIpId' when calling updatePublicIP(Async)"); + } + + // verify the required parameter 'updatePublicIPPayload' is set + if (updatePublicIPPayload == null) { + throw new ApiException( + "Missing the required parameter 'updatePublicIPPayload' when calling updatePublicIP(Async)"); + } + + return updatePublicIPCall(projectId, publicIpId, updatePublicIPPayload, _callback); + } + + /** + * Update a public IP. Update the properties of an existing public IP inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param publicIpId The identifier (ID) of a Public IP. (required) + * @param updatePublicIPPayload Request an update of a public IP. (required) + * @return PublicIp + * @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 Public IP has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public PublicIp updatePublicIP( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID publicIpId, + @javax.annotation.Nonnull UpdatePublicIPPayload updatePublicIPPayload) + throws ApiException { + ApiResponse localVarResp = + updatePublicIPWithHttpInfo(projectId, publicIpId, updatePublicIPPayload); + return localVarResp.getData(); + } + + /** + * Update a public IP. Update the properties of an existing public IP inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param publicIpId The identifier (ID) of a Public IP. (required) + * @param updatePublicIPPayload Request an update of a public IP. (required) + * @return ApiResponse<PublicIp> + * @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 Public IP has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse updatePublicIPWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID publicIpId, + @javax.annotation.Nonnull UpdatePublicIPPayload updatePublicIPPayload) + throws ApiException { + okhttp3.Call localVarCall = + updatePublicIPValidateBeforeCall( + projectId, publicIpId, updatePublicIPPayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update a public IP. (asynchronously) Update the properties of an existing public IP inside a + * project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param publicIpId The identifier (ID) of a Public IP. (required) + * @param updatePublicIPPayload Request an update of a public IP. (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 Public IP has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call updatePublicIPAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID publicIpId, + @javax.annotation.Nonnull UpdatePublicIPPayload updatePublicIPPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + updatePublicIPValidateBeforeCall( + projectId, publicIpId, updatePublicIPPayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for updateSecurityGroup + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security Group. (required) + * @param updateSecurityGroupPayload Request an update of a security 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 Updating security group successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call updateSecurityGroupCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID securityGroupId, + @javax.annotation.Nonnull UpdateSecurityGroupPayload updateSecurityGroupPayload, + 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 = updateSecurityGroupPayload; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/security-groups/{securityGroupId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "securityGroupId" + "}", + localVarApiClient.escapeString(securityGroupId.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, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call updateSecurityGroupValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID securityGroupId, + @javax.annotation.Nonnull UpdateSecurityGroupPayload updateSecurityGroupPayload, + 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 updateSecurityGroup(Async)"); + } + + // verify the required parameter 'securityGroupId' is set + if (securityGroupId == null) { + throw new ApiException( + "Missing the required parameter 'securityGroupId' when calling updateSecurityGroup(Async)"); + } + + // verify the required parameter 'updateSecurityGroupPayload' is set + if (updateSecurityGroupPayload == null) { + throw new ApiException( + "Missing the required parameter 'updateSecurityGroupPayload' when calling updateSecurityGroup(Async)"); + } + + return updateSecurityGroupCall( + projectId, securityGroupId, updateSecurityGroupPayload, _callback); + } + + /** + * Update information of a security group. Update labels of the security group. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security Group. (required) + * @param updateSecurityGroupPayload Request an update of a security group. (required) + * @return SecurityGroup + * @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 Updating security group successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public SecurityGroup updateSecurityGroup( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID securityGroupId, + @javax.annotation.Nonnull UpdateSecurityGroupPayload updateSecurityGroupPayload) + throws ApiException { + ApiResponse localVarResp = + updateSecurityGroupWithHttpInfo( + projectId, securityGroupId, updateSecurityGroupPayload); + return localVarResp.getData(); + } + + /** + * Update information of a security group. Update labels of the security group. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security Group. (required) + * @param updateSecurityGroupPayload Request an update of a security group. (required) + * @return ApiResponse<SecurityGroup> + * @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 Updating security group successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse updateSecurityGroupWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID securityGroupId, + @javax.annotation.Nonnull UpdateSecurityGroupPayload updateSecurityGroupPayload) + throws ApiException { + okhttp3.Call localVarCall = + updateSecurityGroupValidateBeforeCall( + projectId, securityGroupId, updateSecurityGroupPayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update information of a security group. (asynchronously) Update labels of the security group. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security Group. (required) + * @param updateSecurityGroupPayload Request an update of a security 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 Updating security group successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call updateSecurityGroupAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID securityGroupId, + @javax.annotation.Nonnull UpdateSecurityGroupPayload updateSecurityGroupPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + updateSecurityGroupValidateBeforeCall( + projectId, securityGroupId, updateSecurityGroupPayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for updateServer + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param updateServerPayload Request an update of a server. (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 Server has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call updateServerCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UpdateServerPayload updateServerPayload, + 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 = updateServerPayload; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/servers/{serverId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = {"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, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call updateServerValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UpdateServerPayload updateServerPayload, + 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 updateServer(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling updateServer(Async)"); + } + + // verify the required parameter 'updateServerPayload' is set + if (updateServerPayload == null) { + throw new ApiException( + "Missing the required parameter 'updateServerPayload' when calling updateServer(Async)"); + } + + return updateServerCall(projectId, serverId, updateServerPayload, _callback); + } + + /** + * Update information of a server. Update name or labels of the server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param updateServerPayload Request an update of a server. (required) + * @return Server + * @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 Server has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public Server updateServer( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UpdateServerPayload updateServerPayload) + throws ApiException { + ApiResponse localVarResp = + updateServerWithHttpInfo(projectId, serverId, updateServerPayload); + return localVarResp.getData(); + } + + /** + * Update information of a server. Update name or labels of the server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param updateServerPayload Request an update of a server. (required) + * @return ApiResponse<Server> + * @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 Server has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse updateServerWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UpdateServerPayload updateServerPayload) + throws ApiException { + okhttp3.Call localVarCall = + updateServerValidateBeforeCall(projectId, serverId, updateServerPayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update information of a server. (asynchronously) Update name or labels of the server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param updateServerPayload Request an update of a server. (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 Server has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call updateServerAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UpdateServerPayload updateServerPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + updateServerValidateBeforeCall(projectId, serverId, updateServerPayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for updateSnapshot + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param snapshotId The identifier (ID) of a STACKIT Snapshot. (required) + * @param updateSnapshotPayload Request an update of a snapshot. (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 Snapshot has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call updateSnapshotCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID snapshotId, + @javax.annotation.Nonnull UpdateSnapshotPayload updateSnapshotPayload, + 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 = updateSnapshotPayload; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/snapshots/{snapshotId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "snapshotId" + "}", + localVarApiClient.escapeString(snapshotId.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, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call updateSnapshotValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID snapshotId, + @javax.annotation.Nonnull UpdateSnapshotPayload updateSnapshotPayload, + 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 updateSnapshot(Async)"); + } + + // verify the required parameter 'snapshotId' is set + if (snapshotId == null) { + throw new ApiException( + "Missing the required parameter 'snapshotId' when calling updateSnapshot(Async)"); + } + + // verify the required parameter 'updateSnapshotPayload' is set + if (updateSnapshotPayload == null) { + throw new ApiException( + "Missing the required parameter 'updateSnapshotPayload' when calling updateSnapshot(Async)"); + } + + return updateSnapshotCall(projectId, snapshotId, updateSnapshotPayload, _callback); + } + + /** + * Update information of the snapshot. Update information like name or labels of the snapshot. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param snapshotId The identifier (ID) of a STACKIT Snapshot. (required) + * @param updateSnapshotPayload Request an update of a snapshot. (required) + * @return Snapshot + * @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 Snapshot has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public Snapshot updateSnapshot( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID snapshotId, + @javax.annotation.Nonnull UpdateSnapshotPayload updateSnapshotPayload) + throws ApiException { + ApiResponse localVarResp = + updateSnapshotWithHttpInfo(projectId, snapshotId, updateSnapshotPayload); + return localVarResp.getData(); + } + + /** + * Update information of the snapshot. Update information like name or labels of the snapshot. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param snapshotId The identifier (ID) of a STACKIT Snapshot. (required) + * @param updateSnapshotPayload Request an update of a snapshot. (required) + * @return ApiResponse<Snapshot> + * @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 Snapshot has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse updateSnapshotWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID snapshotId, + @javax.annotation.Nonnull UpdateSnapshotPayload updateSnapshotPayload) + throws ApiException { + okhttp3.Call localVarCall = + updateSnapshotValidateBeforeCall( + projectId, snapshotId, updateSnapshotPayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update information of the snapshot. (asynchronously) Update information like name or labels + * of the snapshot. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param snapshotId The identifier (ID) of a STACKIT Snapshot. (required) + * @param updateSnapshotPayload Request an update of a snapshot. (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 Snapshot has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call updateSnapshotAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID snapshotId, + @javax.annotation.Nonnull UpdateSnapshotPayload updateSnapshotPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + updateSnapshotValidateBeforeCall( + projectId, snapshotId, updateSnapshotPayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for updateVolume + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @param updateVolumePayload Request an update of a volume. (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 Volume has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call updateVolumeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID volumeId, + @javax.annotation.Nonnull UpdateVolumePayload updateVolumePayload, + 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 = updateVolumePayload; + + // create path and map variables + String localVarPath = + "/v1/projects/{projectId}/volumes/{volumeId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "volumeId" + "}", + localVarApiClient.escapeString(volumeId.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, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call updateVolumeValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID volumeId, + @javax.annotation.Nonnull UpdateVolumePayload updateVolumePayload, + 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 updateVolume(Async)"); + } + + // verify the required parameter 'volumeId' is set + if (volumeId == null) { + throw new ApiException( + "Missing the required parameter 'volumeId' when calling updateVolume(Async)"); + } + + // verify the required parameter 'updateVolumePayload' is set + if (updateVolumePayload == null) { + throw new ApiException( + "Missing the required parameter 'updateVolumePayload' when calling updateVolume(Async)"); + } + + return updateVolumeCall(projectId, volumeId, updateVolumePayload, _callback); + } + + /** + * Update information of a volume. Update name, description or labels of the volume. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @param updateVolumePayload Request an update of a volume. (required) + * @return Volume + * @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 Volume has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public Volume updateVolume( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID volumeId, + @javax.annotation.Nonnull UpdateVolumePayload updateVolumePayload) + throws ApiException { + ApiResponse localVarResp = + updateVolumeWithHttpInfo(projectId, volumeId, updateVolumePayload); + return localVarResp.getData(); + } + + /** + * Update information of a volume. Update name, description or labels of the volume. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @param updateVolumePayload Request an update of a volume. (required) + * @return ApiResponse<Volume> + * @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 Volume has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public ApiResponse updateVolumeWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID volumeId, + @javax.annotation.Nonnull UpdateVolumePayload updateVolumePayload) + throws ApiException { + okhttp3.Call localVarCall = + updateVolumeValidateBeforeCall(projectId, volumeId, updateVolumePayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update information of a volume. (asynchronously) Update name, description or labels of the + * volume. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @param updateVolumePayload Request an update of a volume. (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 Volume has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ * + * @deprecated + */ + @Deprecated + public okhttp3.Call updateVolumeAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull UUID volumeId, + @javax.annotation.Nonnull UpdateVolumePayload updateVolumePayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + updateVolumeValidateBeforeCall(projectId, volumeId, updateVolumePayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/api/IaasApi.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/api/IaasApi.java new file mode 100644 index 00000000..2d46de96 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/api/IaasApi.java @@ -0,0 +1,63 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.api; + +import cloud.stackit.sdk.core.config.CoreConfiguration; +import java.io.IOException; +import okhttp3.OkHttpClient; + +public class IaasApi extends DefaultApi { + /** + * Basic constructor for IaasApi + * + *

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

For production use consider using the constructor with the OkHttpClient parameter. + * + * @param configuration your STACKIT SDK CoreConfiguration + * @throws IOException + */ + public IaasApi(CoreConfiguration configuration) throws IOException { + super(configuration); + } + + /** + * Constructor for IaasApi + * + * @param httpClient OkHttpClient object + * @throws IOException + */ + public IaasApi(OkHttpClient httpClient) throws IOException { + super(httpClient); + } + + /** + * Constructor for IaasApi + * + * @param httpClient OkHttpClient object + * @param configuration your STACKIT SDK CoreConfiguration + * @throws IOException + */ + public IaasApi(OkHttpClient httpClient, CoreConfiguration configuration) throws IOException { + super(httpClient, configuration); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/AbstractOpenApiSchema.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/AbstractOpenApiSchema.java new file mode 100644 index 00000000..f87b9134 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/AbstractOpenApiSchema.java @@ -0,0 +1,145 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.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/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/AddVolumeToServerPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/AddVolumeToServerPayload.java new file mode 100644 index 00000000..8b3756f0 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/AddVolumeToServerPayload.java @@ -0,0 +1,348 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.v1api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +/** Object that represents a Volume attachment to a server. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class AddVolumeToServerPayload { + public static final String SERIALIZED_NAME_DELETE_ON_TERMINATION = "deleteOnTermination"; + + @SerializedName(SERIALIZED_NAME_DELETE_ON_TERMINATION) + @javax.annotation.Nullable private Boolean deleteOnTermination; + + public static final String SERIALIZED_NAME_SERVER_ID = "serverId"; + + @SerializedName(SERIALIZED_NAME_SERVER_ID) + @javax.annotation.Nullable private UUID serverId; + + public static final String SERIALIZED_NAME_VOLUME_ID = "volumeId"; + + @SerializedName(SERIALIZED_NAME_VOLUME_ID) + @javax.annotation.Nullable private UUID volumeId; + + public AddVolumeToServerPayload() {} + + public AddVolumeToServerPayload(UUID serverId, UUID volumeId) { + this(); + this.serverId = serverId; + this.volumeId = volumeId; + } + + public AddVolumeToServerPayload deleteOnTermination( + @javax.annotation.Nullable Boolean deleteOnTermination) { + this.deleteOnTermination = deleteOnTermination; + return this; + } + + /** + * Delete the volume during the termination of the server. Defaults to false. + * + * @return deleteOnTermination + */ + @javax.annotation.Nullable public Boolean getDeleteOnTermination() { + return deleteOnTermination; + } + + public void setDeleteOnTermination(@javax.annotation.Nullable Boolean deleteOnTermination) { + this.deleteOnTermination = deleteOnTermination; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return serverId + */ + @javax.annotation.Nullable public UUID getServerId() { + return serverId; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return volumeId + */ + @javax.annotation.Nullable public UUID getVolumeId() { + return volumeId; + } + + /** + * 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 AddVolumeToServerPayload instance itself + */ + public AddVolumeToServerPayload 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; + } + AddVolumeToServerPayload addVolumeToServerPayload = (AddVolumeToServerPayload) o; + return Objects.equals( + this.deleteOnTermination, addVolumeToServerPayload.deleteOnTermination) + && Objects.equals(this.serverId, addVolumeToServerPayload.serverId) + && Objects.equals(this.volumeId, addVolumeToServerPayload.volumeId) + && Objects.equals( + this.additionalProperties, addVolumeToServerPayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(deleteOnTermination, serverId, volumeId, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AddVolumeToServerPayload {\n"); + sb.append(" deleteOnTermination: ") + .append(toIndentedString(deleteOnTermination)) + .append("\n"); + sb.append(" serverId: ").append(toIndentedString(serverId)).append("\n"); + sb.append(" volumeId: ").append(toIndentedString(volumeId)).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("deleteOnTermination", "serverId", "volumeId")); + + // 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 AddVolumeToServerPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AddVolumeToServerPayload.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 AddVolumeToServerPayload is not found in the empty JSON string", + AddVolumeToServerPayload.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("serverId") != null && !jsonObj.get("serverId").isJsonNull()) + && !jsonObj.get("serverId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `serverId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("serverId").toString())); + } + if ((jsonObj.get("volumeId") != null && !jsonObj.get("volumeId").isJsonNull()) + && !jsonObj.get("volumeId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `volumeId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("volumeId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AddVolumeToServerPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AddVolumeToServerPayload' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(AddVolumeToServerPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AddVolumeToServerPayload 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 AddVolumeToServerPayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AddVolumeToServerPayload 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 AddVolumeToServerPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of AddVolumeToServerPayload + * @throws IOException if the JSON string is invalid with respect to AddVolumeToServerPayload + */ + public static AddVolumeToServerPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AddVolumeToServerPayload.class); + } + + /** + * Convert an instance of AddVolumeToServerPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/AffinityGroup.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/AffinityGroup.java new file mode 100644 index 00000000..3c6af746 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/AffinityGroup.java @@ -0,0 +1,404 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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.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; +import java.util.UUID; + +/** Definition of an affinity group. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class AffinityGroup { + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_MEMBERS = "members"; + + @SerializedName(SERIALIZED_NAME_MEMBERS) + @javax.annotation.Nullable private List members = new ArrayList<>(); + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_POLICY = "policy"; + + @SerializedName(SERIALIZED_NAME_POLICY) + @javax.annotation.Nonnull + private String policy; + + public AffinityGroup() {} + + public AffinityGroup(UUID id, List members) { + this(); + this.id = id; + this.members = members; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + /** + * The servers that are part of the affinity group. + * + * @return members + */ + @javax.annotation.Nullable public List getMembers() { + return members; + } + + public AffinityGroup name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + public AffinityGroup policy(@javax.annotation.Nonnull String policy) { + this.policy = policy; + return this; + } + + /** + * The affinity group policy. `hard-affinity`: All servers in this group will be + * hosted on the same compute node. `soft-affinity`: All servers in this group will be + * hosted on as few compute nodes as possible. `hard-anti-affinity`: All servers in + * this group will be hosted on different compute nodes. `soft-anti-affinity`: All + * servers in this group will be hosted on as many compute nodes as possible. Possible values: + * `hard-anti-affinity`, `hard-affinity`, `soft-anti-affinity`, + * `soft-affinity`. + * + * @return policy + */ + @javax.annotation.Nonnull + public String getPolicy() { + return policy; + } + + public void setPolicy(@javax.annotation.Nonnull String policy) { + this.policy = policy; + } + + /** + * 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 AffinityGroup instance itself + */ + public AffinityGroup 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; + } + AffinityGroup affinityGroup = (AffinityGroup) o; + return Objects.equals(this.id, affinityGroup.id) + && Objects.equals(this.members, affinityGroup.members) + && Objects.equals(this.name, affinityGroup.name) + && Objects.equals(this.policy, affinityGroup.policy) + && Objects.equals(this.additionalProperties, affinityGroup.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, members, name, policy, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AffinityGroup {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" members: ").append(toIndentedString(members)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" policy: ").append(toIndentedString(policy)).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("id", "members", "name", "policy")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name", "policy")); + } + + /** + * 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 AffinityGroup + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AffinityGroup.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 AffinityGroup is not found in the empty JSON string", + AffinityGroup.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AffinityGroup.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("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("members") != null + && !jsonObj.get("members").isJsonNull() + && !jsonObj.get("members").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `members` to be an array in the JSON string but got `%s`", + jsonObj.get("members").toString())); + } + 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("policy").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `policy` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("policy").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AffinityGroup.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AffinityGroup' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(AffinityGroup.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AffinityGroup 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 AffinityGroup read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AffinityGroup 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 AffinityGroup given an JSON string + * + * @param jsonString JSON string + * @return An instance of AffinityGroup + * @throws IOException if the JSON string is invalid with respect to AffinityGroup + */ + public static AffinityGroup fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AffinityGroup.class); + } + + /** + * Convert an instance of AffinityGroup to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/AffinityGroupListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/AffinityGroupListResponse.java new file mode 100644 index 00000000..eefe3e39 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/AffinityGroupListResponse.java @@ -0,0 +1,327 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** Response object for affinity group list request. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class AffinityGroupListResponse { + public static final String SERIALIZED_NAME_ITEMS = "items"; + + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public AffinityGroupListResponse() {} + + public AffinityGroupListResponse items(@javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public AffinityGroupListResponse addItemsItem(AffinityGroup itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list of affinity groups. + * + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AffinityGroupListResponse instance itself + */ + public AffinityGroupListResponse 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; + } + AffinityGroupListResponse affinityGroupListResponse = (AffinityGroupListResponse) o; + return Objects.equals(this.items, affinityGroupListResponse.items) + && Objects.equals( + this.additionalProperties, affinityGroupListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AffinityGroupListResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("items")); + } + + /** + * 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 AffinityGroupListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AffinityGroupListResponse.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 AffinityGroupListResponse is not found in the empty JSON string", + AffinityGroupListResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AffinityGroupListResponse.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("items").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `items` to be an array in the JSON string but got `%s`", + jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + AffinityGroup.validateJsonElement(jsonArrayitems.get(i)); + } + ; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AffinityGroupListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AffinityGroupListResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(AffinityGroupListResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AffinityGroupListResponse 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 AffinityGroupListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AffinityGroupListResponse 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 AffinityGroupListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of AffinityGroupListResponse + * @throws IOException if the JSON string is invalid with respect to AffinityGroupListResponse + */ + public static AffinityGroupListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AffinityGroupListResponse.class); + } + + /** + * Convert an instance of AffinityGroupListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/AllowedAddressesInner.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/AllowedAddressesInner.java new file mode 100644 index 00000000..25507d81 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/AllowedAddressesInner.java @@ -0,0 +1,241 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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 AllowedAddressesInner extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(AllowedAddressesInner.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AllowedAddressesInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AllowedAddressesInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterString = + gson.getDelegateAdapter(this, TypeToken.get(String.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AllowedAddressesInner 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; + } + throw new IOException( + "Failed to serialize as the type doesn't match oneOf schemas: String"); + } + + @Override + public AllowedAddressesInner read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + 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; + match++; + log.log(Level.FINER, "Input data matches schema 'String'"); + } 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); + } + + if (match == 1) { + AllowedAddressesInner ret = new AllowedAddressesInner(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException( + String.format( + java.util.Locale.ROOT, + "Failed deserialization for AllowedAddressesInner: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", + match, + errorMessages, + jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public AllowedAddressesInner() { + super("oneOf", Boolean.FALSE); + } + + public AllowedAddressesInner(Object o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("String", String.class); + } + + @Override + public Map> getSchemas() { + return AllowedAddressesInner.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: String + * + *

It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof String) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be String"); + } + + /** + * Get the actual instance, which can be the following: String + * + * @return The actual instance (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(); + } + + /** + * 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 AllowedAddressesInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + 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())); + } + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for String failed with `%s`.", + e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException( + String.format( + java.util.Locale.ROOT, + "The JSON string is invalid for AllowedAddressesInner with oneOf schemas: String. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", + validCount, + errorMessages, + jsonElement.toString())); + } + } + + /** + * Create an instance of AllowedAddressesInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of AllowedAddressesInner + * @throws IOException if the JSON string is invalid with respect to AllowedAddressesInner + */ + public static AllowedAddressesInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AllowedAddressesInner.class); + } + + /** + * Convert an instance of AllowedAddressesInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/Area.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/Area.java new file mode 100644 index 00000000..6aa84fb8 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/Area.java @@ -0,0 +1,451 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** The basic properties of a network area. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class Area { + public static final String SERIALIZED_NAME_DEFAULT_NAMESERVERS = "defaultNameservers"; + + @SerializedName(SERIALIZED_NAME_DEFAULT_NAMESERVERS) + @javax.annotation.Nullable private List defaultNameservers = new ArrayList<>(); + + public static final String SERIALIZED_NAME_NETWORK_RANGES = "networkRanges"; + + @SerializedName(SERIALIZED_NAME_NETWORK_RANGES) + @javax.annotation.Nullable private List networkRanges = new ArrayList<>(); + + public static final String SERIALIZED_NAME_ROUTES = "routes"; + + @SerializedName(SERIALIZED_NAME_ROUTES) + @javax.annotation.Nullable private List routes = new ArrayList<>(); + + public static final String SERIALIZED_NAME_TRANSFER_NETWORK = "transferNetwork"; + + @SerializedName(SERIALIZED_NAME_TRANSFER_NETWORK) + @javax.annotation.Nullable private String transferNetwork; + + public Area() {} + + public Area defaultNameservers(@javax.annotation.Nullable List defaultNameservers) { + this.defaultNameservers = defaultNameservers; + return this; + } + + public Area addDefaultNameserversItem(String defaultNameserversItem) { + if (this.defaultNameservers == null) { + this.defaultNameservers = new ArrayList<>(); + } + this.defaultNameservers.add(defaultNameserversItem); + return this; + } + + /** + * A list containing DNS Servers/Nameservers for IPv4. + * + * @return defaultNameservers + */ + @javax.annotation.Nullable public List getDefaultNameservers() { + return defaultNameservers; + } + + public void setDefaultNameservers(@javax.annotation.Nullable List defaultNameservers) { + this.defaultNameservers = defaultNameservers; + } + + public Area networkRanges(@javax.annotation.Nullable List networkRanges) { + this.networkRanges = networkRanges; + return this; + } + + public Area addNetworkRangesItem(NetworkRange networkRangesItem) { + if (this.networkRanges == null) { + this.networkRanges = new ArrayList<>(); + } + this.networkRanges.add(networkRangesItem); + return this; + } + + /** + * A list of network ranges. + * + * @return networkRanges + */ + @javax.annotation.Nullable public List getNetworkRanges() { + return networkRanges; + } + + public void setNetworkRanges(@javax.annotation.Nullable List networkRanges) { + this.networkRanges = networkRanges; + } + + public Area routes(@javax.annotation.Nullable List routes) { + this.routes = routes; + return this; + } + + public Area addRoutesItem(Route routesItem) { + if (this.routes == null) { + this.routes = new ArrayList<>(); + } + this.routes.add(routesItem); + return this; + } + + /** + * A list of routes. + * + * @return routes + */ + @javax.annotation.Nullable public List getRoutes() { + return routes; + } + + public void setRoutes(@javax.annotation.Nullable List routes) { + this.routes = routes; + } + + public Area transferNetwork(@javax.annotation.Nullable String transferNetwork) { + this.transferNetwork = transferNetwork; + return this; + } + + /** + * Classless Inter-Domain Routing (CIDR). + * + * @return transferNetwork + */ + @javax.annotation.Nullable public String getTransferNetwork() { + return transferNetwork; + } + + public void setTransferNetwork(@javax.annotation.Nullable String transferNetwork) { + this.transferNetwork = transferNetwork; + } + + /** + * 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 Area instance itself + */ + public Area 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; + } + Area area = (Area) o; + return Objects.equals(this.defaultNameservers, area.defaultNameservers) + && Objects.equals(this.networkRanges, area.networkRanges) + && Objects.equals(this.routes, area.routes) + && Objects.equals(this.transferNetwork, area.transferNetwork) + && Objects.equals(this.additionalProperties, area.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + defaultNameservers, networkRanges, routes, transferNetwork, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Area {\n"); + sb.append(" defaultNameservers: ") + .append(toIndentedString(defaultNameservers)) + .append("\n"); + sb.append(" networkRanges: ").append(toIndentedString(networkRanges)).append("\n"); + sb.append(" routes: ").append(toIndentedString(routes)).append("\n"); + sb.append(" transferNetwork: ").append(toIndentedString(transferNetwork)).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( + "defaultNameservers", + "networkRanges", + "routes", + "transferNetwork")); + + // 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 Area + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Area.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 Area is not found in the empty JSON string", + Area.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("defaultNameservers") != null + && !jsonObj.get("defaultNameservers").isJsonNull() + && !jsonObj.get("defaultNameservers").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `defaultNameservers` to be an array in the JSON string but got `%s`", + jsonObj.get("defaultNameservers").toString())); + } + if (jsonObj.get("networkRanges") != null && !jsonObj.get("networkRanges").isJsonNull()) { + JsonArray jsonArraynetworkRanges = jsonObj.getAsJsonArray("networkRanges"); + if (jsonArraynetworkRanges != null) { + // ensure the json data is an array + if (!jsonObj.get("networkRanges").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `networkRanges` to be an array in the JSON string but got `%s`", + jsonObj.get("networkRanges").toString())); + } + + // validate the optional field `networkRanges` (array) + for (int i = 0; i < jsonArraynetworkRanges.size(); i++) { + NetworkRange.validateJsonElement(jsonArraynetworkRanges.get(i)); + } + ; + } + } + if (jsonObj.get("routes") != null && !jsonObj.get("routes").isJsonNull()) { + JsonArray jsonArrayroutes = jsonObj.getAsJsonArray("routes"); + if (jsonArrayroutes != null) { + // ensure the json data is an array + if (!jsonObj.get("routes").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `routes` to be an array in the JSON string but got `%s`", + jsonObj.get("routes").toString())); + } + + // validate the optional field `routes` (array) + for (int i = 0; i < jsonArrayroutes.size(); i++) { + Route.validateJsonElement(jsonArrayroutes.get(i)); + } + ; + } + } + if ((jsonObj.get("transferNetwork") != null && !jsonObj.get("transferNetwork").isJsonNull()) + && !jsonObj.get("transferNetwork").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `transferNetwork` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("transferNetwork").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Area.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Area' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(Area.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, Area 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 Area read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Area 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 Area given an JSON string + * + * @param jsonString JSON string + * @return An instance of Area + * @throws IOException if the JSON string is invalid with respect to Area + */ + public static Area fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Area.class); + } + + /** + * Convert an instance of Area to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/AreaConfig.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/AreaConfig.java new file mode 100644 index 00000000..51cd3b06 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/AreaConfig.java @@ -0,0 +1,464 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** The basic network area object. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class AreaConfig { + public static final String SERIALIZED_NAME_DEFAULT_NAMESERVERS = "defaultNameservers"; + + @SerializedName(SERIALIZED_NAME_DEFAULT_NAMESERVERS) + @javax.annotation.Nullable private List defaultNameservers = new ArrayList<>(); + + public static final String SERIALIZED_NAME_NETWORK_RANGES = "networkRanges"; + + @SerializedName(SERIALIZED_NAME_NETWORK_RANGES) + @javax.annotation.Nonnull + private List networkRanges = new ArrayList<>(); + + public static final String SERIALIZED_NAME_ROUTES = "routes"; + + @SerializedName(SERIALIZED_NAME_ROUTES) + @javax.annotation.Nullable private List routes = new ArrayList<>(); + + public static final String SERIALIZED_NAME_TRANSFER_NETWORK = "transferNetwork"; + + @SerializedName(SERIALIZED_NAME_TRANSFER_NETWORK) + @javax.annotation.Nonnull + private String transferNetwork; + + public AreaConfig() {} + + public AreaConfig defaultNameservers( + @javax.annotation.Nullable List defaultNameservers) { + this.defaultNameservers = defaultNameservers; + return this; + } + + public AreaConfig addDefaultNameserversItem(String defaultNameserversItem) { + if (this.defaultNameservers == null) { + this.defaultNameservers = new ArrayList<>(); + } + this.defaultNameservers.add(defaultNameserversItem); + return this; + } + + /** + * Get defaultNameservers + * + * @return defaultNameservers + */ + @javax.annotation.Nullable public List getDefaultNameservers() { + return defaultNameservers; + } + + public void setDefaultNameservers(@javax.annotation.Nullable List defaultNameservers) { + this.defaultNameservers = defaultNameservers; + } + + public AreaConfig networkRanges(@javax.annotation.Nonnull List networkRanges) { + this.networkRanges = networkRanges; + return this; + } + + public AreaConfig addNetworkRangesItem(NetworkRange networkRangesItem) { + if (this.networkRanges == null) { + this.networkRanges = new ArrayList<>(); + } + this.networkRanges.add(networkRangesItem); + return this; + } + + /** + * A list of network ranges. + * + * @return networkRanges + */ + @javax.annotation.Nonnull + public List getNetworkRanges() { + return networkRanges; + } + + public void setNetworkRanges(@javax.annotation.Nonnull List networkRanges) { + this.networkRanges = networkRanges; + } + + public AreaConfig routes(@javax.annotation.Nullable List routes) { + this.routes = routes; + return this; + } + + public AreaConfig addRoutesItem(Route routesItem) { + if (this.routes == null) { + this.routes = new ArrayList<>(); + } + this.routes.add(routesItem); + return this; + } + + /** + * A list of routes. + * + * @return routes + */ + @javax.annotation.Nullable public List getRoutes() { + return routes; + } + + public void setRoutes(@javax.annotation.Nullable List routes) { + this.routes = routes; + } + + public AreaConfig transferNetwork(@javax.annotation.Nonnull String transferNetwork) { + this.transferNetwork = transferNetwork; + return this; + } + + /** + * Classless Inter-Domain Routing (CIDR). + * + * @return transferNetwork + */ + @javax.annotation.Nonnull + public String getTransferNetwork() { + return transferNetwork; + } + + public void setTransferNetwork(@javax.annotation.Nonnull String transferNetwork) { + this.transferNetwork = transferNetwork; + } + + /** + * 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 AreaConfig instance itself + */ + public AreaConfig 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; + } + AreaConfig areaConfig = (AreaConfig) o; + return Objects.equals(this.defaultNameservers, areaConfig.defaultNameservers) + && Objects.equals(this.networkRanges, areaConfig.networkRanges) + && Objects.equals(this.routes, areaConfig.routes) + && Objects.equals(this.transferNetwork, areaConfig.transferNetwork) + && Objects.equals(this.additionalProperties, areaConfig.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + defaultNameservers, networkRanges, routes, transferNetwork, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AreaConfig {\n"); + sb.append(" defaultNameservers: ") + .append(toIndentedString(defaultNameservers)) + .append("\n"); + sb.append(" networkRanges: ").append(toIndentedString(networkRanges)).append("\n"); + sb.append(" routes: ").append(toIndentedString(routes)).append("\n"); + sb.append(" transferNetwork: ").append(toIndentedString(transferNetwork)).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( + "defaultNameservers", + "networkRanges", + "routes", + "transferNetwork")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = + new HashSet(Arrays.asList("networkRanges", "transferNetwork")); + } + + /** + * 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 AreaConfig + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AreaConfig.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 AreaConfig is not found in the empty JSON string", + AreaConfig.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AreaConfig.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 optional json data is an array if present + if (jsonObj.get("defaultNameservers") != null + && !jsonObj.get("defaultNameservers").isJsonNull() + && !jsonObj.get("defaultNameservers").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `defaultNameservers` to be an array in the JSON string but got `%s`", + jsonObj.get("defaultNameservers").toString())); + } + // ensure the json data is an array + if (!jsonObj.get("networkRanges").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `networkRanges` to be an array in the JSON string but got `%s`", + jsonObj.get("networkRanges").toString())); + } + + JsonArray jsonArraynetworkRanges = jsonObj.getAsJsonArray("networkRanges"); + // validate the required field `networkRanges` (array) + for (int i = 0; i < jsonArraynetworkRanges.size(); i++) { + NetworkRange.validateJsonElement(jsonArraynetworkRanges.get(i)); + } + ; + if (jsonObj.get("routes") != null && !jsonObj.get("routes").isJsonNull()) { + JsonArray jsonArrayroutes = jsonObj.getAsJsonArray("routes"); + if (jsonArrayroutes != null) { + // ensure the json data is an array + if (!jsonObj.get("routes").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `routes` to be an array in the JSON string but got `%s`", + jsonObj.get("routes").toString())); + } + + // validate the optional field `routes` (array) + for (int i = 0; i < jsonArrayroutes.size(); i++) { + Route.validateJsonElement(jsonArrayroutes.get(i)); + } + ; + } + } + if (!jsonObj.get("transferNetwork").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `transferNetwork` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("transferNetwork").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AreaConfig.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AreaConfig' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(AreaConfig.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AreaConfig 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 AreaConfig read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AreaConfig 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 AreaConfig given an JSON string + * + * @param jsonString JSON string + * @return An instance of AreaConfig + * @throws IOException if the JSON string is invalid with respect to AreaConfig + */ + public static AreaConfig fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AreaConfig.class); + } + + /** + * Convert an instance of AreaConfig to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/AreaId.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/AreaId.java new file mode 100644 index 00000000..fbdcc2df --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/AreaId.java @@ -0,0 +1,281 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.v1api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +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.UUID; +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 AreaId extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(AreaId.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AreaId.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AreaId' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterUUID = + gson.getDelegateAdapter(this, TypeToken.get(UUID.class)); + final TypeAdapter adapterStaticAreaID = + gson.getDelegateAdapter(this, TypeToken.get(StaticAreaID.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AreaId value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `UUID` + if (value.getActualInstance() instanceof UUID) { + JsonElement element = + adapterUUID.toJsonTree((UUID) value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `StaticAreaID` + if (value.getActualInstance() instanceof StaticAreaID) { + JsonElement element = + adapterStaticAreaID.toJsonTree( + (StaticAreaID) value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException( + "Failed to serialize as the type doesn't match oneOf schemas: StaticAreaID, UUID"); + } + + @Override + public AreaId read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize UUID + try { + // validate the JSON object to see if any exception is thrown + UUID.fromString(jsonElement.getAsString()); + actualAdapter = adapterUUID; + match++; + log.log(Level.FINER, "Input data matches schema 'UUID'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for UUID failed with `%s`.", + e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'UUID'", e); + } + // deserialize StaticAreaID + try { + // validate the JSON object to see if any exception is thrown + StaticAreaID.validateJsonElement(jsonElement); + actualAdapter = adapterStaticAreaID; + match++; + log.log(Level.FINER, "Input data matches schema 'StaticAreaID'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for StaticAreaID failed with `%s`.", + e.getMessage())); + log.log( + Level.FINER, + "Input data does not match schema 'StaticAreaID'", + e); + } + + if (match == 1) { + AreaId ret = new AreaId(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException( + String.format( + java.util.Locale.ROOT, + "Failed deserialization for AreaId: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", + match, + errorMessages, + jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public AreaId() { + super("oneOf", Boolean.FALSE); + } + + public AreaId(Object o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("UUID", UUID.class); + schemas.put("StaticAreaID", StaticAreaID.class); + } + + @Override + public Map> getSchemas() { + return AreaId.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: StaticAreaID, UUID + * + *

It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof UUID) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof StaticAreaID) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be StaticAreaID, UUID"); + } + + /** + * Get the actual instance, which can be the following: StaticAreaID, UUID + * + * @return The actual instance (StaticAreaID, UUID) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `UUID`. If the actual instance is not `UUID`, the + * ClassCastException will be thrown. + * + * @return The actual instance of `UUID` + * @throws ClassCastException if the instance is not `UUID` + */ + public UUID getUUID() throws ClassCastException { + return (UUID) super.getActualInstance(); + } + + /** + * Get the actual instance of `StaticAreaID`. If the actual instance is not `StaticAreaID`, the + * ClassCastException will be thrown. + * + * @return The actual instance of `StaticAreaID` + * @throws ClassCastException if the instance is not `StaticAreaID` + */ + public StaticAreaID getStaticAreaID() throws ClassCastException { + return (StaticAreaID) 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 AreaId + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with UUID + try { + UUID.fromString(jsonElement.getAsString()); + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for UUID failed with `%s`.", + e.getMessage())); + // continue to the next one + } + // validate the json string with StaticAreaID + try { + StaticAreaID.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for StaticAreaID failed with `%s`.", + e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException( + String.format( + java.util.Locale.ROOT, + "The JSON string is invalid for AreaId with oneOf schemas: StaticAreaID, UUID. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", + validCount, + errorMessages, + jsonElement.toString())); + } + } + + /** + * Create an instance of AreaId given an JSON string + * + * @param jsonString JSON string + * @return An instance of AreaId + * @throws IOException if the JSON string is invalid with respect to AreaId + */ + public static AreaId fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AreaId.class); + } + + /** + * Convert an instance of AreaId to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/AreaPrefixConfigIPv4.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/AreaPrefixConfigIPv4.java new file mode 100644 index 00000000..6b850748 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/AreaPrefixConfigIPv4.java @@ -0,0 +1,340 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** The IPv4 prefix config for a network area. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class AreaPrefixConfigIPv4 { + public static final String SERIALIZED_NAME_DEFAULT_PREFIX_LEN = "defaultPrefixLen"; + + @SerializedName(SERIALIZED_NAME_DEFAULT_PREFIX_LEN) + @javax.annotation.Nullable private Integer defaultPrefixLen = 25; + + public static final String SERIALIZED_NAME_MAX_PREFIX_LEN = "maxPrefixLen"; + + @SerializedName(SERIALIZED_NAME_MAX_PREFIX_LEN) + @javax.annotation.Nullable private Integer maxPrefixLen = 29; + + public static final String SERIALIZED_NAME_MIN_PREFIX_LEN = "minPrefixLen"; + + @SerializedName(SERIALIZED_NAME_MIN_PREFIX_LEN) + @javax.annotation.Nullable private Integer minPrefixLen = 24; + + public AreaPrefixConfigIPv4() {} + + public AreaPrefixConfigIPv4 defaultPrefixLen( + @javax.annotation.Nullable Integer defaultPrefixLen) { + this.defaultPrefixLen = defaultPrefixLen; + return this; + } + + /** + * The default prefix length for networks in the network area. minimum: 24 maximum: 29 + * + * @return defaultPrefixLen + */ + @javax.annotation.Nullable public Integer getDefaultPrefixLen() { + return defaultPrefixLen; + } + + public void setDefaultPrefixLen(@javax.annotation.Nullable Integer defaultPrefixLen) { + this.defaultPrefixLen = defaultPrefixLen; + } + + public AreaPrefixConfigIPv4 maxPrefixLen(@javax.annotation.Nullable Integer maxPrefixLen) { + this.maxPrefixLen = maxPrefixLen; + return this; + } + + /** + * The maximal prefix length for networks in the network area. minimum: 24 maximum: 29 + * + * @return maxPrefixLen + */ + @javax.annotation.Nullable public Integer getMaxPrefixLen() { + return maxPrefixLen; + } + + public void setMaxPrefixLen(@javax.annotation.Nullable Integer maxPrefixLen) { + this.maxPrefixLen = maxPrefixLen; + } + + public AreaPrefixConfigIPv4 minPrefixLen(@javax.annotation.Nullable Integer minPrefixLen) { + this.minPrefixLen = minPrefixLen; + return this; + } + + /** + * The minimal prefix length for networks in the network area. minimum: 8 maximum: 29 + * + * @return minPrefixLen + */ + @javax.annotation.Nullable public Integer getMinPrefixLen() { + return minPrefixLen; + } + + public void setMinPrefixLen(@javax.annotation.Nullable Integer minPrefixLen) { + this.minPrefixLen = minPrefixLen; + } + + /** + * 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 AreaPrefixConfigIPv4 instance itself + */ + public AreaPrefixConfigIPv4 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; + } + AreaPrefixConfigIPv4 areaPrefixConfigIPv4 = (AreaPrefixConfigIPv4) o; + return Objects.equals(this.defaultPrefixLen, areaPrefixConfigIPv4.defaultPrefixLen) + && Objects.equals(this.maxPrefixLen, areaPrefixConfigIPv4.maxPrefixLen) + && Objects.equals(this.minPrefixLen, areaPrefixConfigIPv4.minPrefixLen) + && Objects.equals( + this.additionalProperties, areaPrefixConfigIPv4.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(defaultPrefixLen, maxPrefixLen, minPrefixLen, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AreaPrefixConfigIPv4 {\n"); + sb.append(" defaultPrefixLen: ").append(toIndentedString(defaultPrefixLen)).append("\n"); + sb.append(" maxPrefixLen: ").append(toIndentedString(maxPrefixLen)).append("\n"); + sb.append(" minPrefixLen: ").append(toIndentedString(minPrefixLen)).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("defaultPrefixLen", "maxPrefixLen", "minPrefixLen")); + + // 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 AreaPrefixConfigIPv4 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AreaPrefixConfigIPv4.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 AreaPrefixConfigIPv4 is not found in the empty JSON string", + AreaPrefixConfigIPv4.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AreaPrefixConfigIPv4.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AreaPrefixConfigIPv4' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(AreaPrefixConfigIPv4.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AreaPrefixConfigIPv4 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 AreaPrefixConfigIPv4 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AreaPrefixConfigIPv4 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 AreaPrefixConfigIPv4 given an JSON string + * + * @param jsonString JSON string + * @return An instance of AreaPrefixConfigIPv4 + * @throws IOException if the JSON string is invalid with respect to AreaPrefixConfigIPv4 + */ + public static AreaPrefixConfigIPv4 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AreaPrefixConfigIPv4.class); + } + + /** + * Convert an instance of AreaPrefixConfigIPv4 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/AvailabilityZoneListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/AvailabilityZoneListResponse.java new file mode 100644 index 00000000..25ed9c2a --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/AvailabilityZoneListResponse.java @@ -0,0 +1,328 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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.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; + +/** Availability Zone list response. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class AvailabilityZoneListResponse { + public static final String SERIALIZED_NAME_ITEMS = "items"; + + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public AvailabilityZoneListResponse() {} + + public AvailabilityZoneListResponse items(@javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public AvailabilityZoneListResponse addItemsItem(String itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list of availability zones. + * + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AvailabilityZoneListResponse instance itself + */ + public AvailabilityZoneListResponse 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; + } + AvailabilityZoneListResponse availabilityZoneListResponse = + (AvailabilityZoneListResponse) o; + return Objects.equals(this.items, availabilityZoneListResponse.items) + && Objects.equals( + this.additionalProperties, + availabilityZoneListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AvailabilityZoneListResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("items")); + } + + /** + * 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 + * AvailabilityZoneListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AvailabilityZoneListResponse.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 AvailabilityZoneListResponse is not found in the empty JSON string", + AvailabilityZoneListResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AvailabilityZoneListResponse.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 required json array is present + if (jsonObj.get("items") == null) { + throw new IllegalArgumentException( + "Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("items").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `items` to be an array in the JSON string but got `%s`", + jsonObj.get("items").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AvailabilityZoneListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AvailabilityZoneListResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(AvailabilityZoneListResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AvailabilityZoneListResponse 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 AvailabilityZoneListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AvailabilityZoneListResponse 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 AvailabilityZoneListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of AvailabilityZoneListResponse + * @throws IOException if the JSON string is invalid with respect to + * AvailabilityZoneListResponse + */ + public static AvailabilityZoneListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AvailabilityZoneListResponse.class); + } + + /** + * Convert an instance of AvailabilityZoneListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/Backup.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/Backup.java new file mode 100644 index 00000000..f5e72b79 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/Backup.java @@ -0,0 +1,592 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; +import java.util.UUID; + +/** Object that represents a backup. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class Backup { + public static final String SERIALIZED_NAME_AVAILABILITY_ZONE = "availabilityZone"; + + @SerializedName(SERIALIZED_NAME_AVAILABILITY_ZONE) + @javax.annotation.Nullable private String availabilityZone; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable private String description; + + public static final String SERIALIZED_NAME_ENCRYPTED = "encrypted"; + + @SerializedName(SERIALIZED_NAME_ENCRYPTED) + @javax.annotation.Nullable private Boolean encrypted; + + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; + + public static final String SERIALIZED_NAME_SIZE = "size"; + + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nullable private Long size; + + public static final String SERIALIZED_NAME_SNAPSHOT_ID = "snapshotId"; + + @SerializedName(SERIALIZED_NAME_SNAPSHOT_ID) + @javax.annotation.Nullable private UUID snapshotId; + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable private String status; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable private OffsetDateTime updatedAt; + + public static final String SERIALIZED_NAME_VOLUME_ID = "volumeId"; + + @SerializedName(SERIALIZED_NAME_VOLUME_ID) + @javax.annotation.Nullable private UUID volumeId; + + public Backup() {} + + public Backup( + String availabilityZone, + OffsetDateTime createdAt, + Boolean encrypted, + UUID id, + Long size, + UUID snapshotId, + String status, + OffsetDateTime updatedAt, + UUID volumeId) { + this(); + this.availabilityZone = availabilityZone; + this.createdAt = createdAt; + this.encrypted = encrypted; + this.id = id; + this.size = size; + this.snapshotId = snapshotId; + this.status = status; + this.updatedAt = updatedAt; + this.volumeId = volumeId; + } + + /** + * Object that represents an availability zone. + * + * @return availabilityZone + */ + @javax.annotation.Nullable public String getAvailabilityZone() { + return availabilityZone; + } + + /** + * Date-time when resource was created. + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public Backup description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Description Object. Allows string up to 255 Characters. + * + * @return description + */ + @javax.annotation.Nullable public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + /** + * Indicates if a volume is encrypted. + * + * @return encrypted + */ + @javax.annotation.Nullable public Boolean getEncrypted() { + return encrypted; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + public Backup labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public Backup name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nullable public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * Size in Gigabyte. + * + * @return size + */ + @javax.annotation.Nullable public Long getSize() { + return size; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return snapshotId + */ + @javax.annotation.Nullable public UUID getSnapshotId() { + return snapshotId; + } + + /** + * The status of a backup object. Possible values: `AVAILABLE`, `CREATING`, + * `DELETED`, `DELETING`, `ERROR`, `RESTORING`. + * + * @return status + */ + @javax.annotation.Nullable public String getStatus() { + return status; + } + + /** + * Date-time when resource was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nullable public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return volumeId + */ + @javax.annotation.Nullable public UUID getVolumeId() { + return volumeId; + } + + /** + * 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 Backup instance itself + */ + public Backup 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; + } + Backup backup = (Backup) o; + return Objects.equals(this.availabilityZone, backup.availabilityZone) + && Objects.equals(this.createdAt, backup.createdAt) + && Objects.equals(this.description, backup.description) + && Objects.equals(this.encrypted, backup.encrypted) + && Objects.equals(this.id, backup.id) + && Objects.equals(this.labels, backup.labels) + && Objects.equals(this.name, backup.name) + && Objects.equals(this.size, backup.size) + && Objects.equals(this.snapshotId, backup.snapshotId) + && Objects.equals(this.status, backup.status) + && Objects.equals(this.updatedAt, backup.updatedAt) + && Objects.equals(this.volumeId, backup.volumeId) + && Objects.equals(this.additionalProperties, backup.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + availabilityZone, + createdAt, + description, + encrypted, + id, + labels, + name, + size, + snapshotId, + status, + updatedAt, + volumeId, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Backup {\n"); + sb.append(" availabilityZone: ").append(toIndentedString(availabilityZone)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" encrypted: ").append(toIndentedString(encrypted)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" snapshotId: ").append(toIndentedString(snapshotId)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" volumeId: ").append(toIndentedString(volumeId)).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( + "availabilityZone", + "createdAt", + "description", + "encrypted", + "id", + "labels", + "name", + "size", + "snapshotId", + "status", + "updatedAt", + "volumeId")); + + // 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 Backup + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Backup.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 Backup is not found in the empty JSON string", + Backup.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("availabilityZone") != null + && !jsonObj.get("availabilityZone").isJsonNull()) + && !jsonObj.get("availabilityZone").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `availabilityZone` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("availabilityZone").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `description` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("description").toString())); + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `name` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("name").toString())); + } + if ((jsonObj.get("snapshotId") != null && !jsonObj.get("snapshotId").isJsonNull()) + && !jsonObj.get("snapshotId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `snapshotId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("snapshotId").toString())); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) + && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `status` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("status").toString())); + } + if ((jsonObj.get("volumeId") != null && !jsonObj.get("volumeId").isJsonNull()) + && !jsonObj.get("volumeId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `volumeId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("volumeId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Backup.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Backup' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(Backup.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, Backup 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 Backup read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Backup 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 Backup given an JSON string + * + * @param jsonString JSON string + * @return An instance of Backup + * @throws IOException if the JSON string is invalid with respect to Backup + */ + public static Backup fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Backup.class); + } + + /** + * Convert an instance of Backup to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/BackupListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/BackupListResponse.java new file mode 100644 index 00000000..7f020011 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/BackupListResponse.java @@ -0,0 +1,326 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** Backup list response. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class BackupListResponse { + public static final String SERIALIZED_NAME_ITEMS = "items"; + + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public BackupListResponse() {} + + public BackupListResponse items(@javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public BackupListResponse addItemsItem(Backup itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list containing backup objects. + * + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the BackupListResponse instance itself + */ + public BackupListResponse 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; + } + BackupListResponse backupListResponse = (BackupListResponse) o; + return Objects.equals(this.items, backupListResponse.items) + && Objects.equals( + this.additionalProperties, backupListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BackupListResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("items")); + } + + /** + * 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 BackupListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BackupListResponse.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 BackupListResponse is not found in the empty JSON string", + BackupListResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BackupListResponse.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("items").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `items` to be an array in the JSON string but got `%s`", + jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + Backup.validateJsonElement(jsonArrayitems.get(i)); + } + ; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BackupListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BackupListResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(BackupListResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, BackupListResponse 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 BackupListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + BackupListResponse 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 BackupListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of BackupListResponse + * @throws IOException if the JSON string is invalid with respect to BackupListResponse + */ + public static BackupListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BackupListResponse.class); + } + + /** + * Convert an instance of BackupListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/BackupSource.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/BackupSource.java new file mode 100644 index 00000000..bbeb1d34 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/BackupSource.java @@ -0,0 +1,341 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.v1api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +/** The source object of a backup. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class BackupSource { + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private UUID id; + + public static final String SERIALIZED_NAME_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private String type; + + public BackupSource() {} + + public BackupSource id(@javax.annotation.Nonnull UUID id) { + this.id = id; + return this; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nonnull + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull UUID id) { + this.id = id; + } + + public BackupSource type(@javax.annotation.Nonnull String type) { + this.type = type; + return this; + } + + /** + * The source types of a backup. Possible values: `volume`, `snapshot`. + * + * @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 BackupSource instance itself + */ + public BackupSource 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; + } + BackupSource backupSource = (BackupSource) o; + return Objects.equals(this.id, backupSource.id) + && Objects.equals(this.type, backupSource.type) + && Objects.equals(this.additionalProperties, backupSource.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BackupSource {\n"); + sb.append(" id: ").append(toIndentedString(id)).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("id", "type")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("id", "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 BackupSource + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BackupSource.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 BackupSource is not found in the empty JSON string", + BackupSource.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BackupSource.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("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if (!jsonObj.get("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 (!BackupSource.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BackupSource' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(BackupSource.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, BackupSource 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 BackupSource read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + BackupSource 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 BackupSource given an JSON string + * + * @param jsonString JSON string + * @return An instance of BackupSource + * @throws IOException if the JSON string is invalid with respect to BackupSource + */ + public static BackupSource fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BackupSource.class); + } + + /** + * Convert an instance of BackupSource to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/BaseSecurityGroupRule.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/BaseSecurityGroupRule.java new file mode 100644 index 00000000..d8c8bcb8 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/BaseSecurityGroupRule.java @@ -0,0 +1,622 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; +import java.util.UUID; + +/** The base schema for a security group rule. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class BaseSecurityGroupRule { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable private String description; + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + + @SerializedName(SERIALIZED_NAME_DIRECTION) + @javax.annotation.Nonnull + private String direction; + + public static final String SERIALIZED_NAME_ETHERTYPE = "ethertype"; + + @SerializedName(SERIALIZED_NAME_ETHERTYPE) + @javax.annotation.Nullable private String ethertype = "IPv4"; + + public static final String SERIALIZED_NAME_ICMP_PARAMETERS = "icmpParameters"; + + @SerializedName(SERIALIZED_NAME_ICMP_PARAMETERS) + @javax.annotation.Nullable private ICMPParameters icmpParameters; + + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_IP_RANGE = "ipRange"; + + @SerializedName(SERIALIZED_NAME_IP_RANGE) + @javax.annotation.Nullable private String ipRange; + + public static final String SERIALIZED_NAME_PORT_RANGE = "portRange"; + + @SerializedName(SERIALIZED_NAME_PORT_RANGE) + @javax.annotation.Nullable private PortRange portRange; + + public static final String SERIALIZED_NAME_REMOTE_SECURITY_GROUP_ID = "remoteSecurityGroupId"; + + @SerializedName(SERIALIZED_NAME_REMOTE_SECURITY_GROUP_ID) + @javax.annotation.Nullable private UUID remoteSecurityGroupId; + + public static final String SERIALIZED_NAME_SECURITY_GROUP_ID = "securityGroupId"; + + @SerializedName(SERIALIZED_NAME_SECURITY_GROUP_ID) + @javax.annotation.Nullable private UUID securityGroupId; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable private OffsetDateTime updatedAt; + + public BaseSecurityGroupRule() {} + + public BaseSecurityGroupRule( + OffsetDateTime createdAt, UUID id, UUID securityGroupId, OffsetDateTime updatedAt) { + this(); + this.createdAt = createdAt; + this.id = id; + this.securityGroupId = securityGroupId; + this.updatedAt = updatedAt; + } + + /** + * Date-time when resource was created. + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public BaseSecurityGroupRule description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Description Object. Allows string up to 255 Characters. + * + * @return description + */ + @javax.annotation.Nullable public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + public BaseSecurityGroupRule direction(@javax.annotation.Nonnull String direction) { + this.direction = direction; + return this; + } + + /** + * The direction of the traffic which the rule should match. Possible values: + * `ingress`, `egress`. + * + * @return direction + */ + @javax.annotation.Nonnull + public String getDirection() { + return direction; + } + + public void setDirection(@javax.annotation.Nonnull String direction) { + this.direction = direction; + } + + public BaseSecurityGroupRule ethertype(@javax.annotation.Nullable String ethertype) { + this.ethertype = ethertype; + return this; + } + + /** + * The ethertype which the rule should match. Possible values: `IPv4`, + * `IPv6`. + * + * @return ethertype + */ + @javax.annotation.Nullable public String getEthertype() { + return ethertype; + } + + public void setEthertype(@javax.annotation.Nullable String ethertype) { + this.ethertype = ethertype; + } + + public BaseSecurityGroupRule icmpParameters( + @javax.annotation.Nullable ICMPParameters icmpParameters) { + this.icmpParameters = icmpParameters; + return this; + } + + /** + * Get icmpParameters + * + * @return icmpParameters + */ + @javax.annotation.Nullable public ICMPParameters getIcmpParameters() { + return icmpParameters; + } + + public void setIcmpParameters(@javax.annotation.Nullable ICMPParameters icmpParameters) { + this.icmpParameters = icmpParameters; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + public BaseSecurityGroupRule ipRange(@javax.annotation.Nullable String ipRange) { + this.ipRange = ipRange; + return this; + } + + /** + * The remote IP range which the rule should match. + * + * @return ipRange + */ + @javax.annotation.Nullable public String getIpRange() { + return ipRange; + } + + public void setIpRange(@javax.annotation.Nullable String ipRange) { + this.ipRange = ipRange; + } + + public BaseSecurityGroupRule portRange(@javax.annotation.Nullable PortRange portRange) { + this.portRange = portRange; + return this; + } + + /** + * Get portRange + * + * @return portRange + */ + @javax.annotation.Nullable public PortRange getPortRange() { + return portRange; + } + + public void setPortRange(@javax.annotation.Nullable PortRange portRange) { + this.portRange = portRange; + } + + public BaseSecurityGroupRule remoteSecurityGroupId( + @javax.annotation.Nullable UUID remoteSecurityGroupId) { + this.remoteSecurityGroupId = remoteSecurityGroupId; + return this; + } + + /** + * The remote security group which the rule should match. + * + * @return remoteSecurityGroupId + */ + @javax.annotation.Nullable public UUID getRemoteSecurityGroupId() { + return remoteSecurityGroupId; + } + + public void setRemoteSecurityGroupId(@javax.annotation.Nullable UUID remoteSecurityGroupId) { + this.remoteSecurityGroupId = remoteSecurityGroupId; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return securityGroupId + */ + @javax.annotation.Nullable public UUID getSecurityGroupId() { + return securityGroupId; + } + + /** + * Date-time when resource was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nullable public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * 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 BaseSecurityGroupRule instance itself + */ + public BaseSecurityGroupRule 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; + } + BaseSecurityGroupRule baseSecurityGroupRule = (BaseSecurityGroupRule) o; + return Objects.equals(this.createdAt, baseSecurityGroupRule.createdAt) + && Objects.equals(this.description, baseSecurityGroupRule.description) + && Objects.equals(this.direction, baseSecurityGroupRule.direction) + && Objects.equals(this.ethertype, baseSecurityGroupRule.ethertype) + && Objects.equals(this.icmpParameters, baseSecurityGroupRule.icmpParameters) + && Objects.equals(this.id, baseSecurityGroupRule.id) + && Objects.equals(this.ipRange, baseSecurityGroupRule.ipRange) + && Objects.equals(this.portRange, baseSecurityGroupRule.portRange) + && Objects.equals( + this.remoteSecurityGroupId, baseSecurityGroupRule.remoteSecurityGroupId) + && Objects.equals(this.securityGroupId, baseSecurityGroupRule.securityGroupId) + && Objects.equals(this.updatedAt, baseSecurityGroupRule.updatedAt) + && Objects.equals( + this.additionalProperties, baseSecurityGroupRule.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + createdAt, + description, + direction, + ethertype, + icmpParameters, + id, + ipRange, + portRange, + remoteSecurityGroupId, + securityGroupId, + updatedAt, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BaseSecurityGroupRule {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" ethertype: ").append(toIndentedString(ethertype)).append("\n"); + sb.append(" icmpParameters: ").append(toIndentedString(icmpParameters)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" ipRange: ").append(toIndentedString(ipRange)).append("\n"); + sb.append(" portRange: ").append(toIndentedString(portRange)).append("\n"); + sb.append(" remoteSecurityGroupId: ") + .append(toIndentedString(remoteSecurityGroupId)) + .append("\n"); + sb.append(" securityGroupId: ").append(toIndentedString(securityGroupId)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).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( + "createdAt", + "description", + "direction", + "ethertype", + "icmpParameters", + "id", + "ipRange", + "portRange", + "remoteSecurityGroupId", + "securityGroupId", + "updatedAt")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("direction")); + } + + /** + * 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 BaseSecurityGroupRule + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BaseSecurityGroupRule.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 BaseSecurityGroupRule is not found in the empty JSON string", + BaseSecurityGroupRule.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BaseSecurityGroupRule.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("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `description` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("description").toString())); + } + if (!jsonObj.get("direction").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `direction` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("direction").toString())); + } + if ((jsonObj.get("ethertype") != null && !jsonObj.get("ethertype").isJsonNull()) + && !jsonObj.get("ethertype").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `ethertype` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("ethertype").toString())); + } + // validate the optional field `icmpParameters` + if (jsonObj.get("icmpParameters") != null && !jsonObj.get("icmpParameters").isJsonNull()) { + ICMPParameters.validateJsonElement(jsonObj.get("icmpParameters")); + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if ((jsonObj.get("ipRange") != null && !jsonObj.get("ipRange").isJsonNull()) + && !jsonObj.get("ipRange").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `ipRange` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("ipRange").toString())); + } + // validate the optional field `portRange` + if (jsonObj.get("portRange") != null && !jsonObj.get("portRange").isJsonNull()) { + PortRange.validateJsonElement(jsonObj.get("portRange")); + } + if ((jsonObj.get("remoteSecurityGroupId") != null + && !jsonObj.get("remoteSecurityGroupId").isJsonNull()) + && !jsonObj.get("remoteSecurityGroupId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `remoteSecurityGroupId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("remoteSecurityGroupId").toString())); + } + if ((jsonObj.get("securityGroupId") != null && !jsonObj.get("securityGroupId").isJsonNull()) + && !jsonObj.get("securityGroupId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `securityGroupId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("securityGroupId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BaseSecurityGroupRule.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BaseSecurityGroupRule' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(BaseSecurityGroupRule.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, BaseSecurityGroupRule 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 BaseSecurityGroupRule read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + BaseSecurityGroupRule 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 BaseSecurityGroupRule given an JSON string + * + * @param jsonString JSON string + * @return An instance of BaseSecurityGroupRule + * @throws IOException if the JSON string is invalid with respect to BaseSecurityGroupRule + */ + public static BaseSecurityGroupRule fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BaseSecurityGroupRule.class); + } + + /** + * Convert an instance of BaseSecurityGroupRule to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/BootVolume.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/BootVolume.java new file mode 100644 index 00000000..beb9d443 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/BootVolume.java @@ -0,0 +1,409 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.v1api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +/** The boot device for the server. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class BootVolume { + public static final String SERIALIZED_NAME_DELETE_ON_TERMINATION = "deleteOnTermination"; + + @SerializedName(SERIALIZED_NAME_DELETE_ON_TERMINATION) + @javax.annotation.Nullable private Boolean deleteOnTermination; + + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_PERFORMANCE_CLASS = "performanceClass"; + + @SerializedName(SERIALIZED_NAME_PERFORMANCE_CLASS) + @javax.annotation.Nullable private String performanceClass; + + public static final String SERIALIZED_NAME_SIZE = "size"; + + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nullable private Long size; + + public static final String SERIALIZED_NAME_SOURCE = "source"; + + @SerializedName(SERIALIZED_NAME_SOURCE) + @javax.annotation.Nullable private BootVolumeSource source; + + public BootVolume() {} + + public BootVolume(UUID id) { + this(); + this.id = id; + } + + public BootVolume deleteOnTermination(@javax.annotation.Nullable Boolean deleteOnTermination) { + this.deleteOnTermination = deleteOnTermination; + return this; + } + + /** + * Delete the volume during the termination of the server. Defaults to false. + * + * @return deleteOnTermination + */ + @javax.annotation.Nullable public Boolean getDeleteOnTermination() { + return deleteOnTermination; + } + + public void setDeleteOnTermination(@javax.annotation.Nullable Boolean deleteOnTermination) { + this.deleteOnTermination = deleteOnTermination; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + public BootVolume performanceClass(@javax.annotation.Nullable String performanceClass) { + this.performanceClass = performanceClass; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return performanceClass + */ + @javax.annotation.Nullable public String getPerformanceClass() { + return performanceClass; + } + + public void setPerformanceClass(@javax.annotation.Nullable String performanceClass) { + this.performanceClass = performanceClass; + } + + public BootVolume size(@javax.annotation.Nullable Long size) { + this.size = size; + return this; + } + + /** + * Size in Gigabyte. + * + * @return size + */ + @javax.annotation.Nullable public Long getSize() { + return size; + } + + public void setSize(@javax.annotation.Nullable Long size) { + this.size = size; + } + + public BootVolume source(@javax.annotation.Nullable BootVolumeSource source) { + this.source = source; + return this; + } + + /** + * Get source + * + * @return source + */ + @javax.annotation.Nullable public BootVolumeSource getSource() { + return source; + } + + public void setSource(@javax.annotation.Nullable BootVolumeSource source) { + this.source = source; + } + + /** + * 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 BootVolume instance itself + */ + public BootVolume 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; + } + BootVolume bootVolume = (BootVolume) o; + return Objects.equals(this.deleteOnTermination, bootVolume.deleteOnTermination) + && Objects.equals(this.id, bootVolume.id) + && Objects.equals(this.performanceClass, bootVolume.performanceClass) + && Objects.equals(this.size, bootVolume.size) + && Objects.equals(this.source, bootVolume.source) + && Objects.equals(this.additionalProperties, bootVolume.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + deleteOnTermination, id, performanceClass, size, source, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BootVolume {\n"); + sb.append(" deleteOnTermination: ") + .append(toIndentedString(deleteOnTermination)) + .append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" performanceClass: ").append(toIndentedString(performanceClass)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" source: ").append(toIndentedString(source)).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( + "deleteOnTermination", "id", "performanceClass", "size", "source")); + + // 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 BootVolume + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BootVolume.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 BootVolume is not found in the empty JSON string", + BootVolume.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if ((jsonObj.get("performanceClass") != null + && !jsonObj.get("performanceClass").isJsonNull()) + && !jsonObj.get("performanceClass").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `performanceClass` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("performanceClass").toString())); + } + // validate the optional field `source` + if (jsonObj.get("source") != null && !jsonObj.get("source").isJsonNull()) { + BootVolumeSource.validateJsonElement(jsonObj.get("source")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BootVolume.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BootVolume' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(BootVolume.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, BootVolume 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 BootVolume read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + BootVolume 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 BootVolume given an JSON string + * + * @param jsonString JSON string + * @return An instance of BootVolume + * @throws IOException if the JSON string is invalid with respect to BootVolume + */ + public static BootVolume fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BootVolume.class); + } + + /** + * Convert an instance of BootVolume to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/BootVolumeSource.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/BootVolumeSource.java new file mode 100644 index 00000000..38bce2a2 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/BootVolumeSource.java @@ -0,0 +1,342 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.v1api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +/** The source object of a boot volume. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class BootVolumeSource { + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private UUID id; + + public static final String SERIALIZED_NAME_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private String type; + + public BootVolumeSource() {} + + public BootVolumeSource id(@javax.annotation.Nonnull UUID id) { + this.id = id; + return this; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nonnull + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull UUID id) { + this.id = id; + } + + public BootVolumeSource type(@javax.annotation.Nonnull String type) { + this.type = type; + return this; + } + + /** + * The source types of a boot volume. Possible values: `image`, `volume`. + * + * @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 BootVolumeSource instance itself + */ + public BootVolumeSource 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; + } + BootVolumeSource bootVolumeSource = (BootVolumeSource) o; + return Objects.equals(this.id, bootVolumeSource.id) + && Objects.equals(this.type, bootVolumeSource.type) + && Objects.equals(this.additionalProperties, bootVolumeSource.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BootVolumeSource {\n"); + sb.append(" id: ").append(toIndentedString(id)).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("id", "type")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("id", "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 BootVolumeSource + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BootVolumeSource.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 BootVolumeSource is not found in the empty JSON string", + BootVolumeSource.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BootVolumeSource.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("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if (!jsonObj.get("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 (!BootVolumeSource.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BootVolumeSource' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(BootVolumeSource.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, BootVolumeSource 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 BootVolumeSource read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + BootVolumeSource 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 BootVolumeSource given an JSON string + * + * @param jsonString JSON string + * @return An instance of BootVolumeSource + * @throws IOException if the JSON string is invalid with respect to BootVolumeSource + */ + public static BootVolumeSource fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BootVolumeSource.class); + } + + /** + * Convert an instance of BootVolumeSource to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateAffinityGroupPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateAffinityGroupPayload.java new file mode 100644 index 00000000..03216c01 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateAffinityGroupPayload.java @@ -0,0 +1,407 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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.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; +import java.util.UUID; + +/** Definition of an affinity group. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateAffinityGroupPayload { + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_MEMBERS = "members"; + + @SerializedName(SERIALIZED_NAME_MEMBERS) + @javax.annotation.Nullable private List members = new ArrayList<>(); + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_POLICY = "policy"; + + @SerializedName(SERIALIZED_NAME_POLICY) + @javax.annotation.Nonnull + private String policy; + + public CreateAffinityGroupPayload() {} + + public CreateAffinityGroupPayload(UUID id, List members) { + this(); + this.id = id; + this.members = members; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + /** + * The servers that are part of the affinity group. + * + * @return members + */ + @javax.annotation.Nullable public List getMembers() { + return members; + } + + public CreateAffinityGroupPayload name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + public CreateAffinityGroupPayload policy(@javax.annotation.Nonnull String policy) { + this.policy = policy; + return this; + } + + /** + * The affinity group policy. `hard-affinity`: All servers in this group will be + * hosted on the same compute node. `soft-affinity`: All servers in this group will be + * hosted on as few compute nodes as possible. `hard-anti-affinity`: All servers in + * this group will be hosted on different compute nodes. `soft-anti-affinity`: All + * servers in this group will be hosted on as many compute nodes as possible. Possible values: + * `hard-anti-affinity`, `hard-affinity`, `soft-anti-affinity`, + * `soft-affinity`. + * + * @return policy + */ + @javax.annotation.Nonnull + public String getPolicy() { + return policy; + } + + public void setPolicy(@javax.annotation.Nonnull String policy) { + this.policy = policy; + } + + /** + * 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 CreateAffinityGroupPayload instance itself + */ + public CreateAffinityGroupPayload 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; + } + CreateAffinityGroupPayload createAffinityGroupPayload = (CreateAffinityGroupPayload) o; + return Objects.equals(this.id, createAffinityGroupPayload.id) + && Objects.equals(this.members, createAffinityGroupPayload.members) + && Objects.equals(this.name, createAffinityGroupPayload.name) + && Objects.equals(this.policy, createAffinityGroupPayload.policy) + && Objects.equals( + this.additionalProperties, createAffinityGroupPayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, members, name, policy, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateAffinityGroupPayload {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" members: ").append(toIndentedString(members)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" policy: ").append(toIndentedString(policy)).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("id", "members", "name", "policy")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name", "policy")); + } + + /** + * 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 CreateAffinityGroupPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateAffinityGroupPayload.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 CreateAffinityGroupPayload is not found in the empty JSON string", + CreateAffinityGroupPayload.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateAffinityGroupPayload.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("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("members") != null + && !jsonObj.get("members").isJsonNull() + && !jsonObj.get("members").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `members` to be an array in the JSON string but got `%s`", + jsonObj.get("members").toString())); + } + 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("policy").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `policy` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("policy").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateAffinityGroupPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateAffinityGroupPayload' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateAffinityGroupPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateAffinityGroupPayload 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 CreateAffinityGroupPayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateAffinityGroupPayload 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 CreateAffinityGroupPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateAffinityGroupPayload + * @throws IOException if the JSON string is invalid with respect to CreateAffinityGroupPayload + */ + public static CreateAffinityGroupPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateAffinityGroupPayload.class); + } + + /** + * Convert an instance of CreateAffinityGroupPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateAreaAddressFamily.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateAreaAddressFamily.java new file mode 100644 index 00000000..cca3cc08 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateAreaAddressFamily.java @@ -0,0 +1,292 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** The addressFamily object for a area create request. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateAreaAddressFamily { + public static final String SERIALIZED_NAME_IPV4 = "ipv4"; + + @SerializedName(SERIALIZED_NAME_IPV4) + @javax.annotation.Nullable private CreateAreaIPv4 ipv4; + + public CreateAreaAddressFamily() {} + + public CreateAreaAddressFamily ipv4(@javax.annotation.Nullable CreateAreaIPv4 ipv4) { + this.ipv4 = ipv4; + return this; + } + + /** + * Get ipv4 + * + * @return ipv4 + */ + @javax.annotation.Nullable public CreateAreaIPv4 getIpv4() { + return ipv4; + } + + public void setIpv4(@javax.annotation.Nullable CreateAreaIPv4 ipv4) { + this.ipv4 = ipv4; + } + + /** + * 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 CreateAreaAddressFamily instance itself + */ + public CreateAreaAddressFamily 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; + } + CreateAreaAddressFamily createAreaAddressFamily = (CreateAreaAddressFamily) o; + return Objects.equals(this.ipv4, createAreaAddressFamily.ipv4) + && Objects.equals( + this.additionalProperties, createAreaAddressFamily.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(ipv4, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateAreaAddressFamily {\n"); + sb.append(" ipv4: ").append(toIndentedString(ipv4)).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("ipv4")); + + // 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 CreateAreaAddressFamily + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateAreaAddressFamily.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 CreateAreaAddressFamily is not found in the empty JSON string", + CreateAreaAddressFamily.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `ipv4` + if (jsonObj.get("ipv4") != null && !jsonObj.get("ipv4").isJsonNull()) { + CreateAreaIPv4.validateJsonElement(jsonObj.get("ipv4")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateAreaAddressFamily.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateAreaAddressFamily' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateAreaAddressFamily.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateAreaAddressFamily 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 CreateAreaAddressFamily read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateAreaAddressFamily 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 CreateAreaAddressFamily given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateAreaAddressFamily + * @throws IOException if the JSON string is invalid with respect to CreateAreaAddressFamily + */ + public static CreateAreaAddressFamily fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateAreaAddressFamily.class); + } + + /** + * Convert an instance of CreateAreaAddressFamily to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateAreaIPv4.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateAreaIPv4.java new file mode 100644 index 00000000..6ec1c03b --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateAreaIPv4.java @@ -0,0 +1,550 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** The config object for a IPv4 network area. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateAreaIPv4 { + public static final String SERIALIZED_NAME_DEFAULT_NAMESERVERS = "defaultNameservers"; + + @SerializedName(SERIALIZED_NAME_DEFAULT_NAMESERVERS) + @javax.annotation.Nullable private List defaultNameservers = new ArrayList<>(); + + public static final String SERIALIZED_NAME_NETWORK_RANGES = "networkRanges"; + + @SerializedName(SERIALIZED_NAME_NETWORK_RANGES) + @javax.annotation.Nonnull + private List networkRanges = new ArrayList<>(); + + public static final String SERIALIZED_NAME_ROUTES = "routes"; + + @SerializedName(SERIALIZED_NAME_ROUTES) + @javax.annotation.Nullable private List routes = new ArrayList<>(); + + public static final String SERIALIZED_NAME_TRANSFER_NETWORK = "transferNetwork"; + + @SerializedName(SERIALIZED_NAME_TRANSFER_NETWORK) + @javax.annotation.Nonnull + private String transferNetwork; + + public static final String SERIALIZED_NAME_DEFAULT_PREFIX_LEN = "defaultPrefixLen"; + + @SerializedName(SERIALIZED_NAME_DEFAULT_PREFIX_LEN) + @javax.annotation.Nullable private Integer defaultPrefixLen = 25; + + public static final String SERIALIZED_NAME_MAX_PREFIX_LEN = "maxPrefixLen"; + + @SerializedName(SERIALIZED_NAME_MAX_PREFIX_LEN) + @javax.annotation.Nullable private Integer maxPrefixLen = 29; + + public static final String SERIALIZED_NAME_MIN_PREFIX_LEN = "minPrefixLen"; + + @SerializedName(SERIALIZED_NAME_MIN_PREFIX_LEN) + @javax.annotation.Nullable private Integer minPrefixLen = 24; + + public CreateAreaIPv4() {} + + public CreateAreaIPv4 defaultNameservers( + @javax.annotation.Nullable List defaultNameservers) { + this.defaultNameservers = defaultNameservers; + return this; + } + + public CreateAreaIPv4 addDefaultNameserversItem(String defaultNameserversItem) { + if (this.defaultNameservers == null) { + this.defaultNameservers = new ArrayList<>(); + } + this.defaultNameservers.add(defaultNameserversItem); + return this; + } + + /** + * Get defaultNameservers + * + * @return defaultNameservers + */ + @javax.annotation.Nullable public List getDefaultNameservers() { + return defaultNameservers; + } + + public void setDefaultNameservers(@javax.annotation.Nullable List defaultNameservers) { + this.defaultNameservers = defaultNameservers; + } + + public CreateAreaIPv4 networkRanges( + @javax.annotation.Nonnull List networkRanges) { + this.networkRanges = networkRanges; + return this; + } + + public CreateAreaIPv4 addNetworkRangesItem(NetworkRange networkRangesItem) { + if (this.networkRanges == null) { + this.networkRanges = new ArrayList<>(); + } + this.networkRanges.add(networkRangesItem); + return this; + } + + /** + * A list of network ranges. + * + * @return networkRanges + */ + @javax.annotation.Nonnull + public List getNetworkRanges() { + return networkRanges; + } + + public void setNetworkRanges(@javax.annotation.Nonnull List networkRanges) { + this.networkRanges = networkRanges; + } + + public CreateAreaIPv4 routes(@javax.annotation.Nullable List routes) { + this.routes = routes; + return this; + } + + public CreateAreaIPv4 addRoutesItem(Route routesItem) { + if (this.routes == null) { + this.routes = new ArrayList<>(); + } + this.routes.add(routesItem); + return this; + } + + /** + * A list of routes. + * + * @return routes + */ + @javax.annotation.Nullable public List getRoutes() { + return routes; + } + + public void setRoutes(@javax.annotation.Nullable List routes) { + this.routes = routes; + } + + public CreateAreaIPv4 transferNetwork(@javax.annotation.Nonnull String transferNetwork) { + this.transferNetwork = transferNetwork; + return this; + } + + /** + * Classless Inter-Domain Routing (CIDR). + * + * @return transferNetwork + */ + @javax.annotation.Nonnull + public String getTransferNetwork() { + return transferNetwork; + } + + public void setTransferNetwork(@javax.annotation.Nonnull String transferNetwork) { + this.transferNetwork = transferNetwork; + } + + public CreateAreaIPv4 defaultPrefixLen(@javax.annotation.Nullable Integer defaultPrefixLen) { + this.defaultPrefixLen = defaultPrefixLen; + return this; + } + + /** + * The default prefix length for networks in the network area. minimum: 24 maximum: 29 + * + * @return defaultPrefixLen + */ + @javax.annotation.Nullable public Integer getDefaultPrefixLen() { + return defaultPrefixLen; + } + + public void setDefaultPrefixLen(@javax.annotation.Nullable Integer defaultPrefixLen) { + this.defaultPrefixLen = defaultPrefixLen; + } + + public CreateAreaIPv4 maxPrefixLen(@javax.annotation.Nullable Integer maxPrefixLen) { + this.maxPrefixLen = maxPrefixLen; + return this; + } + + /** + * The maximal prefix length for networks in the network area. minimum: 24 maximum: 29 + * + * @return maxPrefixLen + */ + @javax.annotation.Nullable public Integer getMaxPrefixLen() { + return maxPrefixLen; + } + + public void setMaxPrefixLen(@javax.annotation.Nullable Integer maxPrefixLen) { + this.maxPrefixLen = maxPrefixLen; + } + + public CreateAreaIPv4 minPrefixLen(@javax.annotation.Nullable Integer minPrefixLen) { + this.minPrefixLen = minPrefixLen; + return this; + } + + /** + * The minimal prefix length for networks in the network area. minimum: 8 maximum: 29 + * + * @return minPrefixLen + */ + @javax.annotation.Nullable public Integer getMinPrefixLen() { + return minPrefixLen; + } + + public void setMinPrefixLen(@javax.annotation.Nullable Integer minPrefixLen) { + this.minPrefixLen = minPrefixLen; + } + + /** + * 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 CreateAreaIPv4 instance itself + */ + public CreateAreaIPv4 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; + } + CreateAreaIPv4 createAreaIPv4 = (CreateAreaIPv4) o; + return Objects.equals(this.defaultNameservers, createAreaIPv4.defaultNameservers) + && Objects.equals(this.networkRanges, createAreaIPv4.networkRanges) + && Objects.equals(this.routes, createAreaIPv4.routes) + && Objects.equals(this.transferNetwork, createAreaIPv4.transferNetwork) + && Objects.equals(this.defaultPrefixLen, createAreaIPv4.defaultPrefixLen) + && Objects.equals(this.maxPrefixLen, createAreaIPv4.maxPrefixLen) + && Objects.equals(this.minPrefixLen, createAreaIPv4.minPrefixLen) + && Objects.equals(this.additionalProperties, createAreaIPv4.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + defaultNameservers, + networkRanges, + routes, + transferNetwork, + defaultPrefixLen, + maxPrefixLen, + minPrefixLen, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateAreaIPv4 {\n"); + sb.append(" defaultNameservers: ") + .append(toIndentedString(defaultNameservers)) + .append("\n"); + sb.append(" networkRanges: ").append(toIndentedString(networkRanges)).append("\n"); + sb.append(" routes: ").append(toIndentedString(routes)).append("\n"); + sb.append(" transferNetwork: ").append(toIndentedString(transferNetwork)).append("\n"); + sb.append(" defaultPrefixLen: ").append(toIndentedString(defaultPrefixLen)).append("\n"); + sb.append(" maxPrefixLen: ").append(toIndentedString(maxPrefixLen)).append("\n"); + sb.append(" minPrefixLen: ").append(toIndentedString(minPrefixLen)).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( + "defaultNameservers", + "networkRanges", + "routes", + "transferNetwork", + "defaultPrefixLen", + "maxPrefixLen", + "minPrefixLen")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = + new HashSet(Arrays.asList("networkRanges", "transferNetwork")); + } + + /** + * 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 CreateAreaIPv4 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateAreaIPv4.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 CreateAreaIPv4 is not found in the empty JSON string", + CreateAreaIPv4.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateAreaIPv4.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 optional json data is an array if present + if (jsonObj.get("defaultNameservers") != null + && !jsonObj.get("defaultNameservers").isJsonNull() + && !jsonObj.get("defaultNameservers").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `defaultNameservers` to be an array in the JSON string but got `%s`", + jsonObj.get("defaultNameservers").toString())); + } + // ensure the json data is an array + if (!jsonObj.get("networkRanges").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `networkRanges` to be an array in the JSON string but got `%s`", + jsonObj.get("networkRanges").toString())); + } + + JsonArray jsonArraynetworkRanges = jsonObj.getAsJsonArray("networkRanges"); + // validate the required field `networkRanges` (array) + for (int i = 0; i < jsonArraynetworkRanges.size(); i++) { + NetworkRange.validateJsonElement(jsonArraynetworkRanges.get(i)); + } + ; + if (jsonObj.get("routes") != null && !jsonObj.get("routes").isJsonNull()) { + JsonArray jsonArrayroutes = jsonObj.getAsJsonArray("routes"); + if (jsonArrayroutes != null) { + // ensure the json data is an array + if (!jsonObj.get("routes").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `routes` to be an array in the JSON string but got `%s`", + jsonObj.get("routes").toString())); + } + + // validate the optional field `routes` (array) + for (int i = 0; i < jsonArrayroutes.size(); i++) { + Route.validateJsonElement(jsonArrayroutes.get(i)); + } + ; + } + } + if (!jsonObj.get("transferNetwork").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `transferNetwork` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("transferNetwork").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateAreaIPv4.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateAreaIPv4' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateAreaIPv4.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateAreaIPv4 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 CreateAreaIPv4 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateAreaIPv4 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 CreateAreaIPv4 given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateAreaIPv4 + * @throws IOException if the JSON string is invalid with respect to CreateAreaIPv4 + */ + public static CreateAreaIPv4 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateAreaIPv4.class); + } + + /** + * Convert an instance of CreateAreaIPv4 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateBackupPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateBackupPayload.java new file mode 100644 index 00000000..49fb23d6 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateBackupPayload.java @@ -0,0 +1,399 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** Object that represents a backup create request body. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateBackupPayload { + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable private String description; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; + + public static final String SERIALIZED_NAME_SOURCE = "source"; + + @SerializedName(SERIALIZED_NAME_SOURCE) + @javax.annotation.Nonnull + private BackupSource source; + + public CreateBackupPayload() {} + + public CreateBackupPayload description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Description Object. Allows string up to 255 Characters. + * + * @return description + */ + @javax.annotation.Nullable public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + public CreateBackupPayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public CreateBackupPayload name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nullable public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + public CreateBackupPayload source(@javax.annotation.Nonnull BackupSource source) { + this.source = source; + return this; + } + + /** + * Get source + * + * @return source + */ + @javax.annotation.Nonnull + public BackupSource getSource() { + return source; + } + + public void setSource(@javax.annotation.Nonnull BackupSource source) { + this.source = source; + } + + /** + * 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 CreateBackupPayload instance itself + */ + public CreateBackupPayload 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; + } + CreateBackupPayload createBackupPayload = (CreateBackupPayload) o; + return Objects.equals(this.description, createBackupPayload.description) + && Objects.equals(this.labels, createBackupPayload.labels) + && Objects.equals(this.name, createBackupPayload.name) + && Objects.equals(this.source, createBackupPayload.source) + && Objects.equals( + this.additionalProperties, createBackupPayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(description, labels, name, source, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateBackupPayload {\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" source: ").append(toIndentedString(source)).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("description", "labels", "name", "source")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("source")); + } + + /** + * 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 CreateBackupPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateBackupPayload.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 CreateBackupPayload is not found in the empty JSON string", + CreateBackupPayload.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateBackupPayload.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("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `description` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("description").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `name` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("name").toString())); + } + // validate the required field `source` + BackupSource.validateJsonElement(jsonObj.get("source")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateBackupPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateBackupPayload' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateBackupPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateBackupPayload 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 CreateBackupPayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateBackupPayload 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 CreateBackupPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateBackupPayload + * @throws IOException if the JSON string is invalid with respect to CreateBackupPayload + */ + public static CreateBackupPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateBackupPayload.class); + } + + /** + * Convert an instance of CreateBackupPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateImagePayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateImagePayload.java new file mode 100644 index 00000000..e48471b5 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateImagePayload.java @@ -0,0 +1,750 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; +import java.util.UUID; + +/** + * Object that represents an Image and its parameters. Used for Creating and returning (get/list). + */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateImagePayload { + public static final String SERIALIZED_NAME_AGENT = "agent"; + + @SerializedName(SERIALIZED_NAME_AGENT) + @javax.annotation.Nullable private ImageAgent agent; + + public static final String SERIALIZED_NAME_CHECKSUM = "checksum"; + + @SerializedName(SERIALIZED_NAME_CHECKSUM) + @javax.annotation.Nullable private ImageChecksum checksum; + + public static final String SERIALIZED_NAME_CONFIG = "config"; + + @SerializedName(SERIALIZED_NAME_CONFIG) + @javax.annotation.Nullable private ImageConfig config; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_DISK_FORMAT = "diskFormat"; + + @SerializedName(SERIALIZED_NAME_DISK_FORMAT) + @javax.annotation.Nonnull + private String diskFormat; + + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_IMPORT_PROGRESS = "importProgress"; + + @SerializedName(SERIALIZED_NAME_IMPORT_PROGRESS) + @javax.annotation.Nullable private Long importProgress; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_MIN_DISK_SIZE = "minDiskSize"; + + @SerializedName(SERIALIZED_NAME_MIN_DISK_SIZE) + @javax.annotation.Nullable private Long minDiskSize; + + public static final String SERIALIZED_NAME_MIN_RAM = "minRam"; + + @SerializedName(SERIALIZED_NAME_MIN_RAM) + @javax.annotation.Nullable private Long minRam; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_OWNER = "owner"; + + @SerializedName(SERIALIZED_NAME_OWNER) + @javax.annotation.Nullable private UUID owner; + + public static final String SERIALIZED_NAME_PROTECTED = "protected"; + + @SerializedName(SERIALIZED_NAME_PROTECTED) + @javax.annotation.Nullable private Boolean _protected; + + public static final String SERIALIZED_NAME_SCOPE = "scope"; + + @SerializedName(SERIALIZED_NAME_SCOPE) + @javax.annotation.Nullable private String scope; + + public static final String SERIALIZED_NAME_SIZE = "size"; + + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nullable private Long size; + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable private String status; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable private OffsetDateTime updatedAt; + + public CreateImagePayload() {} + + public CreateImagePayload( + ImageChecksum checksum, + OffsetDateTime createdAt, + UUID id, + Long importProgress, + UUID owner, + String scope, + Long size, + String status, + OffsetDateTime updatedAt) { + this(); + this.checksum = checksum; + this.createdAt = createdAt; + this.id = id; + this.importProgress = importProgress; + this.owner = owner; + this.scope = scope; + this.size = size; + this.status = status; + this.updatedAt = updatedAt; + } + + public CreateImagePayload agent(@javax.annotation.Nullable ImageAgent agent) { + this.agent = agent; + return this; + } + + /** + * Get agent + * + * @return agent + */ + @javax.annotation.Nullable public ImageAgent getAgent() { + return agent; + } + + public void setAgent(@javax.annotation.Nullable ImageAgent agent) { + this.agent = agent; + } + + /** + * Get checksum + * + * @return checksum + */ + @javax.annotation.Nullable public ImageChecksum getChecksum() { + return checksum; + } + + public CreateImagePayload config(@javax.annotation.Nullable ImageConfig config) { + this.config = config; + return this; + } + + /** + * Get config + * + * @return config + */ + @javax.annotation.Nullable public ImageConfig getConfig() { + return config; + } + + public void setConfig(@javax.annotation.Nullable ImageConfig config) { + this.config = config; + } + + /** + * Date-time when resource was created. + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public CreateImagePayload diskFormat(@javax.annotation.Nonnull String diskFormat) { + this.diskFormat = diskFormat; + return this; + } + + /** + * Object that represents a disk format. Possible values: `raw`, `qcow2`, + * `iso`. + * + * @return diskFormat + */ + @javax.annotation.Nonnull + public String getDiskFormat() { + return diskFormat; + } + + public void setDiskFormat(@javax.annotation.Nonnull String diskFormat) { + this.diskFormat = diskFormat; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + /** + * Indicates Image Import Progress in percent. + * + * @return importProgress + */ + @javax.annotation.Nullable public Long getImportProgress() { + return importProgress; + } + + public CreateImagePayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public CreateImagePayload minDiskSize(@javax.annotation.Nullable Long minDiskSize) { + this.minDiskSize = minDiskSize; + return this; + } + + /** + * Size in Gigabyte. + * + * @return minDiskSize + */ + @javax.annotation.Nullable public Long getMinDiskSize() { + return minDiskSize; + } + + public void setMinDiskSize(@javax.annotation.Nullable Long minDiskSize) { + this.minDiskSize = minDiskSize; + } + + public CreateImagePayload minRam(@javax.annotation.Nullable Long minRam) { + this.minRam = minRam; + return this; + } + + /** + * Size in Megabyte. + * + * @return minRam + */ + @javax.annotation.Nullable public Long getMinRam() { + return minRam; + } + + public void setMinRam(@javax.annotation.Nullable Long minRam) { + this.minRam = minRam; + } + + public CreateImagePayload name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return owner + */ + @javax.annotation.Nullable public UUID getOwner() { + return owner; + } + + public CreateImagePayload _protected(@javax.annotation.Nullable Boolean _protected) { + this._protected = _protected; + return this; + } + + /** + * When true the image is prevented from being deleted. + * + * @return _protected + */ + @javax.annotation.Nullable public Boolean getProtected() { + return _protected; + } + + public void setProtected(@javax.annotation.Nullable Boolean _protected) { + this._protected = _protected; + } + + /** + * Scope of an Image. Possible values: `public`, `local`, + * `projects`, `organization`. + * + * @return scope + */ + @javax.annotation.Nullable public String getScope() { + return scope; + } + + /** + * Size in bytes. + * + * @return size + */ + @javax.annotation.Nullable public Long getSize() { + return size; + } + + /** + * The status of an image object. Possible values: `AVAILABLE`, `CREATING`, + * `DEACTIVATED`, `DELETED`, `DELETING`, `ERROR`. + * + * @return status + */ + @javax.annotation.Nullable public String getStatus() { + return status; + } + + /** + * Date-time when resource was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nullable public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * 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 CreateImagePayload instance itself + */ + public CreateImagePayload 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; + } + CreateImagePayload createImagePayload = (CreateImagePayload) o; + return Objects.equals(this.agent, createImagePayload.agent) + && Objects.equals(this.checksum, createImagePayload.checksum) + && Objects.equals(this.config, createImagePayload.config) + && Objects.equals(this.createdAt, createImagePayload.createdAt) + && Objects.equals(this.diskFormat, createImagePayload.diskFormat) + && Objects.equals(this.id, createImagePayload.id) + && Objects.equals(this.importProgress, createImagePayload.importProgress) + && Objects.equals(this.labels, createImagePayload.labels) + && Objects.equals(this.minDiskSize, createImagePayload.minDiskSize) + && Objects.equals(this.minRam, createImagePayload.minRam) + && Objects.equals(this.name, createImagePayload.name) + && Objects.equals(this.owner, createImagePayload.owner) + && Objects.equals(this._protected, createImagePayload._protected) + && Objects.equals(this.scope, createImagePayload.scope) + && Objects.equals(this.size, createImagePayload.size) + && Objects.equals(this.status, createImagePayload.status) + && Objects.equals(this.updatedAt, createImagePayload.updatedAt) + && Objects.equals( + this.additionalProperties, createImagePayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + agent, + checksum, + config, + createdAt, + diskFormat, + id, + importProgress, + labels, + minDiskSize, + minRam, + name, + owner, + _protected, + scope, + size, + status, + updatedAt, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateImagePayload {\n"); + sb.append(" agent: ").append(toIndentedString(agent)).append("\n"); + sb.append(" checksum: ").append(toIndentedString(checksum)).append("\n"); + sb.append(" config: ").append(toIndentedString(config)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" diskFormat: ").append(toIndentedString(diskFormat)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" importProgress: ").append(toIndentedString(importProgress)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" minDiskSize: ").append(toIndentedString(minDiskSize)).append("\n"); + sb.append(" minRam: ").append(toIndentedString(minRam)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" owner: ").append(toIndentedString(owner)).append("\n"); + sb.append(" _protected: ").append(toIndentedString(_protected)).append("\n"); + sb.append(" scope: ").append(toIndentedString(scope)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).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( + "agent", + "checksum", + "config", + "createdAt", + "diskFormat", + "id", + "importProgress", + "labels", + "minDiskSize", + "minRam", + "name", + "owner", + "protected", + "scope", + "size", + "status", + "updatedAt")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("diskFormat", "name")); + } + + /** + * 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 CreateImagePayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateImagePayload.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 CreateImagePayload is not found in the empty JSON string", + CreateImagePayload.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateImagePayload.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 optional field `agent` + if (jsonObj.get("agent") != null && !jsonObj.get("agent").isJsonNull()) { + ImageAgent.validateJsonElement(jsonObj.get("agent")); + } + // validate the optional field `checksum` + if (jsonObj.get("checksum") != null && !jsonObj.get("checksum").isJsonNull()) { + ImageChecksum.validateJsonElement(jsonObj.get("checksum")); + } + // validate the optional field `config` + if (jsonObj.get("config") != null && !jsonObj.get("config").isJsonNull()) { + ImageConfig.validateJsonElement(jsonObj.get("config")); + } + if (!jsonObj.get("diskFormat").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `diskFormat` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("diskFormat").toString())); + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if (!jsonObj.get("name").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("owner") != null && !jsonObj.get("owner").isJsonNull()) + && !jsonObj.get("owner").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `owner` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("owner").toString())); + } + if ((jsonObj.get("scope") != null && !jsonObj.get("scope").isJsonNull()) + && !jsonObj.get("scope").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `scope` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("scope").toString())); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) + && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `status` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("status").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateImagePayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateImagePayload' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateImagePayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateImagePayload 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 CreateImagePayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateImagePayload 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 CreateImagePayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateImagePayload + * @throws IOException if the JSON string is invalid with respect to CreateImagePayload + */ + public static CreateImagePayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateImagePayload.class); + } + + /** + * Convert an instance of CreateImagePayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateKeyPairPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateKeyPairPayload.java new file mode 100644 index 00000000..2d5aee84 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateKeyPairPayload.java @@ -0,0 +1,445 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** Object that represents the public key of an SSH keypair and its name. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateKeyPairPayload { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_FINGERPRINT = "fingerprint"; + + @SerializedName(SERIALIZED_NAME_FINGERPRINT) + @javax.annotation.Nullable private String fingerprint; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; + + public static final String SERIALIZED_NAME_PUBLIC_KEY = "publicKey"; + + @SerializedName(SERIALIZED_NAME_PUBLIC_KEY) + @javax.annotation.Nonnull + private String publicKey; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable private OffsetDateTime updatedAt; + + public CreateKeyPairPayload() {} + + public CreateKeyPairPayload( + OffsetDateTime createdAt, String fingerprint, OffsetDateTime updatedAt) { + this(); + this.createdAt = createdAt; + this.fingerprint = fingerprint; + this.updatedAt = updatedAt; + } + + /** + * Date-time when resource was created. + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * Object that represents an SSH keypair MD5 fingerprint. + * + * @return fingerprint + */ + @javax.annotation.Nullable public String getFingerprint() { + return fingerprint; + } + + public CreateKeyPairPayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public CreateKeyPairPayload name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The name of an SSH keypair. Allowed characters are letters [a-zA-Z], digits [0-9] and the + * following special characters: [@._-]. + * + * @return name + */ + @javax.annotation.Nullable public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + public CreateKeyPairPayload publicKey(@javax.annotation.Nonnull String publicKey) { + this.publicKey = publicKey; + return this; + } + + /** + * Object that represents a public SSH key. + * + * @return publicKey + */ + @javax.annotation.Nonnull + public String getPublicKey() { + return publicKey; + } + + public void setPublicKey(@javax.annotation.Nonnull String publicKey) { + this.publicKey = publicKey; + } + + /** + * Date-time when resource was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nullable public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * 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 CreateKeyPairPayload instance itself + */ + public CreateKeyPairPayload 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; + } + CreateKeyPairPayload createKeyPairPayload = (CreateKeyPairPayload) o; + return Objects.equals(this.createdAt, createKeyPairPayload.createdAt) + && Objects.equals(this.fingerprint, createKeyPairPayload.fingerprint) + && Objects.equals(this.labels, createKeyPairPayload.labels) + && Objects.equals(this.name, createKeyPairPayload.name) + && Objects.equals(this.publicKey, createKeyPairPayload.publicKey) + && Objects.equals(this.updatedAt, createKeyPairPayload.updatedAt) + && Objects.equals( + this.additionalProperties, createKeyPairPayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + createdAt, fingerprint, labels, name, publicKey, updatedAt, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateKeyPairPayload {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" fingerprint: ").append(toIndentedString(fingerprint)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" publicKey: ").append(toIndentedString(publicKey)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).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( + "createdAt", + "fingerprint", + "labels", + "name", + "publicKey", + "updatedAt")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("publicKey")); + } + + /** + * 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 CreateKeyPairPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateKeyPairPayload.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 CreateKeyPairPayload is not found in the empty JSON string", + CreateKeyPairPayload.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateKeyPairPayload.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("fingerprint") != null && !jsonObj.get("fingerprint").isJsonNull()) + && !jsonObj.get("fingerprint").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `fingerprint` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("fingerprint").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `name` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("name").toString())); + } + if (!jsonObj.get("publicKey").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `publicKey` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("publicKey").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateKeyPairPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateKeyPairPayload' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateKeyPairPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateKeyPairPayload 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 CreateKeyPairPayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateKeyPairPayload 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 CreateKeyPairPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateKeyPairPayload + * @throws IOException if the JSON string is invalid with respect to CreateKeyPairPayload + */ + public static CreateKeyPairPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateKeyPairPayload.class); + } + + /** + * Convert an instance of CreateKeyPairPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateNetworkAddressFamily.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateNetworkAddressFamily.java new file mode 100644 index 00000000..f85652c1 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateNetworkAddressFamily.java @@ -0,0 +1,321 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** The addressFamily object for a network create request. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateNetworkAddressFamily { + public static final String SERIALIZED_NAME_IPV4 = "ipv4"; + + @SerializedName(SERIALIZED_NAME_IPV4) + @javax.annotation.Nullable private CreateNetworkIPv4Body ipv4; + + public static final String SERIALIZED_NAME_IPV6 = "ipv6"; + + @SerializedName(SERIALIZED_NAME_IPV6) + @javax.annotation.Nullable private CreateNetworkIPv6Body ipv6; + + public CreateNetworkAddressFamily() {} + + public CreateNetworkAddressFamily ipv4(@javax.annotation.Nullable CreateNetworkIPv4Body ipv4) { + this.ipv4 = ipv4; + return this; + } + + /** + * Get ipv4 + * + * @return ipv4 + */ + @javax.annotation.Nullable public CreateNetworkIPv4Body getIpv4() { + return ipv4; + } + + public void setIpv4(@javax.annotation.Nullable CreateNetworkIPv4Body ipv4) { + this.ipv4 = ipv4; + } + + public CreateNetworkAddressFamily ipv6(@javax.annotation.Nullable CreateNetworkIPv6Body ipv6) { + this.ipv6 = ipv6; + return this; + } + + /** + * Get ipv6 + * + * @return ipv6 + */ + @javax.annotation.Nullable public CreateNetworkIPv6Body getIpv6() { + return ipv6; + } + + public void setIpv6(@javax.annotation.Nullable CreateNetworkIPv6Body ipv6) { + this.ipv6 = ipv6; + } + + /** + * 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 CreateNetworkAddressFamily instance itself + */ + public CreateNetworkAddressFamily 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; + } + CreateNetworkAddressFamily createNetworkAddressFamily = (CreateNetworkAddressFamily) o; + return Objects.equals(this.ipv4, createNetworkAddressFamily.ipv4) + && Objects.equals(this.ipv6, createNetworkAddressFamily.ipv6) + && Objects.equals( + this.additionalProperties, createNetworkAddressFamily.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(ipv4, ipv6, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateNetworkAddressFamily {\n"); + sb.append(" ipv4: ").append(toIndentedString(ipv4)).append("\n"); + sb.append(" ipv6: ").append(toIndentedString(ipv6)).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("ipv4", "ipv6")); + + // 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 CreateNetworkAddressFamily + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateNetworkAddressFamily.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 CreateNetworkAddressFamily is not found in the empty JSON string", + CreateNetworkAddressFamily.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `ipv4` + if (jsonObj.get("ipv4") != null && !jsonObj.get("ipv4").isJsonNull()) { + CreateNetworkIPv4Body.validateJsonElement(jsonObj.get("ipv4")); + } + // validate the optional field `ipv6` + if (jsonObj.get("ipv6") != null && !jsonObj.get("ipv6").isJsonNull()) { + CreateNetworkIPv6Body.validateJsonElement(jsonObj.get("ipv6")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateNetworkAddressFamily.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateNetworkAddressFamily' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateNetworkAddressFamily.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateNetworkAddressFamily 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 CreateNetworkAddressFamily read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateNetworkAddressFamily 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 CreateNetworkAddressFamily given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateNetworkAddressFamily + * @throws IOException if the JSON string is invalid with respect to CreateNetworkAddressFamily + */ + public static CreateNetworkAddressFamily fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateNetworkAddressFamily.class); + } + + /** + * Convert an instance of CreateNetworkAddressFamily to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateNetworkAreaPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateNetworkAreaPayload.java new file mode 100644 index 00000000..dfc06d76 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateNetworkAreaPayload.java @@ -0,0 +1,368 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** CreateNetworkAreaPayload */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateNetworkAreaPayload { + public static final String SERIALIZED_NAME_ADDRESS_FAMILY = "addressFamily"; + + @SerializedName(SERIALIZED_NAME_ADDRESS_FAMILY) + @javax.annotation.Nonnull + private CreateAreaAddressFamily addressFamily; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public CreateNetworkAreaPayload() {} + + public CreateNetworkAreaPayload addressFamily( + @javax.annotation.Nonnull CreateAreaAddressFamily addressFamily) { + this.addressFamily = addressFamily; + return this; + } + + /** + * Get addressFamily + * + * @return addressFamily + */ + @javax.annotation.Nonnull + public CreateAreaAddressFamily getAddressFamily() { + return addressFamily; + } + + public void setAddressFamily(@javax.annotation.Nonnull CreateAreaAddressFamily addressFamily) { + this.addressFamily = addressFamily; + } + + public CreateNetworkAreaPayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public CreateNetworkAreaPayload name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + /** + * 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 CreateNetworkAreaPayload instance itself + */ + public CreateNetworkAreaPayload 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; + } + CreateNetworkAreaPayload createNetworkAreaPayload = (CreateNetworkAreaPayload) o; + return Objects.equals(this.addressFamily, createNetworkAreaPayload.addressFamily) + && Objects.equals(this.labels, createNetworkAreaPayload.labels) + && Objects.equals(this.name, createNetworkAreaPayload.name) + && Objects.equals( + this.additionalProperties, createNetworkAreaPayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(addressFamily, labels, name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateNetworkAreaPayload {\n"); + sb.append(" addressFamily: ").append(toIndentedString(addressFamily)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).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("addressFamily", "labels", "name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("addressFamily", "name")); + } + + /** + * 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 CreateNetworkAreaPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateNetworkAreaPayload.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 CreateNetworkAreaPayload is not found in the empty JSON string", + CreateNetworkAreaPayload.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateNetworkAreaPayload.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 `addressFamily` + CreateAreaAddressFamily.validateJsonElement(jsonObj.get("addressFamily")); + 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())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateNetworkAreaPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateNetworkAreaPayload' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateNetworkAreaPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateNetworkAreaPayload 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 CreateNetworkAreaPayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateNetworkAreaPayload 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 CreateNetworkAreaPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateNetworkAreaPayload + * @throws IOException if the JSON string is invalid with respect to CreateNetworkAreaPayload + */ + public static CreateNetworkAreaPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateNetworkAreaPayload.class); + } + + /** + * Convert an instance of CreateNetworkAreaPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateNetworkAreaRangePayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateNetworkAreaRangePayload.java new file mode 100644 index 00000000..9d26b1d6 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateNetworkAreaRangePayload.java @@ -0,0 +1,324 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** CreateNetworkAreaRangePayload */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateNetworkAreaRangePayload { + public static final String SERIALIZED_NAME_IPV4 = "ipv4"; + + @SerializedName(SERIALIZED_NAME_IPV4) + @javax.annotation.Nullable private List ipv4 = new ArrayList<>(); + + public CreateNetworkAreaRangePayload() {} + + public CreateNetworkAreaRangePayload ipv4(@javax.annotation.Nullable List ipv4) { + this.ipv4 = ipv4; + return this; + } + + public CreateNetworkAreaRangePayload addIpv4Item(NetworkRange ipv4Item) { + if (this.ipv4 == null) { + this.ipv4 = new ArrayList<>(); + } + this.ipv4.add(ipv4Item); + return this; + } + + /** + * A list of network ranges. + * + * @return ipv4 + */ + @javax.annotation.Nullable public List getIpv4() { + return ipv4; + } + + public void setIpv4(@javax.annotation.Nullable List ipv4) { + this.ipv4 = ipv4; + } + + /** + * 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 CreateNetworkAreaRangePayload instance itself + */ + public CreateNetworkAreaRangePayload 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; + } + CreateNetworkAreaRangePayload createNetworkAreaRangePayload = + (CreateNetworkAreaRangePayload) o; + return Objects.equals(this.ipv4, createNetworkAreaRangePayload.ipv4) + && Objects.equals( + this.additionalProperties, + createNetworkAreaRangePayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(ipv4, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateNetworkAreaRangePayload {\n"); + sb.append(" ipv4: ").append(toIndentedString(ipv4)).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("ipv4")); + + // 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 + * CreateNetworkAreaRangePayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateNetworkAreaRangePayload.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 CreateNetworkAreaRangePayload is not found in the empty JSON string", + CreateNetworkAreaRangePayload.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("ipv4") != null && !jsonObj.get("ipv4").isJsonNull()) { + JsonArray jsonArrayipv4 = jsonObj.getAsJsonArray("ipv4"); + if (jsonArrayipv4 != null) { + // ensure the json data is an array + if (!jsonObj.get("ipv4").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `ipv4` to be an array in the JSON string but got `%s`", + jsonObj.get("ipv4").toString())); + } + + // validate the optional field `ipv4` (array) + for (int i = 0; i < jsonArrayipv4.size(); i++) { + NetworkRange.validateJsonElement(jsonArrayipv4.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateNetworkAreaRangePayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateNetworkAreaRangePayload' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateNetworkAreaRangePayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateNetworkAreaRangePayload 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 CreateNetworkAreaRangePayload read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateNetworkAreaRangePayload 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 CreateNetworkAreaRangePayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateNetworkAreaRangePayload + * @throws IOException if the JSON string is invalid with respect to + * CreateNetworkAreaRangePayload + */ + public static CreateNetworkAreaRangePayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateNetworkAreaRangePayload.class); + } + + /** + * Convert an instance of CreateNetworkAreaRangePayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateNetworkAreaRoutePayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateNetworkAreaRoutePayload.java new file mode 100644 index 00000000..0e078c23 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateNetworkAreaRoutePayload.java @@ -0,0 +1,324 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** CreateNetworkAreaRoutePayload */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateNetworkAreaRoutePayload { + public static final String SERIALIZED_NAME_IPV4 = "ipv4"; + + @SerializedName(SERIALIZED_NAME_IPV4) + @javax.annotation.Nullable private List ipv4 = new ArrayList<>(); + + public CreateNetworkAreaRoutePayload() {} + + public CreateNetworkAreaRoutePayload ipv4(@javax.annotation.Nullable List ipv4) { + this.ipv4 = ipv4; + return this; + } + + public CreateNetworkAreaRoutePayload addIpv4Item(Route ipv4Item) { + if (this.ipv4 == null) { + this.ipv4 = new ArrayList<>(); + } + this.ipv4.add(ipv4Item); + return this; + } + + /** + * A list of routes. + * + * @return ipv4 + */ + @javax.annotation.Nullable public List getIpv4() { + return ipv4; + } + + public void setIpv4(@javax.annotation.Nullable List ipv4) { + this.ipv4 = ipv4; + } + + /** + * 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 CreateNetworkAreaRoutePayload instance itself + */ + public CreateNetworkAreaRoutePayload 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; + } + CreateNetworkAreaRoutePayload createNetworkAreaRoutePayload = + (CreateNetworkAreaRoutePayload) o; + return Objects.equals(this.ipv4, createNetworkAreaRoutePayload.ipv4) + && Objects.equals( + this.additionalProperties, + createNetworkAreaRoutePayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(ipv4, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateNetworkAreaRoutePayload {\n"); + sb.append(" ipv4: ").append(toIndentedString(ipv4)).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("ipv4")); + + // 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 + * CreateNetworkAreaRoutePayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateNetworkAreaRoutePayload.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 CreateNetworkAreaRoutePayload is not found in the empty JSON string", + CreateNetworkAreaRoutePayload.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("ipv4") != null && !jsonObj.get("ipv4").isJsonNull()) { + JsonArray jsonArrayipv4 = jsonObj.getAsJsonArray("ipv4"); + if (jsonArrayipv4 != null) { + // ensure the json data is an array + if (!jsonObj.get("ipv4").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `ipv4` to be an array in the JSON string but got `%s`", + jsonObj.get("ipv4").toString())); + } + + // validate the optional field `ipv4` (array) + for (int i = 0; i < jsonArrayipv4.size(); i++) { + Route.validateJsonElement(jsonArrayipv4.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateNetworkAreaRoutePayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateNetworkAreaRoutePayload' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateNetworkAreaRoutePayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateNetworkAreaRoutePayload 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 CreateNetworkAreaRoutePayload read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateNetworkAreaRoutePayload 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 CreateNetworkAreaRoutePayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateNetworkAreaRoutePayload + * @throws IOException if the JSON string is invalid with respect to + * CreateNetworkAreaRoutePayload + */ + public static CreateNetworkAreaRoutePayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateNetworkAreaRoutePayload.class); + } + + /** + * Convert an instance of CreateNetworkAreaRoutePayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateNetworkIPv4Body.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateNetworkIPv4Body.java new file mode 100644 index 00000000..620d6218 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateNetworkIPv4Body.java @@ -0,0 +1,417 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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.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; +import org.openapitools.jackson.nullable.JsonNullable; + +/** The config object for an IPv4 network. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateNetworkIPv4Body { + public static final String SERIALIZED_NAME_GATEWAY = "gateway"; + + @SerializedName(SERIALIZED_NAME_GATEWAY) + @javax.annotation.Nullable private String gateway; + + public static final String SERIALIZED_NAME_NAMESERVERS = "nameservers"; + + @SerializedName(SERIALIZED_NAME_NAMESERVERS) + @javax.annotation.Nullable private List nameservers = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PREFIX = "prefix"; + + @SerializedName(SERIALIZED_NAME_PREFIX) + @javax.annotation.Nullable private String prefix; + + public static final String SERIALIZED_NAME_PREFIX_LENGTH = "prefixLength"; + + @SerializedName(SERIALIZED_NAME_PREFIX_LENGTH) + @javax.annotation.Nullable private Integer prefixLength; + + public CreateNetworkIPv4Body() {} + + public CreateNetworkIPv4Body gateway(@javax.annotation.Nullable String gateway) { + this.gateway = gateway; + return this; + } + + /** + * The gateway of a network. If not specified the first IP of the network will be assigned as + * the gateway. If 'null' is sent, then the network doesn't have a gateway. + * + * @return gateway + */ + @javax.annotation.Nullable public String getGateway() { + return gateway; + } + + public void setGateway(@javax.annotation.Nullable String gateway) { + this.gateway = gateway; + } + + public CreateNetworkIPv4Body nameservers(@javax.annotation.Nullable List nameservers) { + this.nameservers = nameservers; + return this; + } + + public CreateNetworkIPv4Body addNameserversItem(String nameserversItem) { + if (this.nameservers == null) { + this.nameservers = new ArrayList<>(); + } + this.nameservers.add(nameserversItem); + return this; + } + + /** + * A list containing DNS Servers/Nameservers for IPv4. + * + * @return nameservers + */ + @javax.annotation.Nullable public List getNameservers() { + return nameservers; + } + + public void setNameservers(@javax.annotation.Nullable List nameservers) { + this.nameservers = nameservers; + } + + public CreateNetworkIPv4Body prefix(@javax.annotation.Nullable String prefix) { + this.prefix = prefix; + return this; + } + + /** + * Classless Inter-Domain Routing (CIDR). + * + * @return prefix + */ + @javax.annotation.Nullable public String getPrefix() { + return prefix; + } + + public void setPrefix(@javax.annotation.Nullable String prefix) { + this.prefix = prefix; + } + + public CreateNetworkIPv4Body prefixLength(@javax.annotation.Nullable Integer prefixLength) { + this.prefixLength = prefixLength; + return this; + } + + /** + * Get prefixLength minimum: 8 maximum: 29 + * + * @return prefixLength + */ + @javax.annotation.Nullable public Integer getPrefixLength() { + return prefixLength; + } + + public void setPrefixLength(@javax.annotation.Nullable Integer prefixLength) { + this.prefixLength = prefixLength; + } + + /** + * 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 CreateNetworkIPv4Body instance itself + */ + public CreateNetworkIPv4Body 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; + } + CreateNetworkIPv4Body createNetworkIPv4Body = (CreateNetworkIPv4Body) o; + return Objects.equals(this.gateway, createNetworkIPv4Body.gateway) + && Objects.equals(this.nameservers, createNetworkIPv4Body.nameservers) + && Objects.equals(this.prefix, createNetworkIPv4Body.prefix) + && Objects.equals(this.prefixLength, createNetworkIPv4Body.prefixLength) + && Objects.equals( + this.additionalProperties, createNetworkIPv4Body.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(gateway, nameservers, prefix, prefixLength, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateNetworkIPv4Body {\n"); + sb.append(" gateway: ").append(toIndentedString(gateway)).append("\n"); + sb.append(" nameservers: ").append(toIndentedString(nameservers)).append("\n"); + sb.append(" prefix: ").append(toIndentedString(prefix)).append("\n"); + sb.append(" prefixLength: ").append(toIndentedString(prefixLength)).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("gateway", "nameservers", "prefix", "prefixLength")); + + // 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 CreateNetworkIPv4Body + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateNetworkIPv4Body.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 CreateNetworkIPv4Body is not found in the empty JSON string", + CreateNetworkIPv4Body.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("gateway") != null && !jsonObj.get("gateway").isJsonNull()) + && !jsonObj.get("gateway").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `gateway` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("gateway").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("nameservers") != null + && !jsonObj.get("nameservers").isJsonNull() + && !jsonObj.get("nameservers").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `nameservers` to be an array in the JSON string but got `%s`", + jsonObj.get("nameservers").toString())); + } + if ((jsonObj.get("prefix") != null && !jsonObj.get("prefix").isJsonNull()) + && !jsonObj.get("prefix").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `prefix` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("prefix").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateNetworkIPv4Body.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateNetworkIPv4Body' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateNetworkIPv4Body.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateNetworkIPv4Body 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 CreateNetworkIPv4Body read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateNetworkIPv4Body 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 CreateNetworkIPv4Body given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateNetworkIPv4Body + * @throws IOException if the JSON string is invalid with respect to CreateNetworkIPv4Body + */ + public static CreateNetworkIPv4Body fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateNetworkIPv4Body.class); + } + + /** + * Convert an instance of CreateNetworkIPv4Body to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateNetworkIPv6Body.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateNetworkIPv6Body.java new file mode 100644 index 00000000..76c40a06 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateNetworkIPv6Body.java @@ -0,0 +1,417 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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.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; +import org.openapitools.jackson.nullable.JsonNullable; + +/** The config object for an IPv6 network. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateNetworkIPv6Body { + public static final String SERIALIZED_NAME_GATEWAY = "gateway"; + + @SerializedName(SERIALIZED_NAME_GATEWAY) + @javax.annotation.Nullable private String gateway; + + public static final String SERIALIZED_NAME_NAMESERVERS = "nameservers"; + + @SerializedName(SERIALIZED_NAME_NAMESERVERS) + @javax.annotation.Nullable private List nameservers = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PREFIX = "prefix"; + + @SerializedName(SERIALIZED_NAME_PREFIX) + @javax.annotation.Nullable private String prefix; + + public static final String SERIALIZED_NAME_PREFIX_LENGTH = "prefixLength"; + + @SerializedName(SERIALIZED_NAME_PREFIX_LENGTH) + @javax.annotation.Nullable private Integer prefixLength; + + public CreateNetworkIPv6Body() {} + + public CreateNetworkIPv6Body gateway(@javax.annotation.Nullable String gateway) { + this.gateway = gateway; + return this; + } + + /** + * The gateway of a network. If not specified the first IP of the network will be assigned as + * the gateway. If 'null' is sent, then the network doesn't have a gateway. + * + * @return gateway + */ + @javax.annotation.Nullable public String getGateway() { + return gateway; + } + + public void setGateway(@javax.annotation.Nullable String gateway) { + this.gateway = gateway; + } + + public CreateNetworkIPv6Body nameservers(@javax.annotation.Nullable List nameservers) { + this.nameservers = nameservers; + return this; + } + + public CreateNetworkIPv6Body addNameserversItem(String nameserversItem) { + if (this.nameservers == null) { + this.nameservers = new ArrayList<>(); + } + this.nameservers.add(nameserversItem); + return this; + } + + /** + * A list containing DNS Servers/Nameservers for IPv6. + * + * @return nameservers + */ + @javax.annotation.Nullable public List getNameservers() { + return nameservers; + } + + public void setNameservers(@javax.annotation.Nullable List nameservers) { + this.nameservers = nameservers; + } + + public CreateNetworkIPv6Body prefix(@javax.annotation.Nullable String prefix) { + this.prefix = prefix; + return this; + } + + /** + * Classless Inter-Domain Routing (CIDR) for IPv6. + * + * @return prefix + */ + @javax.annotation.Nullable public String getPrefix() { + return prefix; + } + + public void setPrefix(@javax.annotation.Nullable String prefix) { + this.prefix = prefix; + } + + public CreateNetworkIPv6Body prefixLength(@javax.annotation.Nullable Integer prefixLength) { + this.prefixLength = prefixLength; + return this; + } + + /** + * Get prefixLength minimum: 56 maximum: 128 + * + * @return prefixLength + */ + @javax.annotation.Nullable public Integer getPrefixLength() { + return prefixLength; + } + + public void setPrefixLength(@javax.annotation.Nullable Integer prefixLength) { + this.prefixLength = prefixLength; + } + + /** + * 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 CreateNetworkIPv6Body instance itself + */ + public CreateNetworkIPv6Body 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; + } + CreateNetworkIPv6Body createNetworkIPv6Body = (CreateNetworkIPv6Body) o; + return Objects.equals(this.gateway, createNetworkIPv6Body.gateway) + && Objects.equals(this.nameservers, createNetworkIPv6Body.nameservers) + && Objects.equals(this.prefix, createNetworkIPv6Body.prefix) + && Objects.equals(this.prefixLength, createNetworkIPv6Body.prefixLength) + && Objects.equals( + this.additionalProperties, createNetworkIPv6Body.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(gateway, nameservers, prefix, prefixLength, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateNetworkIPv6Body {\n"); + sb.append(" gateway: ").append(toIndentedString(gateway)).append("\n"); + sb.append(" nameservers: ").append(toIndentedString(nameservers)).append("\n"); + sb.append(" prefix: ").append(toIndentedString(prefix)).append("\n"); + sb.append(" prefixLength: ").append(toIndentedString(prefixLength)).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("gateway", "nameservers", "prefix", "prefixLength")); + + // 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 CreateNetworkIPv6Body + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateNetworkIPv6Body.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 CreateNetworkIPv6Body is not found in the empty JSON string", + CreateNetworkIPv6Body.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("gateway") != null && !jsonObj.get("gateway").isJsonNull()) + && !jsonObj.get("gateway").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `gateway` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("gateway").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("nameservers") != null + && !jsonObj.get("nameservers").isJsonNull() + && !jsonObj.get("nameservers").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `nameservers` to be an array in the JSON string but got `%s`", + jsonObj.get("nameservers").toString())); + } + if ((jsonObj.get("prefix") != null && !jsonObj.get("prefix").isJsonNull()) + && !jsonObj.get("prefix").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `prefix` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("prefix").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateNetworkIPv6Body.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateNetworkIPv6Body' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateNetworkIPv6Body.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateNetworkIPv6Body 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 CreateNetworkIPv6Body read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateNetworkIPv6Body 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 CreateNetworkIPv6Body given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateNetworkIPv6Body + * @throws IOException if the JSON string is invalid with respect to CreateNetworkIPv6Body + */ + public static CreateNetworkIPv6Body fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateNetworkIPv6Body.class); + } + + /** + * Convert an instance of CreateNetworkIPv6Body to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateNetworkPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateNetworkPayload.java new file mode 100644 index 00000000..48894e49 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateNetworkPayload.java @@ -0,0 +1,420 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** Object that represents the request body for a network create. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateNetworkPayload { + public static final String SERIALIZED_NAME_ADDRESS_FAMILY = "addressFamily"; + + @SerializedName(SERIALIZED_NAME_ADDRESS_FAMILY) + @javax.annotation.Nullable private CreateNetworkAddressFamily addressFamily; + + public static final String SERIALIZED_NAME_DHCP = "dhcp"; + + @SerializedName(SERIALIZED_NAME_DHCP) + @javax.annotation.Nullable private Boolean dhcp = true; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_ROUTED = "routed"; + + @SerializedName(SERIALIZED_NAME_ROUTED) + @javax.annotation.Nullable private Boolean routed; + + public CreateNetworkPayload() {} + + public CreateNetworkPayload addressFamily( + @javax.annotation.Nullable CreateNetworkAddressFamily addressFamily) { + this.addressFamily = addressFamily; + return this; + } + + /** + * Get addressFamily + * + * @return addressFamily + */ + @javax.annotation.Nullable public CreateNetworkAddressFamily getAddressFamily() { + return addressFamily; + } + + public void setAddressFamily( + @javax.annotation.Nullable CreateNetworkAddressFamily addressFamily) { + this.addressFamily = addressFamily; + } + + public CreateNetworkPayload dhcp(@javax.annotation.Nullable Boolean dhcp) { + this.dhcp = dhcp; + return this; + } + + /** + * Enable or disable DHCP for a network. + * + * @return dhcp + */ + @javax.annotation.Nullable public Boolean getDhcp() { + return dhcp; + } + + public void setDhcp(@javax.annotation.Nullable Boolean dhcp) { + this.dhcp = dhcp; + } + + public CreateNetworkPayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public CreateNetworkPayload name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + public CreateNetworkPayload routed(@javax.annotation.Nullable Boolean routed) { + this.routed = routed; + return this; + } + + /** + * Shows if the network is routed and therefore accessible from other networks. + * + * @return routed + */ + @javax.annotation.Nullable public Boolean getRouted() { + return routed; + } + + public void setRouted(@javax.annotation.Nullable Boolean routed) { + this.routed = routed; + } + + /** + * 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 CreateNetworkPayload instance itself + */ + public CreateNetworkPayload 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; + } + CreateNetworkPayload createNetworkPayload = (CreateNetworkPayload) o; + return Objects.equals(this.addressFamily, createNetworkPayload.addressFamily) + && Objects.equals(this.dhcp, createNetworkPayload.dhcp) + && Objects.equals(this.labels, createNetworkPayload.labels) + && Objects.equals(this.name, createNetworkPayload.name) + && Objects.equals(this.routed, createNetworkPayload.routed) + && Objects.equals( + this.additionalProperties, createNetworkPayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(addressFamily, dhcp, labels, name, routed, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateNetworkPayload {\n"); + sb.append(" addressFamily: ").append(toIndentedString(addressFamily)).append("\n"); + sb.append(" dhcp: ").append(toIndentedString(dhcp)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" routed: ").append(toIndentedString(routed)).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("addressFamily", "dhcp", "labels", "name", "routed")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name")); + } + + /** + * 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 CreateNetworkPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateNetworkPayload.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 CreateNetworkPayload is not found in the empty JSON string", + CreateNetworkPayload.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateNetworkPayload.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 optional field `addressFamily` + if (jsonObj.get("addressFamily") != null && !jsonObj.get("addressFamily").isJsonNull()) { + CreateNetworkAddressFamily.validateJsonElement(jsonObj.get("addressFamily")); + } + 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())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateNetworkPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateNetworkPayload' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateNetworkPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateNetworkPayload 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 CreateNetworkPayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateNetworkPayload 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 CreateNetworkPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateNetworkPayload + * @throws IOException if the JSON string is invalid with respect to CreateNetworkPayload + */ + public static CreateNetworkPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateNetworkPayload.class); + } + + /** + * Convert an instance of CreateNetworkPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateNicPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateNicPayload.java new file mode 100644 index 00000000..8a29ebd6 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateNicPayload.java @@ -0,0 +1,735 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; +import java.util.UUID; + +/** Object that represents a network interface. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateNicPayload { + public static final String SERIALIZED_NAME_ALLOWED_ADDRESSES = "allowedAddresses"; + + @SerializedName(SERIALIZED_NAME_ALLOWED_ADDRESSES) + @javax.annotation.Nullable private List allowedAddresses = new ArrayList<>(); + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable private String description; + + public static final String SERIALIZED_NAME_DEVICE = "device"; + + @SerializedName(SERIALIZED_NAME_DEVICE) + @javax.annotation.Nullable private UUID device; + + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_IPV4 = "ipv4"; + + @SerializedName(SERIALIZED_NAME_IPV4) + @javax.annotation.Nullable private String ipv4; + + public static final String SERIALIZED_NAME_IPV6 = "ipv6"; + + @SerializedName(SERIALIZED_NAME_IPV6) + @javax.annotation.Nullable private String ipv6; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_MAC = "mac"; + + @SerializedName(SERIALIZED_NAME_MAC) + @javax.annotation.Nullable private String mac; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; + + public static final String SERIALIZED_NAME_NETWORK_ID = "networkId"; + + @SerializedName(SERIALIZED_NAME_NETWORK_ID) + @javax.annotation.Nullable private UUID networkId; + + public static final String SERIALIZED_NAME_NIC_SECURITY = "nicSecurity"; + + @SerializedName(SERIALIZED_NAME_NIC_SECURITY) + @javax.annotation.Nullable private Boolean nicSecurity = true; + + public static final String SERIALIZED_NAME_SECURITY_GROUPS = "securityGroups"; + + @SerializedName(SERIALIZED_NAME_SECURITY_GROUPS) + @javax.annotation.Nullable private List securityGroups = new ArrayList<>(); + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable private String status; + + public static final String SERIALIZED_NAME_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable private String type; + + public CreateNicPayload() {} + + public CreateNicPayload( + UUID device, UUID id, String mac, UUID networkId, String status, String type) { + this(); + this.device = device; + this.id = id; + this.mac = mac; + this.networkId = networkId; + this.status = status; + this.type = type; + } + + public CreateNicPayload allowedAddresses( + @javax.annotation.Nullable List allowedAddresses) { + this.allowedAddresses = allowedAddresses; + return this; + } + + public CreateNicPayload addAllowedAddressesItem(AllowedAddressesInner allowedAddressesItem) { + if (this.allowedAddresses == null) { + this.allowedAddresses = new ArrayList<>(); + } + this.allowedAddresses.add(allowedAddressesItem); + return this; + } + + /** + * A list of IPs or CIDR notations. + * + * @return allowedAddresses + */ + @javax.annotation.Nullable public List getAllowedAddresses() { + return allowedAddresses; + } + + public void setAllowedAddresses( + @javax.annotation.Nullable List allowedAddresses) { + this.allowedAddresses = allowedAddresses; + } + + public CreateNicPayload description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Description Object. Allows string up to 255 Characters. + * + * @return description + */ + @javax.annotation.Nullable public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return device + */ + @javax.annotation.Nullable public UUID getDevice() { + return device; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + public CreateNicPayload ipv4(@javax.annotation.Nullable String ipv4) { + this.ipv4 = ipv4; + return this; + } + + /** + * Object that represents an IP address. + * + * @return ipv4 + */ + @javax.annotation.Nullable public String getIpv4() { + return ipv4; + } + + public void setIpv4(@javax.annotation.Nullable String ipv4) { + this.ipv4 = ipv4; + } + + public CreateNicPayload ipv6(@javax.annotation.Nullable String ipv6) { + this.ipv6 = ipv6; + return this; + } + + /** + * String that represents an IPv6 address. + * + * @return ipv6 + */ + @javax.annotation.Nullable public String getIpv6() { + return ipv6; + } + + public void setIpv6(@javax.annotation.Nullable String ipv6) { + this.ipv6 = ipv6; + } + + public CreateNicPayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + /** + * Object that represents an MAC address. + * + * @return mac + */ + @javax.annotation.Nullable public String getMac() { + return mac; + } + + public CreateNicPayload name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nullable public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return networkId + */ + @javax.annotation.Nullable public UUID getNetworkId() { + return networkId; + } + + public CreateNicPayload nicSecurity(@javax.annotation.Nullable Boolean nicSecurity) { + this.nicSecurity = nicSecurity; + return this; + } + + /** + * If this is set to false, then no security groups will apply to this network interface. + * + * @return nicSecurity + */ + @javax.annotation.Nullable public Boolean getNicSecurity() { + return nicSecurity; + } + + public void setNicSecurity(@javax.annotation.Nullable Boolean nicSecurity) { + this.nicSecurity = nicSecurity; + } + + public CreateNicPayload securityGroups(@javax.annotation.Nullable List securityGroups) { + this.securityGroups = securityGroups; + return this; + } + + public CreateNicPayload addSecurityGroupsItem(UUID securityGroupsItem) { + if (this.securityGroups == null) { + this.securityGroups = new ArrayList<>(); + } + this.securityGroups.add(securityGroupsItem); + return this; + } + + /** + * A list of UUIDs. + * + * @return securityGroups + */ + @javax.annotation.Nullable public List getSecurityGroups() { + return securityGroups; + } + + public void setSecurityGroups(@javax.annotation.Nullable List securityGroups) { + this.securityGroups = securityGroups; + } + + /** + * Possible values: `ACTIVE`, `DOWN`. + * + * @return status + */ + @javax.annotation.Nullable public String getStatus() { + return status; + } + + /** + * Possible values: `server`, `metadata`, `gateway`, + * `none`. + * + * @return type + */ + @javax.annotation.Nullable public String getType() { + return 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 CreateNicPayload instance itself + */ + public CreateNicPayload 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; + } + CreateNicPayload createNicPayload = (CreateNicPayload) o; + return Objects.equals(this.allowedAddresses, createNicPayload.allowedAddresses) + && Objects.equals(this.description, createNicPayload.description) + && Objects.equals(this.device, createNicPayload.device) + && Objects.equals(this.id, createNicPayload.id) + && Objects.equals(this.ipv4, createNicPayload.ipv4) + && Objects.equals(this.ipv6, createNicPayload.ipv6) + && Objects.equals(this.labels, createNicPayload.labels) + && Objects.equals(this.mac, createNicPayload.mac) + && Objects.equals(this.name, createNicPayload.name) + && Objects.equals(this.networkId, createNicPayload.networkId) + && Objects.equals(this.nicSecurity, createNicPayload.nicSecurity) + && Objects.equals(this.securityGroups, createNicPayload.securityGroups) + && Objects.equals(this.status, createNicPayload.status) + && Objects.equals(this.type, createNicPayload.type) + && Objects.equals(this.additionalProperties, createNicPayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + allowedAddresses, + description, + device, + id, + ipv4, + ipv6, + labels, + mac, + name, + networkId, + nicSecurity, + securityGroups, + status, + type, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateNicPayload {\n"); + sb.append(" allowedAddresses: ").append(toIndentedString(allowedAddresses)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" device: ").append(toIndentedString(device)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" ipv4: ").append(toIndentedString(ipv4)).append("\n"); + sb.append(" ipv6: ").append(toIndentedString(ipv6)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" mac: ").append(toIndentedString(mac)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" networkId: ").append(toIndentedString(networkId)).append("\n"); + sb.append(" nicSecurity: ").append(toIndentedString(nicSecurity)).append("\n"); + sb.append(" securityGroups: ").append(toIndentedString(securityGroups)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).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( + "allowedAddresses", + "description", + "device", + "id", + "ipv4", + "ipv6", + "labels", + "mac", + "name", + "networkId", + "nicSecurity", + "securityGroups", + "status", + "type")); + + // 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 CreateNicPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateNicPayload.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 CreateNicPayload is not found in the empty JSON string", + CreateNicPayload.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("allowedAddresses") != null + && !jsonObj.get("allowedAddresses").isJsonNull()) { + JsonArray jsonArrayallowedAddresses = jsonObj.getAsJsonArray("allowedAddresses"); + if (jsonArrayallowedAddresses != null) { + // ensure the json data is an array + if (!jsonObj.get("allowedAddresses").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `allowedAddresses` to be an array in the JSON string but got `%s`", + jsonObj.get("allowedAddresses").toString())); + } + + // validate the optional field `allowedAddresses` (array) + for (int i = 0; i < jsonArrayallowedAddresses.size(); i++) { + AllowedAddressesInner.validateJsonElement(jsonArrayallowedAddresses.get(i)); + } + ; + } + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `description` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("description").toString())); + } + if ((jsonObj.get("device") != null && !jsonObj.get("device").isJsonNull()) + && !jsonObj.get("device").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `device` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("device").toString())); + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if ((jsonObj.get("ipv4") != null && !jsonObj.get("ipv4").isJsonNull()) + && !jsonObj.get("ipv4").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `ipv4` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("ipv4").toString())); + } + if ((jsonObj.get("ipv6") != null && !jsonObj.get("ipv6").isJsonNull()) + && !jsonObj.get("ipv6").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `ipv6` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("ipv6").toString())); + } + if ((jsonObj.get("mac") != null && !jsonObj.get("mac").isJsonNull()) + && !jsonObj.get("mac").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `mac` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("mac").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `name` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("name").toString())); + } + if ((jsonObj.get("networkId") != null && !jsonObj.get("networkId").isJsonNull()) + && !jsonObj.get("networkId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `networkId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("networkId").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("securityGroups") != null + && !jsonObj.get("securityGroups").isJsonNull() + && !jsonObj.get("securityGroups").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `securityGroups` to be an array in the JSON string but got `%s`", + jsonObj.get("securityGroups").toString())); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) + && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `status` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("status").toString())); + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) + && !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 (!CreateNicPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateNicPayload' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateNicPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateNicPayload 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 CreateNicPayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateNicPayload 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 CreateNicPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateNicPayload + * @throws IOException if the JSON string is invalid with respect to CreateNicPayload + */ + public static CreateNicPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateNicPayload.class); + } + + /** + * Convert an instance of CreateNicPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateProtocol.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateProtocol.java new file mode 100644 index 00000000..9077f87b --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateProtocol.java @@ -0,0 +1,308 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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 CreateProtocol extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(CreateProtocol.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateProtocol.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateProtocol' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterLong = + gson.getDelegateAdapter(this, TypeToken.get(Long.class)); + final TypeAdapter adapterString = + gson.getDelegateAdapter(this, TypeToken.get(String.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateProtocol value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `Long` + if (value.getActualInstance() instanceof Long) { + JsonPrimitive primitive = + adapterLong + .toJsonTree((Long) value.getActualInstance()) + .getAsJsonPrimitive(); + elementAdapter.write(out, primitive); + 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; + } + throw new IOException( + "Failed to serialize as the type doesn't match oneOf schemas: Long, String"); + } + + @Override + public CreateProtocol read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize Long + 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 = adapterLong; + match++; + log.log(Level.FINER, "Input data matches schema 'Long'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for Long failed with `%s`.", + e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'Long'", e); + } + // 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; + match++; + log.log(Level.FINER, "Input data matches schema 'String'"); + } 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); + } + + if (match == 1) { + CreateProtocol ret = new CreateProtocol(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException( + String.format( + java.util.Locale.ROOT, + "Failed deserialization for CreateProtocol: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", + match, + errorMessages, + jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public CreateProtocol() { + super("oneOf", Boolean.FALSE); + } + + public CreateProtocol(Object o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("Long", Long.class); + schemas.put("String", String.class); + } + + @Override + public Map> getSchemas() { + return CreateProtocol.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: Long, String + * + *

It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof Long) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof String) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Long, String"); + } + + /** + * Get the actual instance, which can be the following: Long, String + * + * @return The actual instance (Long, String) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Long`. If the actual instance is not `Long`, the + * ClassCastException will be thrown. + * + * @return The actual instance of `Long` + * @throws ClassCastException if the instance is not `Long` + */ + public Long getLong() throws ClassCastException { + return (Long) 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(); + } + + /** + * 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 CreateProtocol + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with Long + 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())); + } + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for Long failed with `%s`.", + e.getMessage())); + // continue to the next one + } + // 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())); + } + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for String failed with `%s`.", + e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException( + String.format( + java.util.Locale.ROOT, + "The JSON string is invalid for CreateProtocol with oneOf schemas: Long, String. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", + validCount, + errorMessages, + jsonElement.toString())); + } + } + + /** + * Create an instance of CreateProtocol given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateProtocol + * @throws IOException if the JSON string is invalid with respect to CreateProtocol + */ + public static CreateProtocol fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateProtocol.class); + } + + /** + * Convert an instance of CreateProtocol to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreatePublicIPPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreatePublicIPPayload.java new file mode 100644 index 00000000..2dd3d3d8 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreatePublicIPPayload.java @@ -0,0 +1,399 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.v1api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Object that represents a public IP. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreatePublicIPPayload { + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_IP = "ip"; + + @SerializedName(SERIALIZED_NAME_IP) + @javax.annotation.Nullable private String ip; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NETWORK_INTERFACE = "networkInterface"; + + @SerializedName(SERIALIZED_NAME_NETWORK_INTERFACE) + @javax.annotation.Nullable private UUID networkInterface; + + public CreatePublicIPPayload() {} + + public CreatePublicIPPayload(UUID id, String ip) { + this(); + this.id = id; + this.ip = ip; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + /** + * Object that represents an IP address. + * + * @return ip + */ + @javax.annotation.Nullable public String getIp() { + return ip; + } + + public CreatePublicIPPayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public CreatePublicIPPayload networkInterface( + @javax.annotation.Nullable UUID networkInterface) { + this.networkInterface = networkInterface; + return this; + } + + /** + * Associate the public IP with a network interface (ID). + * + * @return networkInterface + */ + @javax.annotation.Nullable public UUID getNetworkInterface() { + return networkInterface; + } + + public void setNetworkInterface(@javax.annotation.Nullable UUID networkInterface) { + this.networkInterface = networkInterface; + } + + /** + * 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 CreatePublicIPPayload instance itself + */ + public CreatePublicIPPayload 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; + } + CreatePublicIPPayload createPublicIPPayload = (CreatePublicIPPayload) o; + return Objects.equals(this.id, createPublicIPPayload.id) + && Objects.equals(this.ip, createPublicIPPayload.ip) + && Objects.equals(this.labels, createPublicIPPayload.labels) + && Objects.equals(this.networkInterface, createPublicIPPayload.networkInterface) + && Objects.equals( + this.additionalProperties, createPublicIPPayload.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(id, ip, labels, networkInterface, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreatePublicIPPayload {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" ip: ").append(toIndentedString(ip)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" networkInterface: ").append(toIndentedString(networkInterface)).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("id", "ip", "labels", "networkInterface")); + + // 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 CreatePublicIPPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreatePublicIPPayload.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 CreatePublicIPPayload is not found in the empty JSON string", + CreatePublicIPPayload.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if ((jsonObj.get("ip") != null && !jsonObj.get("ip").isJsonNull()) + && !jsonObj.get("ip").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `ip` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("ip").toString())); + } + if ((jsonObj.get("networkInterface") != null + && !jsonObj.get("networkInterface").isJsonNull()) + && !jsonObj.get("networkInterface").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `networkInterface` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("networkInterface").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreatePublicIPPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreatePublicIPPayload' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreatePublicIPPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreatePublicIPPayload 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 CreatePublicIPPayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreatePublicIPPayload 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 CreatePublicIPPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreatePublicIPPayload + * @throws IOException if the JSON string is invalid with respect to CreatePublicIPPayload + */ + public static CreatePublicIPPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreatePublicIPPayload.class); + } + + /** + * Convert an instance of CreatePublicIPPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateSecurityGroupPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateSecurityGroupPayload.java new file mode 100644 index 00000000..ba8c7eb5 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateSecurityGroupPayload.java @@ -0,0 +1,522 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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.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; +import java.util.UUID; + +/** Object that represents a security group. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateSecurityGroupPayload { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable private String description; + + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_RULES = "rules"; + + @SerializedName(SERIALIZED_NAME_RULES) + @javax.annotation.Nullable private List rules; + + public static final String SERIALIZED_NAME_STATEFUL = "stateful"; + + @SerializedName(SERIALIZED_NAME_STATEFUL) + @javax.annotation.Nullable private Boolean stateful = true; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable private OffsetDateTime updatedAt; + + public CreateSecurityGroupPayload() {} + + public CreateSecurityGroupPayload( + OffsetDateTime createdAt, + UUID id, + List rules, + OffsetDateTime updatedAt) { + this(); + this.createdAt = createdAt; + this.id = id; + this.rules = rules; + this.updatedAt = updatedAt; + } + + /** + * Date-time when resource was created. + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public CreateSecurityGroupPayload description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Description Object. Allows string up to 255 Characters. + * + * @return description + */ + @javax.annotation.Nullable public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + public CreateSecurityGroupPayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public CreateSecurityGroupPayload name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + /** + * A list containing security group rule objects. + * + * @return rules + */ + @javax.annotation.Nullable public List getRules() { + return rules; + } + + public CreateSecurityGroupPayload stateful(@javax.annotation.Nullable Boolean stateful) { + this.stateful = stateful; + return this; + } + + /** + * Shows if a security group is stateful or stateless. You can only have one type of security + * groups per network interface/server. + * + * @return stateful + */ + @javax.annotation.Nullable public Boolean getStateful() { + return stateful; + } + + public void setStateful(@javax.annotation.Nullable Boolean stateful) { + this.stateful = stateful; + } + + /** + * Date-time when resource was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nullable public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * 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 CreateSecurityGroupPayload instance itself + */ + public CreateSecurityGroupPayload 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; + } + CreateSecurityGroupPayload createSecurityGroupPayload = (CreateSecurityGroupPayload) o; + return Objects.equals(this.createdAt, createSecurityGroupPayload.createdAt) + && Objects.equals(this.description, createSecurityGroupPayload.description) + && Objects.equals(this.id, createSecurityGroupPayload.id) + && Objects.equals(this.labels, createSecurityGroupPayload.labels) + && Objects.equals(this.name, createSecurityGroupPayload.name) + && Objects.equals(this.rules, createSecurityGroupPayload.rules) + && Objects.equals(this.stateful, createSecurityGroupPayload.stateful) + && Objects.equals(this.updatedAt, createSecurityGroupPayload.updatedAt) + && Objects.equals( + this.additionalProperties, createSecurityGroupPayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + createdAt, + description, + id, + labels, + name, + rules, + stateful, + updatedAt, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateSecurityGroupPayload {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" rules: ").append(toIndentedString(rules)).append("\n"); + sb.append(" stateful: ").append(toIndentedString(stateful)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).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( + "createdAt", + "description", + "id", + "labels", + "name", + "rules", + "stateful", + "updatedAt")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name")); + } + + /** + * 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 CreateSecurityGroupPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateSecurityGroupPayload.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 CreateSecurityGroupPayload is not found in the empty JSON string", + CreateSecurityGroupPayload.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateSecurityGroupPayload.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("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `description` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("description").toString())); + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if (!jsonObj.get("name").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("rules") != null && !jsonObj.get("rules").isJsonNull()) { + JsonArray jsonArrayrules = jsonObj.getAsJsonArray("rules"); + if (jsonArrayrules != null) { + // ensure the json data is an array + if (!jsonObj.get("rules").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `rules` to be an array in the JSON string but got `%s`", + jsonObj.get("rules").toString())); + } + + // validate the optional field `rules` (array) + for (int i = 0; i < jsonArrayrules.size(); i++) { + SecurityGroupRule.validateJsonElement(jsonArrayrules.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSecurityGroupPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSecurityGroupPayload' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateSecurityGroupPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSecurityGroupPayload 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 CreateSecurityGroupPayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateSecurityGroupPayload 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 CreateSecurityGroupPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSecurityGroupPayload + * @throws IOException if the JSON string is invalid with respect to CreateSecurityGroupPayload + */ + public static CreateSecurityGroupPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSecurityGroupPayload.class); + } + + /** + * Convert an instance of CreateSecurityGroupPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateSecurityGroupRulePayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateSecurityGroupRulePayload.java new file mode 100644 index 00000000..e2d5e6ff --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateSecurityGroupRulePayload.java @@ -0,0 +1,667 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; +import java.util.UUID; + +/** Object that represents a request body for security group rule creation. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateSecurityGroupRulePayload { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable private String description; + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + + @SerializedName(SERIALIZED_NAME_DIRECTION) + @javax.annotation.Nonnull + private String direction; + + public static final String SERIALIZED_NAME_ETHERTYPE = "ethertype"; + + @SerializedName(SERIALIZED_NAME_ETHERTYPE) + @javax.annotation.Nullable private String ethertype = "IPv4"; + + public static final String SERIALIZED_NAME_ICMP_PARAMETERS = "icmpParameters"; + + @SerializedName(SERIALIZED_NAME_ICMP_PARAMETERS) + @javax.annotation.Nullable private ICMPParameters icmpParameters; + + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_IP_RANGE = "ipRange"; + + @SerializedName(SERIALIZED_NAME_IP_RANGE) + @javax.annotation.Nullable private String ipRange; + + public static final String SERIALIZED_NAME_PORT_RANGE = "portRange"; + + @SerializedName(SERIALIZED_NAME_PORT_RANGE) + @javax.annotation.Nullable private PortRange portRange; + + public static final String SERIALIZED_NAME_REMOTE_SECURITY_GROUP_ID = "remoteSecurityGroupId"; + + @SerializedName(SERIALIZED_NAME_REMOTE_SECURITY_GROUP_ID) + @javax.annotation.Nullable private UUID remoteSecurityGroupId; + + public static final String SERIALIZED_NAME_SECURITY_GROUP_ID = "securityGroupId"; + + @SerializedName(SERIALIZED_NAME_SECURITY_GROUP_ID) + @javax.annotation.Nullable private UUID securityGroupId; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable private OffsetDateTime updatedAt; + + public static final String SERIALIZED_NAME_PROTOCOL = "protocol"; + + @SerializedName(SERIALIZED_NAME_PROTOCOL) + @javax.annotation.Nullable private CreateProtocol protocol; + + public CreateSecurityGroupRulePayload() {} + + public CreateSecurityGroupRulePayload( + OffsetDateTime createdAt, UUID id, UUID securityGroupId, OffsetDateTime updatedAt) { + this(); + this.createdAt = createdAt; + this.id = id; + this.securityGroupId = securityGroupId; + this.updatedAt = updatedAt; + } + + /** + * Date-time when resource was created. + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public CreateSecurityGroupRulePayload description( + @javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Description Object. Allows string up to 255 Characters. + * + * @return description + */ + @javax.annotation.Nullable public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + public CreateSecurityGroupRulePayload direction(@javax.annotation.Nonnull String direction) { + this.direction = direction; + return this; + } + + /** + * The direction of the traffic which the rule should match. Possible values: + * `ingress`, `egress`. + * + * @return direction + */ + @javax.annotation.Nonnull + public String getDirection() { + return direction; + } + + public void setDirection(@javax.annotation.Nonnull String direction) { + this.direction = direction; + } + + public CreateSecurityGroupRulePayload ethertype(@javax.annotation.Nullable String ethertype) { + this.ethertype = ethertype; + return this; + } + + /** + * The ethertype which the rule should match. Possible values: `IPv4`, + * `IPv6`. + * + * @return ethertype + */ + @javax.annotation.Nullable public String getEthertype() { + return ethertype; + } + + public void setEthertype(@javax.annotation.Nullable String ethertype) { + this.ethertype = ethertype; + } + + public CreateSecurityGroupRulePayload icmpParameters( + @javax.annotation.Nullable ICMPParameters icmpParameters) { + this.icmpParameters = icmpParameters; + return this; + } + + /** + * Get icmpParameters + * + * @return icmpParameters + */ + @javax.annotation.Nullable public ICMPParameters getIcmpParameters() { + return icmpParameters; + } + + public void setIcmpParameters(@javax.annotation.Nullable ICMPParameters icmpParameters) { + this.icmpParameters = icmpParameters; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + public CreateSecurityGroupRulePayload ipRange(@javax.annotation.Nullable String ipRange) { + this.ipRange = ipRange; + return this; + } + + /** + * The remote IP range which the rule should match. + * + * @return ipRange + */ + @javax.annotation.Nullable public String getIpRange() { + return ipRange; + } + + public void setIpRange(@javax.annotation.Nullable String ipRange) { + this.ipRange = ipRange; + } + + public CreateSecurityGroupRulePayload portRange( + @javax.annotation.Nullable PortRange portRange) { + this.portRange = portRange; + return this; + } + + /** + * Get portRange + * + * @return portRange + */ + @javax.annotation.Nullable public PortRange getPortRange() { + return portRange; + } + + public void setPortRange(@javax.annotation.Nullable PortRange portRange) { + this.portRange = portRange; + } + + public CreateSecurityGroupRulePayload remoteSecurityGroupId( + @javax.annotation.Nullable UUID remoteSecurityGroupId) { + this.remoteSecurityGroupId = remoteSecurityGroupId; + return this; + } + + /** + * The remote security group which the rule should match. + * + * @return remoteSecurityGroupId + */ + @javax.annotation.Nullable public UUID getRemoteSecurityGroupId() { + return remoteSecurityGroupId; + } + + public void setRemoteSecurityGroupId(@javax.annotation.Nullable UUID remoteSecurityGroupId) { + this.remoteSecurityGroupId = remoteSecurityGroupId; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return securityGroupId + */ + @javax.annotation.Nullable public UUID getSecurityGroupId() { + return securityGroupId; + } + + /** + * Date-time when resource was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nullable public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public CreateSecurityGroupRulePayload protocol( + @javax.annotation.Nullable CreateProtocol protocol) { + this.protocol = protocol; + return this; + } + + /** + * Get protocol + * + * @return protocol + */ + @javax.annotation.Nullable public CreateProtocol getProtocol() { + return protocol; + } + + public void setProtocol(@javax.annotation.Nullable CreateProtocol protocol) { + this.protocol = protocol; + } + + /** + * 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 CreateSecurityGroupRulePayload instance itself + */ + public CreateSecurityGroupRulePayload 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; + } + CreateSecurityGroupRulePayload createSecurityGroupRulePayload = + (CreateSecurityGroupRulePayload) o; + return Objects.equals(this.createdAt, createSecurityGroupRulePayload.createdAt) + && Objects.equals(this.description, createSecurityGroupRulePayload.description) + && Objects.equals(this.direction, createSecurityGroupRulePayload.direction) + && Objects.equals(this.ethertype, createSecurityGroupRulePayload.ethertype) + && Objects.equals( + this.icmpParameters, createSecurityGroupRulePayload.icmpParameters) + && Objects.equals(this.id, createSecurityGroupRulePayload.id) + && Objects.equals(this.ipRange, createSecurityGroupRulePayload.ipRange) + && Objects.equals(this.portRange, createSecurityGroupRulePayload.portRange) + && Objects.equals( + this.remoteSecurityGroupId, + createSecurityGroupRulePayload.remoteSecurityGroupId) + && Objects.equals( + this.securityGroupId, createSecurityGroupRulePayload.securityGroupId) + && Objects.equals(this.updatedAt, createSecurityGroupRulePayload.updatedAt) + && Objects.equals(this.protocol, createSecurityGroupRulePayload.protocol) + && Objects.equals( + this.additionalProperties, + createSecurityGroupRulePayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + createdAt, + description, + direction, + ethertype, + icmpParameters, + id, + ipRange, + portRange, + remoteSecurityGroupId, + securityGroupId, + updatedAt, + protocol, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateSecurityGroupRulePayload {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" ethertype: ").append(toIndentedString(ethertype)).append("\n"); + sb.append(" icmpParameters: ").append(toIndentedString(icmpParameters)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" ipRange: ").append(toIndentedString(ipRange)).append("\n"); + sb.append(" portRange: ").append(toIndentedString(portRange)).append("\n"); + sb.append(" remoteSecurityGroupId: ") + .append(toIndentedString(remoteSecurityGroupId)) + .append("\n"); + sb.append(" securityGroupId: ").append(toIndentedString(securityGroupId)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" protocol: ").append(toIndentedString(protocol)).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( + "createdAt", + "description", + "direction", + "ethertype", + "icmpParameters", + "id", + "ipRange", + "portRange", + "remoteSecurityGroupId", + "securityGroupId", + "updatedAt", + "protocol")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("direction")); + } + + /** + * 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 + * CreateSecurityGroupRulePayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateSecurityGroupRulePayload.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 CreateSecurityGroupRulePayload is not found in the empty JSON string", + CreateSecurityGroupRulePayload.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateSecurityGroupRulePayload.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("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `description` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("description").toString())); + } + if (!jsonObj.get("direction").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `direction` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("direction").toString())); + } + if ((jsonObj.get("ethertype") != null && !jsonObj.get("ethertype").isJsonNull()) + && !jsonObj.get("ethertype").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `ethertype` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("ethertype").toString())); + } + // validate the optional field `icmpParameters` + if (jsonObj.get("icmpParameters") != null && !jsonObj.get("icmpParameters").isJsonNull()) { + ICMPParameters.validateJsonElement(jsonObj.get("icmpParameters")); + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if ((jsonObj.get("ipRange") != null && !jsonObj.get("ipRange").isJsonNull()) + && !jsonObj.get("ipRange").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `ipRange` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("ipRange").toString())); + } + // validate the optional field `portRange` + if (jsonObj.get("portRange") != null && !jsonObj.get("portRange").isJsonNull()) { + PortRange.validateJsonElement(jsonObj.get("portRange")); + } + if ((jsonObj.get("remoteSecurityGroupId") != null + && !jsonObj.get("remoteSecurityGroupId").isJsonNull()) + && !jsonObj.get("remoteSecurityGroupId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `remoteSecurityGroupId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("remoteSecurityGroupId").toString())); + } + if ((jsonObj.get("securityGroupId") != null && !jsonObj.get("securityGroupId").isJsonNull()) + && !jsonObj.get("securityGroupId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `securityGroupId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("securityGroupId").toString())); + } + // validate the optional field `protocol` + if (jsonObj.get("protocol") != null && !jsonObj.get("protocol").isJsonNull()) { + CreateProtocol.validateJsonElement(jsonObj.get("protocol")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSecurityGroupRulePayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSecurityGroupRulePayload' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateSecurityGroupRulePayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSecurityGroupRulePayload 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 CreateSecurityGroupRulePayload read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateSecurityGroupRulePayload 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 CreateSecurityGroupRulePayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSecurityGroupRulePayload + * @throws IOException if the JSON string is invalid with respect to + * CreateSecurityGroupRulePayload + */ + public static CreateSecurityGroupRulePayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSecurityGroupRulePayload.class); + } + + /** + * Convert an instance of CreateSecurityGroupRulePayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateSecurityGroupRuleProtocol.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateSecurityGroupRuleProtocol.java new file mode 100644 index 00000000..4cc11904 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateSecurityGroupRuleProtocol.java @@ -0,0 +1,300 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** The internet protocol which the rule should match. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateSecurityGroupRuleProtocol { + public static final String SERIALIZED_NAME_PROTOCOL = "protocol"; + + @SerializedName(SERIALIZED_NAME_PROTOCOL) + @javax.annotation.Nullable private CreateProtocol protocol; + + public CreateSecurityGroupRuleProtocol() {} + + public CreateSecurityGroupRuleProtocol protocol( + @javax.annotation.Nullable CreateProtocol protocol) { + this.protocol = protocol; + return this; + } + + /** + * Get protocol + * + * @return protocol + */ + @javax.annotation.Nullable public CreateProtocol getProtocol() { + return protocol; + } + + public void setProtocol(@javax.annotation.Nullable CreateProtocol protocol) { + this.protocol = protocol; + } + + /** + * 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 CreateSecurityGroupRuleProtocol instance itself + */ + public CreateSecurityGroupRuleProtocol 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; + } + CreateSecurityGroupRuleProtocol createSecurityGroupRuleProtocol = + (CreateSecurityGroupRuleProtocol) o; + return Objects.equals(this.protocol, createSecurityGroupRuleProtocol.protocol) + && Objects.equals( + this.additionalProperties, + createSecurityGroupRuleProtocol.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(protocol, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateSecurityGroupRuleProtocol {\n"); + sb.append(" protocol: ").append(toIndentedString(protocol)).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("protocol")); + + // 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 + * CreateSecurityGroupRuleProtocol + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateSecurityGroupRuleProtocol.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 CreateSecurityGroupRuleProtocol is not found in the empty JSON string", + CreateSecurityGroupRuleProtocol.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `protocol` + if (jsonObj.get("protocol") != null && !jsonObj.get("protocol").isJsonNull()) { + CreateProtocol.validateJsonElement(jsonObj.get("protocol")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSecurityGroupRuleProtocol.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSecurityGroupRuleProtocol' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateSecurityGroupRuleProtocol.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSecurityGroupRuleProtocol 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 CreateSecurityGroupRuleProtocol read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateSecurityGroupRuleProtocol 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 CreateSecurityGroupRuleProtocol given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSecurityGroupRuleProtocol + * @throws IOException if the JSON string is invalid with respect to + * CreateSecurityGroupRuleProtocol + */ + public static CreateSecurityGroupRuleProtocol fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSecurityGroupRuleProtocol.class); + } + + /** + * Convert an instance of CreateSecurityGroupRuleProtocol to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateServerNetworking.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateServerNetworking.java new file mode 100644 index 00000000..7868c23f --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateServerNetworking.java @@ -0,0 +1,201 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; + +/** The initial networking setup for the server creation with a network. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateServerNetworking { + public static final String SERIALIZED_NAME_NETWORK_ID = "networkId"; + + @SerializedName(SERIALIZED_NAME_NETWORK_ID) + @javax.annotation.Nullable private UUID networkId; + + public CreateServerNetworking() {} + + public CreateServerNetworking networkId(@javax.annotation.Nullable UUID networkId) { + this.networkId = networkId; + return this; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return networkId + */ + @javax.annotation.Nullable public UUID getNetworkId() { + return networkId; + } + + public void setNetworkId(@javax.annotation.Nullable UUID networkId) { + this.networkId = networkId; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateServerNetworking createServerNetworking = (CreateServerNetworking) o; + return Objects.equals(this.networkId, createServerNetworking.networkId); + } + + @Override + public int hashCode() { + return Objects.hash(networkId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateServerNetworking {\n"); + sb.append(" networkId: ").append(toIndentedString(networkId)).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("networkId")); + + // 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 CreateServerNetworking + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateServerNetworking.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 CreateServerNetworking is not found in the empty JSON string", + CreateServerNetworking.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateServerNetworking.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "The field `%s` in the JSON string is not defined in the `CreateServerNetworking` properties. JSON: %s", + entry.getKey(), + jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("networkId") != null && !jsonObj.get("networkId").isJsonNull()) + && !jsonObj.get("networkId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `networkId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("networkId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateServerNetworking.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateServerNetworking' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateServerNetworking.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateServerNetworking value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateServerNetworking read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateServerNetworking given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateServerNetworking + * @throws IOException if the JSON string is invalid with respect to CreateServerNetworking + */ + public static CreateServerNetworking fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateServerNetworking.class); + } + + /** + * Convert an instance of CreateServerNetworking to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateServerNetworkingWithNics.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateServerNetworkingWithNics.java new file mode 100644 index 00000000..c862bb71 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateServerNetworkingWithNics.java @@ -0,0 +1,219 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; + +/** The initial networking setup for the server creation with a network interface. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateServerNetworkingWithNics { + public static final String SERIALIZED_NAME_NIC_IDS = "nicIds"; + + @SerializedName(SERIALIZED_NAME_NIC_IDS) + @javax.annotation.Nullable private List nicIds = new ArrayList<>(); + + public CreateServerNetworkingWithNics() {} + + public CreateServerNetworkingWithNics nicIds(@javax.annotation.Nullable List nicIds) { + this.nicIds = nicIds; + return this; + } + + public CreateServerNetworkingWithNics addNicIdsItem(UUID nicIdsItem) { + if (this.nicIds == null) { + this.nicIds = new ArrayList<>(); + } + this.nicIds.add(nicIdsItem); + return this; + } + + /** + * A list of UUIDs. + * + * @return nicIds + */ + @javax.annotation.Nullable public List getNicIds() { + return nicIds; + } + + public void setNicIds(@javax.annotation.Nullable List nicIds) { + this.nicIds = nicIds; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateServerNetworkingWithNics createServerNetworkingWithNics = + (CreateServerNetworkingWithNics) o; + return Objects.equals(this.nicIds, createServerNetworkingWithNics.nicIds); + } + + @Override + public int hashCode() { + return Objects.hash(nicIds); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateServerNetworkingWithNics {\n"); + sb.append(" nicIds: ").append(toIndentedString(nicIds)).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("nicIds")); + + // 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 + * CreateServerNetworkingWithNics + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateServerNetworkingWithNics.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 CreateServerNetworkingWithNics is not found in the empty JSON string", + CreateServerNetworkingWithNics.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateServerNetworkingWithNics.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "The field `%s` in the JSON string is not defined in the `CreateServerNetworkingWithNics` properties. JSON: %s", + entry.getKey(), + jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("nicIds") != null + && !jsonObj.get("nicIds").isJsonNull() + && !jsonObj.get("nicIds").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `nicIds` to be an array in the JSON string but got `%s`", + jsonObj.get("nicIds").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateServerNetworkingWithNics.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateServerNetworkingWithNics' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateServerNetworkingWithNics.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateServerNetworkingWithNics value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateServerNetworkingWithNics read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateServerNetworkingWithNics given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateServerNetworkingWithNics + * @throws IOException if the JSON string is invalid with respect to + * CreateServerNetworkingWithNics + */ + public static CreateServerNetworkingWithNics fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateServerNetworkingWithNics.class); + } + + /** + * Convert an instance of CreateServerNetworkingWithNics to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateServerPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateServerPayload.java new file mode 100644 index 00000000..3f9c93fa --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateServerPayload.java @@ -0,0 +1,1097 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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.time.OffsetDateTime; +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; +import java.util.UUID; + +/** Representation of a single server object. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateServerPayload { + public static final String SERIALIZED_NAME_AFFINITY_GROUP = "affinityGroup"; + + @SerializedName(SERIALIZED_NAME_AFFINITY_GROUP) + @javax.annotation.Nullable private UUID affinityGroup; + + public static final String SERIALIZED_NAME_AGENT = "agent"; + + @SerializedName(SERIALIZED_NAME_AGENT) + @javax.annotation.Nullable private ServerAgent agent; + + public static final String SERIALIZED_NAME_AVAILABILITY_ZONE = "availabilityZone"; + + @SerializedName(SERIALIZED_NAME_AVAILABILITY_ZONE) + @javax.annotation.Nullable private String availabilityZone; + + public static final String SERIALIZED_NAME_BOOT_VOLUME = "bootVolume"; + + @SerializedName(SERIALIZED_NAME_BOOT_VOLUME) + @javax.annotation.Nullable private BootVolume bootVolume; + + public static final String SERIALIZED_NAME_CONFIG_DRIVE = "configDrive"; + + @SerializedName(SERIALIZED_NAME_CONFIG_DRIVE) + @javax.annotation.Nullable private Boolean configDrive = false; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_ERROR_MESSAGE = "errorMessage"; + + @SerializedName(SERIALIZED_NAME_ERROR_MESSAGE) + @javax.annotation.Nullable private String errorMessage; + + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_IMAGE_ID = "imageId"; + + @SerializedName(SERIALIZED_NAME_IMAGE_ID) + @javax.annotation.Nullable private UUID imageId; + + public static final String SERIALIZED_NAME_KEYPAIR_NAME = "keypairName"; + + @SerializedName(SERIALIZED_NAME_KEYPAIR_NAME) + @javax.annotation.Nullable private String keypairName; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_LAUNCHED_AT = "launchedAt"; + + @SerializedName(SERIALIZED_NAME_LAUNCHED_AT) + @javax.annotation.Nullable private OffsetDateTime launchedAt; + + public static final String SERIALIZED_NAME_MACHINE_TYPE = "machineType"; + + @SerializedName(SERIALIZED_NAME_MACHINE_TYPE) + @javax.annotation.Nonnull + private String machineType; + + public static final String SERIALIZED_NAME_MAINTENANCE_WINDOW = "maintenanceWindow"; + + @SerializedName(SERIALIZED_NAME_MAINTENANCE_WINDOW) + @javax.annotation.Nullable private ServerMaintenance maintenanceWindow; + + public static final String SERIALIZED_NAME_METADATA = "metadata"; + + @SerializedName(SERIALIZED_NAME_METADATA) + @javax.annotation.Nullable private Object metadata; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_NETWORKING = "networking"; + + @SerializedName(SERIALIZED_NAME_NETWORKING) + @javax.annotation.Nullable private CreateServerPayloadNetworking networking; + + public static final String SERIALIZED_NAME_NICS = "nics"; + + @SerializedName(SERIALIZED_NAME_NICS) + @javax.annotation.Nullable private List nics; + + public static final String SERIALIZED_NAME_POWER_STATUS = "powerStatus"; + + @SerializedName(SERIALIZED_NAME_POWER_STATUS) + @javax.annotation.Nullable private String powerStatus; + + public static final String SERIALIZED_NAME_SECURITY_GROUPS = "securityGroups"; + + @SerializedName(SERIALIZED_NAME_SECURITY_GROUPS) + @javax.annotation.Nullable private List securityGroups; + + public static final String SERIALIZED_NAME_SERVICE_ACCOUNT_MAILS = "serviceAccountMails"; + + @SerializedName(SERIALIZED_NAME_SERVICE_ACCOUNT_MAILS) + @javax.annotation.Nullable private List serviceAccountMails; + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable private String status; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable private OffsetDateTime updatedAt; + + public static final String SERIALIZED_NAME_USER_DATA = "userData"; + + @SerializedName(SERIALIZED_NAME_USER_DATA) + @javax.annotation.Nullable private byte[] userData; + + public static final String SERIALIZED_NAME_VOLUMES = "volumes"; + + @SerializedName(SERIALIZED_NAME_VOLUMES) + @javax.annotation.Nullable private List volumes; + + public CreateServerPayload() {} + + public CreateServerPayload( + OffsetDateTime createdAt, + String errorMessage, + UUID id, + OffsetDateTime launchedAt, + ServerMaintenance maintenanceWindow, + List nics, + String powerStatus, + String status, + OffsetDateTime updatedAt) { + this(); + this.createdAt = createdAt; + this.errorMessage = errorMessage; + this.id = id; + this.launchedAt = launchedAt; + this.maintenanceWindow = maintenanceWindow; + this.nics = nics; + this.powerStatus = powerStatus; + this.status = status; + this.updatedAt = updatedAt; + } + + public CreateServerPayload affinityGroup(@javax.annotation.Nullable UUID affinityGroup) { + this.affinityGroup = affinityGroup; + return this; + } + + /** + * The affinity group the server is assigned to. + * + * @return affinityGroup + */ + @javax.annotation.Nullable public UUID getAffinityGroup() { + return affinityGroup; + } + + public void setAffinityGroup(@javax.annotation.Nullable UUID affinityGroup) { + this.affinityGroup = affinityGroup; + } + + public CreateServerPayload agent(@javax.annotation.Nullable ServerAgent agent) { + this.agent = agent; + return this; + } + + /** + * Get agent + * + * @return agent + */ + @javax.annotation.Nullable public ServerAgent getAgent() { + return agent; + } + + public void setAgent(@javax.annotation.Nullable ServerAgent agent) { + this.agent = agent; + } + + public CreateServerPayload availabilityZone( + @javax.annotation.Nullable String availabilityZone) { + this.availabilityZone = availabilityZone; + return this; + } + + /** + * This is the availability zone requested during server creation. If none is provided during + * the creation request and an existing volume will be used as boot volume it will be set to the + * same availability zone as the volume. For requests with no volumes involved it will be set to + * the metro availability zone. + * + * @return availabilityZone + */ + @javax.annotation.Nullable public String getAvailabilityZone() { + return availabilityZone; + } + + public void setAvailabilityZone(@javax.annotation.Nullable String availabilityZone) { + this.availabilityZone = availabilityZone; + } + + public CreateServerPayload bootVolume(@javax.annotation.Nullable BootVolume bootVolume) { + this.bootVolume = bootVolume; + return this; + } + + /** + * Get bootVolume + * + * @return bootVolume + */ + @javax.annotation.Nullable public BootVolume getBootVolume() { + return bootVolume; + } + + public void setBootVolume(@javax.annotation.Nullable BootVolume bootVolume) { + this.bootVolume = bootVolume; + } + + public CreateServerPayload configDrive(@javax.annotation.Nullable Boolean configDrive) { + this.configDrive = configDrive; + return this; + } + + /** + * When true the server is created with a config drive. + * + * @return configDrive + */ + @javax.annotation.Nullable public Boolean getConfigDrive() { + return configDrive; + } + + public void setConfigDrive(@javax.annotation.Nullable Boolean configDrive) { + this.configDrive = configDrive; + } + + /** + * Date-time when resource was created. + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * An error message. + * + * @return errorMessage + */ + @javax.annotation.Nullable public String getErrorMessage() { + return errorMessage; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + public CreateServerPayload imageId(@javax.annotation.Nullable UUID imageId) { + this.imageId = imageId; + return this; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return imageId + */ + @javax.annotation.Nullable public UUID getImageId() { + return imageId; + } + + public void setImageId(@javax.annotation.Nullable UUID imageId) { + this.imageId = imageId; + } + + public CreateServerPayload keypairName(@javax.annotation.Nullable String keypairName) { + this.keypairName = keypairName; + return this; + } + + /** + * The SSH keypair used during the server creation. + * + * @return keypairName + */ + @javax.annotation.Nullable public String getKeypairName() { + return keypairName; + } + + public void setKeypairName(@javax.annotation.Nullable String keypairName) { + this.keypairName = keypairName; + } + + public CreateServerPayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + /** + * Date-time when resource was launched. + * + * @return launchedAt + */ + @javax.annotation.Nullable public OffsetDateTime getLaunchedAt() { + return launchedAt; + } + + public CreateServerPayload machineType(@javax.annotation.Nonnull String machineType) { + this.machineType = machineType; + return this; + } + + /** + * Name of the machine type the server shall belong to. + * + * @return machineType + */ + @javax.annotation.Nonnull + public String getMachineType() { + return machineType; + } + + public void setMachineType(@javax.annotation.Nonnull String machineType) { + this.machineType = machineType; + } + + /** + * Get maintenanceWindow + * + * @return maintenanceWindow + */ + @javax.annotation.Nullable public ServerMaintenance getMaintenanceWindow() { + return maintenanceWindow; + } + + public CreateServerPayload metadata(@javax.annotation.Nullable Object metadata) { + this.metadata = metadata; + return this; + } + + /** + * Object that represents the metadata of an object. Regex for keys: `^[a-zA-Z0-9-_:. + * ]{1,255}$`. Regex for values: `^.{0,255}$`. Providing a `null` value + * for a key will remove that key. + * + * @return metadata + */ + @javax.annotation.Nullable public Object getMetadata() { + return metadata; + } + + public void setMetadata(@javax.annotation.Nullable Object metadata) { + this.metadata = metadata; + } + + public CreateServerPayload name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * The name for a Server. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + public CreateServerPayload networking( + @javax.annotation.Nullable CreateServerPayloadNetworking networking) { + this.networking = networking; + return this; + } + + /** + * Get networking + * + * @return networking + */ + @javax.annotation.Nullable public CreateServerPayloadNetworking getNetworking() { + return networking; + } + + public void setNetworking(@javax.annotation.Nullable CreateServerPayloadNetworking networking) { + this.networking = networking; + } + + /** + * The list of network interfaces (NICs) attached to the server. Only shown when detailed + * information is requested. + * + * @return nics + */ + @javax.annotation.Nullable public List getNics() { + return nics; + } + + /** + * The power status of a server. Possible values: `CRASHED`, `ERROR`, + * `RUNNING`, `STOPPED`. + * + * @return powerStatus + */ + @javax.annotation.Nullable public String getPowerStatus() { + return powerStatus; + } + + public CreateServerPayload securityGroups( + @javax.annotation.Nullable List securityGroups) { + this.securityGroups = securityGroups; + return this; + } + + public CreateServerPayload addSecurityGroupsItem(String securityGroupsItem) { + if (this.securityGroups == null) { + this.securityGroups = new ArrayList<>(); + } + this.securityGroups.add(securityGroupsItem); + return this; + } + + /** + * The initial security groups for the server creation. + * + * @return securityGroups + */ + @javax.annotation.Nullable public List getSecurityGroups() { + return securityGroups; + } + + public void setSecurityGroups(@javax.annotation.Nullable List securityGroups) { + this.securityGroups = securityGroups; + } + + public CreateServerPayload serviceAccountMails( + @javax.annotation.Nullable List serviceAccountMails) { + this.serviceAccountMails = serviceAccountMails; + return this; + } + + public CreateServerPayload addServiceAccountMailsItem(String serviceAccountMailsItem) { + if (this.serviceAccountMails == null) { + this.serviceAccountMails = new ArrayList<>(); + } + this.serviceAccountMails.add(serviceAccountMailsItem); + return this; + } + + /** + * A list of service account mails. Only shown when detailed information is requested. + * + * @return serviceAccountMails + */ + @javax.annotation.Nullable public List getServiceAccountMails() { + return serviceAccountMails; + } + + public void setServiceAccountMails( + @javax.annotation.Nullable List serviceAccountMails) { + this.serviceAccountMails = serviceAccountMails; + } + + /** + * The status of a server object. Possible values: `ACTIVE`, `BACKING-UP`, + * `CREATING`, `DEALLOCATED`, `DEALLOCATING`, `DELETED`, + * `DELETING`, `ERROR`, `INACTIVE`, `MIGRATING`, + * `PAUSED`, `REBOOT`, `REBOOTING`, `REBUILD`, + * `REBUILDING`, `RESCUE`, `RESCUING`, `RESIZING`, + * `RESTORING`, `SNAPSHOTTING`, `STARTING`, `STOPPING`, + * `UNRESCUING`, `UPDATING`. + * + * @return status + */ + @javax.annotation.Nullable public String getStatus() { + return status; + } + + /** + * Date-time when resource was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nullable public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public CreateServerPayload userData(@javax.annotation.Nullable byte[] userData) { + this.userData = userData; + return this; + } + + /** + * User Data that is provided to the server. Must be base64 encoded and is passed via cloud-init + * to the server. Only shown when detailed information is requested. + * + * @return userData + */ + @javax.annotation.Nullable public byte[] getUserData() { + return userData; + } + + public void setUserData(@javax.annotation.Nullable byte[] userData) { + this.userData = userData; + } + + public CreateServerPayload volumes(@javax.annotation.Nullable List volumes) { + this.volumes = volumes; + return this; + } + + public CreateServerPayload addVolumesItem(UUID volumesItem) { + if (this.volumes == null) { + this.volumes = new ArrayList<>(); + } + this.volumes.add(volumesItem); + return this; + } + + /** + * The list of volumes attached to the server. + * + * @return volumes + */ + @javax.annotation.Nullable public List getVolumes() { + return volumes; + } + + public void setVolumes(@javax.annotation.Nullable List volumes) { + this.volumes = volumes; + } + + /** + * 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 CreateServerPayload instance itself + */ + public CreateServerPayload 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; + } + CreateServerPayload createServerPayload = (CreateServerPayload) o; + return Objects.equals(this.affinityGroup, createServerPayload.affinityGroup) + && Objects.equals(this.agent, createServerPayload.agent) + && Objects.equals(this.availabilityZone, createServerPayload.availabilityZone) + && Objects.equals(this.bootVolume, createServerPayload.bootVolume) + && Objects.equals(this.configDrive, createServerPayload.configDrive) + && Objects.equals(this.createdAt, createServerPayload.createdAt) + && Objects.equals(this.errorMessage, createServerPayload.errorMessage) + && Objects.equals(this.id, createServerPayload.id) + && Objects.equals(this.imageId, createServerPayload.imageId) + && Objects.equals(this.keypairName, createServerPayload.keypairName) + && Objects.equals(this.labels, createServerPayload.labels) + && Objects.equals(this.launchedAt, createServerPayload.launchedAt) + && Objects.equals(this.machineType, createServerPayload.machineType) + && Objects.equals(this.maintenanceWindow, createServerPayload.maintenanceWindow) + && Objects.equals(this.metadata, createServerPayload.metadata) + && Objects.equals(this.name, createServerPayload.name) + && Objects.equals(this.networking, createServerPayload.networking) + && Objects.equals(this.nics, createServerPayload.nics) + && Objects.equals(this.powerStatus, createServerPayload.powerStatus) + && Objects.equals(this.securityGroups, createServerPayload.securityGroups) + && Objects.equals(this.serviceAccountMails, createServerPayload.serviceAccountMails) + && Objects.equals(this.status, createServerPayload.status) + && Objects.equals(this.updatedAt, createServerPayload.updatedAt) + && Arrays.equals(this.userData, createServerPayload.userData) + && Objects.equals(this.volumes, createServerPayload.volumes) + && Objects.equals( + this.additionalProperties, createServerPayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + affinityGroup, + agent, + availabilityZone, + bootVolume, + configDrive, + createdAt, + errorMessage, + id, + imageId, + keypairName, + labels, + launchedAt, + machineType, + maintenanceWindow, + metadata, + name, + networking, + nics, + powerStatus, + securityGroups, + serviceAccountMails, + status, + updatedAt, + Arrays.hashCode(userData), + volumes, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateServerPayload {\n"); + sb.append(" affinityGroup: ").append(toIndentedString(affinityGroup)).append("\n"); + sb.append(" agent: ").append(toIndentedString(agent)).append("\n"); + sb.append(" availabilityZone: ").append(toIndentedString(availabilityZone)).append("\n"); + sb.append(" bootVolume: ").append(toIndentedString(bootVolume)).append("\n"); + sb.append(" configDrive: ").append(toIndentedString(configDrive)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" errorMessage: ").append(toIndentedString(errorMessage)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" imageId: ").append(toIndentedString(imageId)).append("\n"); + sb.append(" keypairName: ").append(toIndentedString(keypairName)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" launchedAt: ").append(toIndentedString(launchedAt)).append("\n"); + sb.append(" machineType: ").append(toIndentedString(machineType)).append("\n"); + sb.append(" maintenanceWindow: ") + .append(toIndentedString(maintenanceWindow)) + .append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" networking: ").append(toIndentedString(networking)).append("\n"); + sb.append(" nics: ").append(toIndentedString(nics)).append("\n"); + sb.append(" powerStatus: ").append(toIndentedString(powerStatus)).append("\n"); + sb.append(" securityGroups: ").append(toIndentedString(securityGroups)).append("\n"); + sb.append(" serviceAccountMails: ") + .append(toIndentedString(serviceAccountMails)) + .append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" userData: ").append(toIndentedString(userData)).append("\n"); + sb.append(" volumes: ").append(toIndentedString(volumes)).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( + "affinityGroup", + "agent", + "availabilityZone", + "bootVolume", + "configDrive", + "createdAt", + "errorMessage", + "id", + "imageId", + "keypairName", + "labels", + "launchedAt", + "machineType", + "maintenanceWindow", + "metadata", + "name", + "networking", + "nics", + "powerStatus", + "securityGroups", + "serviceAccountMails", + "status", + "updatedAt", + "userData", + "volumes")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("machineType", "name")); + } + + /** + * 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 CreateServerPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateServerPayload.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 CreateServerPayload is not found in the empty JSON string", + CreateServerPayload.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateServerPayload.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("affinityGroup") != null && !jsonObj.get("affinityGroup").isJsonNull()) + && !jsonObj.get("affinityGroup").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `affinityGroup` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("affinityGroup").toString())); + } + // validate the optional field `agent` + if (jsonObj.get("agent") != null && !jsonObj.get("agent").isJsonNull()) { + ServerAgent.validateJsonElement(jsonObj.get("agent")); + } + if ((jsonObj.get("availabilityZone") != null + && !jsonObj.get("availabilityZone").isJsonNull()) + && !jsonObj.get("availabilityZone").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `availabilityZone` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("availabilityZone").toString())); + } + // validate the optional field `bootVolume` + if (jsonObj.get("bootVolume") != null && !jsonObj.get("bootVolume").isJsonNull()) { + BootVolume.validateJsonElement(jsonObj.get("bootVolume")); + } + if ((jsonObj.get("errorMessage") != null && !jsonObj.get("errorMessage").isJsonNull()) + && !jsonObj.get("errorMessage").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `errorMessage` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("errorMessage").toString())); + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if ((jsonObj.get("imageId") != null && !jsonObj.get("imageId").isJsonNull()) + && !jsonObj.get("imageId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `imageId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("imageId").toString())); + } + if ((jsonObj.get("keypairName") != null && !jsonObj.get("keypairName").isJsonNull()) + && !jsonObj.get("keypairName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `keypairName` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("keypairName").toString())); + } + if (!jsonObj.get("machineType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `machineType` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("machineType").toString())); + } + // validate the optional field `maintenanceWindow` + if (jsonObj.get("maintenanceWindow") != null + && !jsonObj.get("maintenanceWindow").isJsonNull()) { + ServerMaintenance.validateJsonElement(jsonObj.get("maintenanceWindow")); + } + 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())); + } + // validate the optional field `networking` + if (jsonObj.get("networking") != null && !jsonObj.get("networking").isJsonNull()) { + CreateServerPayloadNetworking.validateJsonElement(jsonObj.get("networking")); + } + if (jsonObj.get("nics") != null && !jsonObj.get("nics").isJsonNull()) { + JsonArray jsonArraynics = jsonObj.getAsJsonArray("nics"); + if (jsonArraynics != null) { + // ensure the json data is an array + if (!jsonObj.get("nics").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `nics` to be an array in the JSON string but got `%s`", + jsonObj.get("nics").toString())); + } + + // validate the optional field `nics` (array) + for (int i = 0; i < jsonArraynics.size(); i++) { + ServerNetwork.validateJsonElement(jsonArraynics.get(i)); + } + ; + } + } + if ((jsonObj.get("powerStatus") != null && !jsonObj.get("powerStatus").isJsonNull()) + && !jsonObj.get("powerStatus").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `powerStatus` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("powerStatus").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("securityGroups") != null + && !jsonObj.get("securityGroups").isJsonNull() + && !jsonObj.get("securityGroups").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `securityGroups` to be an array in the JSON string but got `%s`", + jsonObj.get("securityGroups").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("serviceAccountMails") != null + && !jsonObj.get("serviceAccountMails").isJsonNull() + && !jsonObj.get("serviceAccountMails").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `serviceAccountMails` to be an array in the JSON string but got `%s`", + jsonObj.get("serviceAccountMails").toString())); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) + && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `status` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("status").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("volumes") != null + && !jsonObj.get("volumes").isJsonNull() + && !jsonObj.get("volumes").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `volumes` to be an array in the JSON string but got `%s`", + jsonObj.get("volumes").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateServerPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateServerPayload' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateServerPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateServerPayload 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 CreateServerPayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateServerPayload 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 CreateServerPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateServerPayload + * @throws IOException if the JSON string is invalid with respect to CreateServerPayload + */ + public static CreateServerPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateServerPayload.class); + } + + /** + * Convert an instance of CreateServerPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateServerPayloadNetworking.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateServerPayloadNetworking.java new file mode 100644 index 00000000..4ebf1d46 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateServerPayloadNetworking.java @@ -0,0 +1,303 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.v1api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +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 CreateServerPayloadNetworking extends AbstractOpenApiSchema { + private static final Logger log = + Logger.getLogger(CreateServerPayloadNetworking.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateServerPayloadNetworking.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateServerPayloadNetworking' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterCreateServerNetworking = + gson.getDelegateAdapter(this, TypeToken.get(CreateServerNetworking.class)); + final TypeAdapter + adapterCreateServerNetworkingWithNics = + gson.getDelegateAdapter( + this, TypeToken.get(CreateServerNetworkingWithNics.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateServerPayloadNetworking value) + throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `CreateServerNetworking` + if (value.getActualInstance() instanceof CreateServerNetworking) { + JsonElement element = + adapterCreateServerNetworking.toJsonTree( + (CreateServerNetworking) value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type + // `CreateServerNetworkingWithNics` + if (value.getActualInstance() + instanceof CreateServerNetworkingWithNics) { + JsonElement element = + adapterCreateServerNetworkingWithNics.toJsonTree( + (CreateServerNetworkingWithNics) + value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException( + "Failed to serialize as the type doesn't match oneOf schemas: CreateServerNetworking, CreateServerNetworkingWithNics"); + } + + @Override + public CreateServerPayloadNetworking read(JsonReader in) + throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize CreateServerNetworking + try { + // validate the JSON object to see if any exception is thrown + CreateServerNetworking.validateJsonElement(jsonElement); + actualAdapter = adapterCreateServerNetworking; + match++; + log.log( + Level.FINER, + "Input data matches schema 'CreateServerNetworking'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for CreateServerNetworking failed with `%s`.", + e.getMessage())); + log.log( + Level.FINER, + "Input data does not match schema 'CreateServerNetworking'", + e); + } + // deserialize CreateServerNetworkingWithNics + try { + // validate the JSON object to see if any exception is thrown + CreateServerNetworkingWithNics.validateJsonElement(jsonElement); + actualAdapter = adapterCreateServerNetworkingWithNics; + match++; + log.log( + Level.FINER, + "Input data matches schema 'CreateServerNetworkingWithNics'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for CreateServerNetworkingWithNics failed with `%s`.", + e.getMessage())); + log.log( + Level.FINER, + "Input data does not match schema 'CreateServerNetworkingWithNics'", + e); + } + + if (match == 1) { + CreateServerPayloadNetworking ret = + new CreateServerPayloadNetworking(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException( + String.format( + java.util.Locale.ROOT, + "Failed deserialization for CreateServerPayloadNetworking: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", + match, + errorMessages, + jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public CreateServerPayloadNetworking() { + super("oneOf", Boolean.FALSE); + } + + public CreateServerPayloadNetworking(Object o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("CreateServerNetworking", CreateServerNetworking.class); + schemas.put("CreateServerNetworkingWithNics", CreateServerNetworkingWithNics.class); + } + + @Override + public Map> getSchemas() { + return CreateServerPayloadNetworking.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: CreateServerNetworking, CreateServerNetworkingWithNics + * + *

It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof CreateServerNetworking) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof CreateServerNetworkingWithNics) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException( + "Invalid instance type. Must be CreateServerNetworking, CreateServerNetworkingWithNics"); + } + + /** + * Get the actual instance, which can be the following: CreateServerNetworking, + * CreateServerNetworkingWithNics + * + * @return The actual instance (CreateServerNetworking, CreateServerNetworkingWithNics) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `CreateServerNetworking`. If the actual instance is not + * `CreateServerNetworking`, the ClassCastException will be thrown. + * + * @return The actual instance of `CreateServerNetworking` + * @throws ClassCastException if the instance is not `CreateServerNetworking` + */ + public CreateServerNetworking getCreateServerNetworking() throws ClassCastException { + return (CreateServerNetworking) super.getActualInstance(); + } + + /** + * Get the actual instance of `CreateServerNetworkingWithNics`. If the actual instance is not + * `CreateServerNetworkingWithNics`, the ClassCastException will be thrown. + * + * @return The actual instance of `CreateServerNetworkingWithNics` + * @throws ClassCastException if the instance is not `CreateServerNetworkingWithNics` + */ + public CreateServerNetworkingWithNics getCreateServerNetworkingWithNics() + throws ClassCastException { + return (CreateServerNetworkingWithNics) 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 + * CreateServerPayloadNetworking + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with CreateServerNetworking + try { + CreateServerNetworking.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for CreateServerNetworking failed with `%s`.", + e.getMessage())); + // continue to the next one + } + // validate the json string with CreateServerNetworkingWithNics + try { + CreateServerNetworkingWithNics.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for CreateServerNetworkingWithNics failed with `%s`.", + e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException( + String.format( + java.util.Locale.ROOT, + "The JSON string is invalid for CreateServerPayloadNetworking with oneOf schemas: CreateServerNetworking, CreateServerNetworkingWithNics. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", + validCount, + errorMessages, + jsonElement.toString())); + } + } + + /** + * Create an instance of CreateServerPayloadNetworking given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateServerPayloadNetworking + * @throws IOException if the JSON string is invalid with respect to + * CreateServerPayloadNetworking + */ + public static CreateServerPayloadNetworking fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateServerPayloadNetworking.class); + } + + /** + * Convert an instance of CreateServerPayloadNetworking to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateSnapshotPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateSnapshotPayload.java new file mode 100644 index 00000000..7becdec3 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateSnapshotPayload.java @@ -0,0 +1,534 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; +import java.util.UUID; + +/** Object that represents a snapshot. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateSnapshotPayload { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable private String description; + + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; + + public static final String SERIALIZED_NAME_SIZE = "size"; + + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nullable private Long size; + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable private String status; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable private OffsetDateTime updatedAt; + + public static final String SERIALIZED_NAME_VOLUME_ID = "volumeId"; + + @SerializedName(SERIALIZED_NAME_VOLUME_ID) + @javax.annotation.Nonnull + private UUID volumeId; + + public CreateSnapshotPayload() {} + + public CreateSnapshotPayload( + OffsetDateTime createdAt, UUID id, Long size, String status, OffsetDateTime updatedAt) { + this(); + this.createdAt = createdAt; + this.id = id; + this.size = size; + this.status = status; + this.updatedAt = updatedAt; + } + + /** + * Date-time when resource was created. + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public CreateSnapshotPayload description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Description Object. Allows string up to 255 Characters. + * + * @return description + */ + @javax.annotation.Nullable public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + public CreateSnapshotPayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public CreateSnapshotPayload name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nullable public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * Size in Gigabyte. + * + * @return size + */ + @javax.annotation.Nullable public Long getSize() { + return size; + } + + /** + * The status of a snapshot object. Possible values: `AVAILABLE`, + * `BACKING-UP`, `CREATING`, `DELETED`, `DELETING`, + * `ERROR`, `RESTORING`, `UNMANAGING`, `UPDATING`. + * + * @return status + */ + @javax.annotation.Nullable public String getStatus() { + return status; + } + + /** + * Date-time when resource was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nullable public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public CreateSnapshotPayload volumeId(@javax.annotation.Nonnull UUID volumeId) { + this.volumeId = volumeId; + return this; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return volumeId + */ + @javax.annotation.Nonnull + public UUID getVolumeId() { + return volumeId; + } + + public void setVolumeId(@javax.annotation.Nonnull UUID volumeId) { + this.volumeId = volumeId; + } + + /** + * 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 CreateSnapshotPayload instance itself + */ + public CreateSnapshotPayload 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; + } + CreateSnapshotPayload createSnapshotPayload = (CreateSnapshotPayload) o; + return Objects.equals(this.createdAt, createSnapshotPayload.createdAt) + && Objects.equals(this.description, createSnapshotPayload.description) + && Objects.equals(this.id, createSnapshotPayload.id) + && Objects.equals(this.labels, createSnapshotPayload.labels) + && Objects.equals(this.name, createSnapshotPayload.name) + && Objects.equals(this.size, createSnapshotPayload.size) + && Objects.equals(this.status, createSnapshotPayload.status) + && Objects.equals(this.updatedAt, createSnapshotPayload.updatedAt) + && Objects.equals(this.volumeId, createSnapshotPayload.volumeId) + && Objects.equals( + this.additionalProperties, createSnapshotPayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + createdAt, + description, + id, + labels, + name, + size, + status, + updatedAt, + volumeId, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateSnapshotPayload {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" volumeId: ").append(toIndentedString(volumeId)).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( + "createdAt", + "description", + "id", + "labels", + "name", + "size", + "status", + "updatedAt", + "volumeId")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("volumeId")); + } + + /** + * 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 CreateSnapshotPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateSnapshotPayload.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 CreateSnapshotPayload is not found in the empty JSON string", + CreateSnapshotPayload.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateSnapshotPayload.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("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `description` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("description").toString())); + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `name` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("name").toString())); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) + && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `status` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("status").toString())); + } + if (!jsonObj.get("volumeId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `volumeId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("volumeId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSnapshotPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSnapshotPayload' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateSnapshotPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSnapshotPayload 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 CreateSnapshotPayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateSnapshotPayload 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 CreateSnapshotPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSnapshotPayload + * @throws IOException if the JSON string is invalid with respect to CreateSnapshotPayload + */ + public static CreateSnapshotPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSnapshotPayload.class); + } + + /** + * Convert an instance of CreateSnapshotPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateVolumePayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateVolumePayload.java new file mode 100644 index 00000000..234f46b6 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/CreateVolumePayload.java @@ -0,0 +1,755 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; +import java.util.UUID; + +/** + * Object that represents a volume and its parameters. Volumes sized up to 16000GB are supported. + */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateVolumePayload { + public static final String SERIALIZED_NAME_AVAILABILITY_ZONE = "availabilityZone"; + + @SerializedName(SERIALIZED_NAME_AVAILABILITY_ZONE) + @javax.annotation.Nonnull + private String availabilityZone; + + public static final String SERIALIZED_NAME_BOOTABLE = "bootable"; + + @SerializedName(SERIALIZED_NAME_BOOTABLE) + @javax.annotation.Nullable private Boolean bootable; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable private String description; + + public static final String SERIALIZED_NAME_ENCRYPTED = "encrypted"; + + @SerializedName(SERIALIZED_NAME_ENCRYPTED) + @javax.annotation.Nullable private Boolean encrypted; + + public static final String SERIALIZED_NAME_ENCRYPTION_PARAMETERS = "encryptionParameters"; + + @SerializedName(SERIALIZED_NAME_ENCRYPTION_PARAMETERS) + @javax.annotation.Nullable private VolumeEncryptionParameter encryptionParameters; + + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_IMAGE_CONFIG = "imageConfig"; + + @SerializedName(SERIALIZED_NAME_IMAGE_CONFIG) + @javax.annotation.Nullable private ImageConfig imageConfig; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; + + public static final String SERIALIZED_NAME_PERFORMANCE_CLASS = "performanceClass"; + + @SerializedName(SERIALIZED_NAME_PERFORMANCE_CLASS) + @javax.annotation.Nullable private String performanceClass; + + public static final String SERIALIZED_NAME_SERVER_ID = "serverId"; + + @SerializedName(SERIALIZED_NAME_SERVER_ID) + @javax.annotation.Nullable private UUID serverId; + + public static final String SERIALIZED_NAME_SIZE = "size"; + + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nullable private Long size; + + public static final String SERIALIZED_NAME_SOURCE = "source"; + + @SerializedName(SERIALIZED_NAME_SOURCE) + @javax.annotation.Nullable private VolumeSource source; + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable private String status; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable private OffsetDateTime updatedAt; + + public CreateVolumePayload() {} + + public CreateVolumePayload( + OffsetDateTime createdAt, + Boolean encrypted, + UUID id, + ImageConfig imageConfig, + UUID serverId, + String status, + OffsetDateTime updatedAt) { + this(); + this.createdAt = createdAt; + this.encrypted = encrypted; + this.id = id; + this.imageConfig = imageConfig; + this.serverId = serverId; + this.status = status; + this.updatedAt = updatedAt; + } + + public CreateVolumePayload availabilityZone(@javax.annotation.Nonnull String availabilityZone) { + this.availabilityZone = availabilityZone; + return this; + } + + /** + * Object that represents an availability zone. + * + * @return availabilityZone + */ + @javax.annotation.Nonnull + public String getAvailabilityZone() { + return availabilityZone; + } + + public void setAvailabilityZone(@javax.annotation.Nonnull String availabilityZone) { + this.availabilityZone = availabilityZone; + } + + public CreateVolumePayload bootable(@javax.annotation.Nullable Boolean bootable) { + this.bootable = bootable; + return this; + } + + /** + * Indicates if a volume is bootable. + * + * @return bootable + */ + @javax.annotation.Nullable public Boolean getBootable() { + return bootable; + } + + public void setBootable(@javax.annotation.Nullable Boolean bootable) { + this.bootable = bootable; + } + + /** + * Date-time when resource was created. + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public CreateVolumePayload description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Description Object. Allows string up to 255 Characters. + * + * @return description + */ + @javax.annotation.Nullable public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + /** + * Indicates if a volume is encrypted. + * + * @return encrypted + */ + @javax.annotation.Nullable public Boolean getEncrypted() { + return encrypted; + } + + public CreateVolumePayload encryptionParameters( + @javax.annotation.Nullable VolumeEncryptionParameter encryptionParameters) { + this.encryptionParameters = encryptionParameters; + return this; + } + + /** + * Get encryptionParameters + * + * @return encryptionParameters + */ + @javax.annotation.Nullable public VolumeEncryptionParameter getEncryptionParameters() { + return encryptionParameters; + } + + public void setEncryptionParameters( + @javax.annotation.Nullable VolumeEncryptionParameter encryptionParameters) { + this.encryptionParameters = encryptionParameters; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + /** + * Get imageConfig + * + * @return imageConfig + */ + @javax.annotation.Nullable public ImageConfig getImageConfig() { + return imageConfig; + } + + public CreateVolumePayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public CreateVolumePayload name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nullable public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + public CreateVolumePayload performanceClass( + @javax.annotation.Nullable String performanceClass) { + this.performanceClass = performanceClass; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return performanceClass + */ + @javax.annotation.Nullable public String getPerformanceClass() { + return performanceClass; + } + + public void setPerformanceClass(@javax.annotation.Nullable String performanceClass) { + this.performanceClass = performanceClass; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return serverId + */ + @javax.annotation.Nullable public UUID getServerId() { + return serverId; + } + + public CreateVolumePayload size(@javax.annotation.Nullable Long size) { + this.size = size; + return this; + } + + /** + * Size in Gigabyte. + * + * @return size + */ + @javax.annotation.Nullable public Long getSize() { + return size; + } + + public void setSize(@javax.annotation.Nullable Long size) { + this.size = size; + } + + public CreateVolumePayload source(@javax.annotation.Nullable VolumeSource source) { + this.source = source; + return this; + } + + /** + * Get source + * + * @return source + */ + @javax.annotation.Nullable public VolumeSource getSource() { + return source; + } + + public void setSource(@javax.annotation.Nullable VolumeSource source) { + this.source = source; + } + + /** + * The status of a volume object. Possible values: `ATTACHED`, `ATTACHING`, + * `AVAILABLE`, `AWAITING-TRANSFER`, `BACKING-UP`, + * `CREATING`, `DELETED`, `DELETING`, `DETACHING`, + * `DOWNLOADING`, `ERROR`, `ERROR_BACKING-UP`, + * `ERROR_DELETING`, `ERROR_RESIZING`, `ERROR_RESTORING-BACKUP`, + * `MAINTENANCE`, `RESERVED`, `RESIZING`, + * `RESTORING-BACKUP`, `RETYPING`, `UPLOADING`. + * + * @return status + */ + @javax.annotation.Nullable public String getStatus() { + return status; + } + + /** + * Date-time when resource was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nullable public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * 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 CreateVolumePayload instance itself + */ + public CreateVolumePayload 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; + } + CreateVolumePayload createVolumePayload = (CreateVolumePayload) o; + return Objects.equals(this.availabilityZone, createVolumePayload.availabilityZone) + && Objects.equals(this.bootable, createVolumePayload.bootable) + && Objects.equals(this.createdAt, createVolumePayload.createdAt) + && Objects.equals(this.description, createVolumePayload.description) + && Objects.equals(this.encrypted, createVolumePayload.encrypted) + && Objects.equals( + this.encryptionParameters, createVolumePayload.encryptionParameters) + && Objects.equals(this.id, createVolumePayload.id) + && Objects.equals(this.imageConfig, createVolumePayload.imageConfig) + && Objects.equals(this.labels, createVolumePayload.labels) + && Objects.equals(this.name, createVolumePayload.name) + && Objects.equals(this.performanceClass, createVolumePayload.performanceClass) + && Objects.equals(this.serverId, createVolumePayload.serverId) + && Objects.equals(this.size, createVolumePayload.size) + && Objects.equals(this.source, createVolumePayload.source) + && Objects.equals(this.status, createVolumePayload.status) + && Objects.equals(this.updatedAt, createVolumePayload.updatedAt) + && Objects.equals( + this.additionalProperties, createVolumePayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + availabilityZone, + bootable, + createdAt, + description, + encrypted, + encryptionParameters, + id, + imageConfig, + labels, + name, + performanceClass, + serverId, + size, + source, + status, + updatedAt, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateVolumePayload {\n"); + sb.append(" availabilityZone: ").append(toIndentedString(availabilityZone)).append("\n"); + sb.append(" bootable: ").append(toIndentedString(bootable)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" encrypted: ").append(toIndentedString(encrypted)).append("\n"); + sb.append(" encryptionParameters: ") + .append(toIndentedString(encryptionParameters)) + .append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" imageConfig: ").append(toIndentedString(imageConfig)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" performanceClass: ").append(toIndentedString(performanceClass)).append("\n"); + sb.append(" serverId: ").append(toIndentedString(serverId)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" source: ").append(toIndentedString(source)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).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( + "availabilityZone", + "bootable", + "createdAt", + "description", + "encrypted", + "encryptionParameters", + "id", + "imageConfig", + "labels", + "name", + "performanceClass", + "serverId", + "size", + "source", + "status", + "updatedAt")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("availabilityZone")); + } + + /** + * 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 CreateVolumePayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateVolumePayload.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 CreateVolumePayload is not found in the empty JSON string", + CreateVolumePayload.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateVolumePayload.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("availabilityZone").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `availabilityZone` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("availabilityZone").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `description` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("description").toString())); + } + // validate the optional field `encryptionParameters` + if (jsonObj.get("encryptionParameters") != null + && !jsonObj.get("encryptionParameters").isJsonNull()) { + VolumeEncryptionParameter.validateJsonElement(jsonObj.get("encryptionParameters")); + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + // validate the optional field `imageConfig` + if (jsonObj.get("imageConfig") != null && !jsonObj.get("imageConfig").isJsonNull()) { + ImageConfig.validateJsonElement(jsonObj.get("imageConfig")); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `name` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("name").toString())); + } + if ((jsonObj.get("performanceClass") != null + && !jsonObj.get("performanceClass").isJsonNull()) + && !jsonObj.get("performanceClass").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `performanceClass` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("performanceClass").toString())); + } + if ((jsonObj.get("serverId") != null && !jsonObj.get("serverId").isJsonNull()) + && !jsonObj.get("serverId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `serverId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("serverId").toString())); + } + // validate the optional field `source` + if (jsonObj.get("source") != null && !jsonObj.get("source").isJsonNull()) { + VolumeSource.validateJsonElement(jsonObj.get("source")); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) + && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `status` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("status").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateVolumePayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateVolumePayload' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateVolumePayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateVolumePayload 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 CreateVolumePayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateVolumePayload 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 CreateVolumePayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateVolumePayload + * @throws IOException if the JSON string is invalid with respect to CreateVolumePayload + */ + public static CreateVolumePayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateVolumePayload.class); + } + + /** + * Convert an instance of CreateVolumePayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/Error.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/Error.java new file mode 100644 index 00000000..cb5481fe --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/Error.java @@ -0,0 +1,333 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** Error with HTTP error code and an error message. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class Error { + public static final String SERIALIZED_NAME_CODE = "code"; + + @SerializedName(SERIALIZED_NAME_CODE) + @javax.annotation.Nonnull + private Long code; + + public static final String SERIALIZED_NAME_MSG = "msg"; + + @SerializedName(SERIALIZED_NAME_MSG) + @javax.annotation.Nonnull + private String msg; + + public Error() {} + + public Error code(@javax.annotation.Nonnull Long code) { + this.code = code; + return this; + } + + /** + * Get code + * + * @return code + */ + @javax.annotation.Nonnull + public Long getCode() { + return code; + } + + public void setCode(@javax.annotation.Nonnull Long code) { + this.code = code; + } + + public Error msg(@javax.annotation.Nonnull String msg) { + this.msg = msg; + return this; + } + + /** + * An error message. + * + * @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 Error instance itself + */ + public Error 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; + } + Error error = (Error) o; + return Objects.equals(this.code, error.code) + && Objects.equals(this.msg, error.msg) + && Objects.equals(this.additionalProperties, error.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(code, msg, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Error {\n"); + sb.append(" code: ").append(toIndentedString(code)).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("code", "msg")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("code", "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 Error + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Error.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 Error is not found in the empty JSON string", + Error.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Error.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("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 (!Error.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Error' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(Error.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, Error 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 Error read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Error 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 Error given an JSON string + * + * @param jsonString JSON string + * @return An instance of Error + * @throws IOException if the JSON string is invalid with respect to Error + */ + public static Error fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Error.class); + } + + /** + * Convert an instance of Error to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/GetServerLog200Response.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/GetServerLog200Response.java new file mode 100644 index 00000000..0567126a --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/GetServerLog200Response.java @@ -0,0 +1,296 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** GetServerLog200Response */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class GetServerLog200Response { + public static final String SERIALIZED_NAME_OUTPUT = "output"; + + @SerializedName(SERIALIZED_NAME_OUTPUT) + @javax.annotation.Nullable private String output; + + public GetServerLog200Response() {} + + public GetServerLog200Response output(@javax.annotation.Nullable String output) { + this.output = output; + return this; + } + + /** + * Get output + * + * @return output + */ + @javax.annotation.Nullable public String getOutput() { + return output; + } + + public void setOutput(@javax.annotation.Nullable String output) { + this.output = output; + } + + /** + * 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 GetServerLog200Response instance itself + */ + public GetServerLog200Response 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; + } + GetServerLog200Response getServerLog200Response = (GetServerLog200Response) o; + return Objects.equals(this.output, getServerLog200Response.output) + && Objects.equals( + this.additionalProperties, getServerLog200Response.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(output, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetServerLog200Response {\n"); + sb.append(" output: ").append(toIndentedString(output)).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("output")); + + // 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 GetServerLog200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetServerLog200Response.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 GetServerLog200Response is not found in the empty JSON string", + GetServerLog200Response.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("output") != null && !jsonObj.get("output").isJsonNull()) + && !jsonObj.get("output").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `output` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("output").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetServerLog200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetServerLog200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetServerLog200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetServerLog200Response 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 GetServerLog200Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + GetServerLog200Response 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 GetServerLog200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetServerLog200Response + * @throws IOException if the JSON string is invalid with respect to GetServerLog200Response + */ + public static GetServerLog200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetServerLog200Response.class); + } + + /** + * Convert an instance of GetServerLog200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ICMPParameters.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ICMPParameters.java new file mode 100644 index 00000000..264f1660 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ICMPParameters.java @@ -0,0 +1,326 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** Object that represents ICMP parameters. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class ICMPParameters { + public static final String SERIALIZED_NAME_CODE = "code"; + + @SerializedName(SERIALIZED_NAME_CODE) + @javax.annotation.Nonnull + private Long code; + + public static final String SERIALIZED_NAME_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private Long type; + + public ICMPParameters() {} + + public ICMPParameters code(@javax.annotation.Nonnull Long code) { + this.code = code; + return this; + } + + /** + * ICMP code. Can be set if the protocol is ICMP. minimum: 0 maximum: 255 + * + * @return code + */ + @javax.annotation.Nonnull + public Long getCode() { + return code; + } + + public void setCode(@javax.annotation.Nonnull Long code) { + this.code = code; + } + + public ICMPParameters type(@javax.annotation.Nonnull Long type) { + this.type = type; + return this; + } + + /** + * ICMP type. Can be set if the protocol is ICMP. minimum: 0 maximum: 255 + * + * @return type + */ + @javax.annotation.Nonnull + public Long getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull Long 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 ICMPParameters instance itself + */ + public ICMPParameters 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; + } + ICMPParameters icMPParameters = (ICMPParameters) o; + return Objects.equals(this.code, icMPParameters.code) + && Objects.equals(this.type, icMPParameters.type) + && Objects.equals(this.additionalProperties, icMPParameters.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(code, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ICMPParameters {\n"); + sb.append(" code: ").append(toIndentedString(code)).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("code", "type")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("code", "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 ICMPParameters + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ICMPParameters.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 ICMPParameters is not found in the empty JSON string", + ICMPParameters.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ICMPParameters.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "The required field `%s` is not found in the JSON string: %s", + requiredField, + jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ICMPParameters.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ICMPParameters' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ICMPParameters.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ICMPParameters 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 ICMPParameters read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ICMPParameters 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 ICMPParameters given an JSON string + * + * @param jsonString JSON string + * @return An instance of ICMPParameters + * @throws IOException if the JSON string is invalid with respect to ICMPParameters + */ + public static ICMPParameters fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ICMPParameters.class); + } + + /** + * Convert an instance of ICMPParameters to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/Image.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/Image.java new file mode 100644 index 00000000..8644b352 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/Image.java @@ -0,0 +1,748 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; +import java.util.UUID; + +/** + * Object that represents an Image and its parameters. Used for Creating and returning (get/list). + */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class Image { + public static final String SERIALIZED_NAME_AGENT = "agent"; + + @SerializedName(SERIALIZED_NAME_AGENT) + @javax.annotation.Nullable private ImageAgent agent; + + public static final String SERIALIZED_NAME_CHECKSUM = "checksum"; + + @SerializedName(SERIALIZED_NAME_CHECKSUM) + @javax.annotation.Nullable private ImageChecksum checksum; + + public static final String SERIALIZED_NAME_CONFIG = "config"; + + @SerializedName(SERIALIZED_NAME_CONFIG) + @javax.annotation.Nullable private ImageConfig config; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_DISK_FORMAT = "diskFormat"; + + @SerializedName(SERIALIZED_NAME_DISK_FORMAT) + @javax.annotation.Nonnull + private String diskFormat; + + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_IMPORT_PROGRESS = "importProgress"; + + @SerializedName(SERIALIZED_NAME_IMPORT_PROGRESS) + @javax.annotation.Nullable private Long importProgress; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_MIN_DISK_SIZE = "minDiskSize"; + + @SerializedName(SERIALIZED_NAME_MIN_DISK_SIZE) + @javax.annotation.Nullable private Long minDiskSize; + + public static final String SERIALIZED_NAME_MIN_RAM = "minRam"; + + @SerializedName(SERIALIZED_NAME_MIN_RAM) + @javax.annotation.Nullable private Long minRam; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_OWNER = "owner"; + + @SerializedName(SERIALIZED_NAME_OWNER) + @javax.annotation.Nullable private UUID owner; + + public static final String SERIALIZED_NAME_PROTECTED = "protected"; + + @SerializedName(SERIALIZED_NAME_PROTECTED) + @javax.annotation.Nullable private Boolean _protected; + + public static final String SERIALIZED_NAME_SCOPE = "scope"; + + @SerializedName(SERIALIZED_NAME_SCOPE) + @javax.annotation.Nullable private String scope; + + public static final String SERIALIZED_NAME_SIZE = "size"; + + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nullable private Long size; + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable private String status; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable private OffsetDateTime updatedAt; + + public Image() {} + + public Image( + ImageChecksum checksum, + OffsetDateTime createdAt, + UUID id, + Long importProgress, + UUID owner, + String scope, + Long size, + String status, + OffsetDateTime updatedAt) { + this(); + this.checksum = checksum; + this.createdAt = createdAt; + this.id = id; + this.importProgress = importProgress; + this.owner = owner; + this.scope = scope; + this.size = size; + this.status = status; + this.updatedAt = updatedAt; + } + + public Image agent(@javax.annotation.Nullable ImageAgent agent) { + this.agent = agent; + return this; + } + + /** + * Get agent + * + * @return agent + */ + @javax.annotation.Nullable public ImageAgent getAgent() { + return agent; + } + + public void setAgent(@javax.annotation.Nullable ImageAgent agent) { + this.agent = agent; + } + + /** + * Get checksum + * + * @return checksum + */ + @javax.annotation.Nullable public ImageChecksum getChecksum() { + return checksum; + } + + public Image config(@javax.annotation.Nullable ImageConfig config) { + this.config = config; + return this; + } + + /** + * Get config + * + * @return config + */ + @javax.annotation.Nullable public ImageConfig getConfig() { + return config; + } + + public void setConfig(@javax.annotation.Nullable ImageConfig config) { + this.config = config; + } + + /** + * Date-time when resource was created. + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public Image diskFormat(@javax.annotation.Nonnull String diskFormat) { + this.diskFormat = diskFormat; + return this; + } + + /** + * Object that represents a disk format. Possible values: `raw`, `qcow2`, + * `iso`. + * + * @return diskFormat + */ + @javax.annotation.Nonnull + public String getDiskFormat() { + return diskFormat; + } + + public void setDiskFormat(@javax.annotation.Nonnull String diskFormat) { + this.diskFormat = diskFormat; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + /** + * Indicates Image Import Progress in percent. + * + * @return importProgress + */ + @javax.annotation.Nullable public Long getImportProgress() { + return importProgress; + } + + public Image labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public Image minDiskSize(@javax.annotation.Nullable Long minDiskSize) { + this.minDiskSize = minDiskSize; + return this; + } + + /** + * Size in Gigabyte. + * + * @return minDiskSize + */ + @javax.annotation.Nullable public Long getMinDiskSize() { + return minDiskSize; + } + + public void setMinDiskSize(@javax.annotation.Nullable Long minDiskSize) { + this.minDiskSize = minDiskSize; + } + + public Image minRam(@javax.annotation.Nullable Long minRam) { + this.minRam = minRam; + return this; + } + + /** + * Size in Megabyte. + * + * @return minRam + */ + @javax.annotation.Nullable public Long getMinRam() { + return minRam; + } + + public void setMinRam(@javax.annotation.Nullable Long minRam) { + this.minRam = minRam; + } + + public Image name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return owner + */ + @javax.annotation.Nullable public UUID getOwner() { + return owner; + } + + public Image _protected(@javax.annotation.Nullable Boolean _protected) { + this._protected = _protected; + return this; + } + + /** + * When true the image is prevented from being deleted. + * + * @return _protected + */ + @javax.annotation.Nullable public Boolean getProtected() { + return _protected; + } + + public void setProtected(@javax.annotation.Nullable Boolean _protected) { + this._protected = _protected; + } + + /** + * Scope of an Image. Possible values: `public`, `local`, + * `projects`, `organization`. + * + * @return scope + */ + @javax.annotation.Nullable public String getScope() { + return scope; + } + + /** + * Size in bytes. + * + * @return size + */ + @javax.annotation.Nullable public Long getSize() { + return size; + } + + /** + * The status of an image object. Possible values: `AVAILABLE`, `CREATING`, + * `DEACTIVATED`, `DELETED`, `DELETING`, `ERROR`. + * + * @return status + */ + @javax.annotation.Nullable public String getStatus() { + return status; + } + + /** + * Date-time when resource was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nullable public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * 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 Image instance itself + */ + public Image 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; + } + Image image = (Image) o; + return Objects.equals(this.agent, image.agent) + && Objects.equals(this.checksum, image.checksum) + && Objects.equals(this.config, image.config) + && Objects.equals(this.createdAt, image.createdAt) + && Objects.equals(this.diskFormat, image.diskFormat) + && Objects.equals(this.id, image.id) + && Objects.equals(this.importProgress, image.importProgress) + && Objects.equals(this.labels, image.labels) + && Objects.equals(this.minDiskSize, image.minDiskSize) + && Objects.equals(this.minRam, image.minRam) + && Objects.equals(this.name, image.name) + && Objects.equals(this.owner, image.owner) + && Objects.equals(this._protected, image._protected) + && Objects.equals(this.scope, image.scope) + && Objects.equals(this.size, image.size) + && Objects.equals(this.status, image.status) + && Objects.equals(this.updatedAt, image.updatedAt) + && Objects.equals(this.additionalProperties, image.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + agent, + checksum, + config, + createdAt, + diskFormat, + id, + importProgress, + labels, + minDiskSize, + minRam, + name, + owner, + _protected, + scope, + size, + status, + updatedAt, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Image {\n"); + sb.append(" agent: ").append(toIndentedString(agent)).append("\n"); + sb.append(" checksum: ").append(toIndentedString(checksum)).append("\n"); + sb.append(" config: ").append(toIndentedString(config)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" diskFormat: ").append(toIndentedString(diskFormat)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" importProgress: ").append(toIndentedString(importProgress)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" minDiskSize: ").append(toIndentedString(minDiskSize)).append("\n"); + sb.append(" minRam: ").append(toIndentedString(minRam)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" owner: ").append(toIndentedString(owner)).append("\n"); + sb.append(" _protected: ").append(toIndentedString(_protected)).append("\n"); + sb.append(" scope: ").append(toIndentedString(scope)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).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( + "agent", + "checksum", + "config", + "createdAt", + "diskFormat", + "id", + "importProgress", + "labels", + "minDiskSize", + "minRam", + "name", + "owner", + "protected", + "scope", + "size", + "status", + "updatedAt")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("diskFormat", "name")); + } + + /** + * 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 Image + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Image.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 Image is not found in the empty JSON string", + Image.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Image.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 optional field `agent` + if (jsonObj.get("agent") != null && !jsonObj.get("agent").isJsonNull()) { + ImageAgent.validateJsonElement(jsonObj.get("agent")); + } + // validate the optional field `checksum` + if (jsonObj.get("checksum") != null && !jsonObj.get("checksum").isJsonNull()) { + ImageChecksum.validateJsonElement(jsonObj.get("checksum")); + } + // validate the optional field `config` + if (jsonObj.get("config") != null && !jsonObj.get("config").isJsonNull()) { + ImageConfig.validateJsonElement(jsonObj.get("config")); + } + if (!jsonObj.get("diskFormat").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `diskFormat` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("diskFormat").toString())); + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if (!jsonObj.get("name").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("owner") != null && !jsonObj.get("owner").isJsonNull()) + && !jsonObj.get("owner").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `owner` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("owner").toString())); + } + if ((jsonObj.get("scope") != null && !jsonObj.get("scope").isJsonNull()) + && !jsonObj.get("scope").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `scope` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("scope").toString())); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) + && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `status` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("status").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Image.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Image' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(Image.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, Image 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 Image read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Image 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 Image given an JSON string + * + * @param jsonString JSON string + * @return An instance of Image + * @throws IOException if the JSON string is invalid with respect to Image + */ + public static Image fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Image.class); + } + + /** + * Convert an instance of Image to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ImageAgent.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ImageAgent.java new file mode 100644 index 00000000..f752e749 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ImageAgent.java @@ -0,0 +1,313 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** Support status and default provioning setting for the STACKIT server agent. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class ImageAgent { + public static final String SERIALIZED_NAME_PROVISION_BY_DEFAULT = "provisionByDefault"; + + @SerializedName(SERIALIZED_NAME_PROVISION_BY_DEFAULT) + @javax.annotation.Nullable private Boolean provisionByDefault; + + public static final String SERIALIZED_NAME_SUPPORTED = "supported"; + + @SerializedName(SERIALIZED_NAME_SUPPORTED) + @javax.annotation.Nullable private Boolean supported; + + public ImageAgent() {} + + public ImageAgent provisionByDefault(@javax.annotation.Nullable Boolean provisionByDefault) { + this.provisionByDefault = provisionByDefault; + return this; + } + + /** + * Default provioning of the STACKIT server agent for new servers. The default for new images is + * false. Can only be enabled when supported is also true. + * + * @return provisionByDefault + */ + @javax.annotation.Nullable public Boolean getProvisionByDefault() { + return provisionByDefault; + } + + public void setProvisionByDefault(@javax.annotation.Nullable Boolean provisionByDefault) { + this.provisionByDefault = provisionByDefault; + } + + public ImageAgent supported(@javax.annotation.Nullable Boolean supported) { + this.supported = supported; + return this; + } + + /** + * Indicates the STACKIT server agent for the image. The default for new images is false. + * + * @return supported + */ + @javax.annotation.Nullable public Boolean getSupported() { + return supported; + } + + public void setSupported(@javax.annotation.Nullable Boolean supported) { + this.supported = supported; + } + + /** + * 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 ImageAgent instance itself + */ + public ImageAgent 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; + } + ImageAgent imageAgent = (ImageAgent) o; + return Objects.equals(this.provisionByDefault, imageAgent.provisionByDefault) + && Objects.equals(this.supported, imageAgent.supported) + && Objects.equals(this.additionalProperties, imageAgent.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(provisionByDefault, supported, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ImageAgent {\n"); + sb.append(" provisionByDefault: ") + .append(toIndentedString(provisionByDefault)) + .append("\n"); + sb.append(" supported: ").append(toIndentedString(supported)).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("provisionByDefault", "supported")); + + // 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 ImageAgent + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ImageAgent.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 ImageAgent is not found in the empty JSON string", + ImageAgent.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ImageAgent.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ImageAgent' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ImageAgent.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ImageAgent 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 ImageAgent read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ImageAgent 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 ImageAgent given an JSON string + * + * @param jsonString JSON string + * @return An instance of ImageAgent + * @throws IOException if the JSON string is invalid with respect to ImageAgent + */ + public static ImageAgent fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ImageAgent.class); + } + + /** + * Convert an instance of ImageAgent to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ImageChecksum.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ImageChecksum.java new file mode 100644 index 00000000..56a0457d --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ImageChecksum.java @@ -0,0 +1,341 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** Representation of an image checksum. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class ImageChecksum { + public static final String SERIALIZED_NAME_ALGORITHM = "algorithm"; + + @SerializedName(SERIALIZED_NAME_ALGORITHM) + @javax.annotation.Nonnull + private String algorithm; + + public static final String SERIALIZED_NAME_DIGEST = "digest"; + + @SerializedName(SERIALIZED_NAME_DIGEST) + @javax.annotation.Nonnull + private String digest; + + public ImageChecksum() {} + + public ImageChecksum algorithm(@javax.annotation.Nonnull String algorithm) { + this.algorithm = algorithm; + return this; + } + + /** + * Algorithm for the checksum of the image data. Possible values: `md5`, + * `sha512`. + * + * @return algorithm + */ + @javax.annotation.Nonnull + public String getAlgorithm() { + return algorithm; + } + + public void setAlgorithm(@javax.annotation.Nonnull String algorithm) { + this.algorithm = algorithm; + } + + public ImageChecksum digest(@javax.annotation.Nonnull String digest) { + this.digest = digest; + return this; + } + + /** + * Hexdigest of the checksum of the image data. + * + * @return digest + */ + @javax.annotation.Nonnull + public String getDigest() { + return digest; + } + + public void setDigest(@javax.annotation.Nonnull String digest) { + this.digest = digest; + } + + /** + * 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 ImageChecksum instance itself + */ + public ImageChecksum 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; + } + ImageChecksum imageChecksum = (ImageChecksum) o; + return Objects.equals(this.algorithm, imageChecksum.algorithm) + && Objects.equals(this.digest, imageChecksum.digest) + && Objects.equals(this.additionalProperties, imageChecksum.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(algorithm, digest, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ImageChecksum {\n"); + sb.append(" algorithm: ").append(toIndentedString(algorithm)).append("\n"); + sb.append(" digest: ").append(toIndentedString(digest)).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("algorithm", "digest")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("algorithm", "digest")); + } + + /** + * 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 ImageChecksum + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ImageChecksum.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 ImageChecksum is not found in the empty JSON string", + ImageChecksum.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ImageChecksum.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("algorithm").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `algorithm` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("algorithm").toString())); + } + if (!jsonObj.get("digest").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `digest` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("digest").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ImageChecksum.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ImageChecksum' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ImageChecksum.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ImageChecksum 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 ImageChecksum read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ImageChecksum 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 ImageChecksum given an JSON string + * + * @param jsonString JSON string + * @return An instance of ImageChecksum + * @throws IOException if the JSON string is invalid with respect to ImageChecksum + */ + public static ImageChecksum fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ImageChecksum.class); + } + + /** + * Convert an instance of ImageChecksum to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ImageConfig.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ImageConfig.java new file mode 100644 index 00000000..98849ff4 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ImageConfig.java @@ -0,0 +1,756 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.v1api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Properties to set hardware and scheduling settings for an Image. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class ImageConfig { + public static final String SERIALIZED_NAME_ARCHITECTURE = "architecture"; + + @SerializedName(SERIALIZED_NAME_ARCHITECTURE) + @javax.annotation.Nullable private String architecture; + + public static final String SERIALIZED_NAME_BOOT_MENU = "bootMenu"; + + @SerializedName(SERIALIZED_NAME_BOOT_MENU) + @javax.annotation.Nullable private Boolean bootMenu; + + public static final String SERIALIZED_NAME_CDROM_BUS = "cdromBus"; + + @SerializedName(SERIALIZED_NAME_CDROM_BUS) + @javax.annotation.Nullable private String cdromBus; + + public static final String SERIALIZED_NAME_DISK_BUS = "diskBus"; + + @SerializedName(SERIALIZED_NAME_DISK_BUS) + @javax.annotation.Nullable private String diskBus; + + public static final String SERIALIZED_NAME_NIC_MODEL = "nicModel"; + + @SerializedName(SERIALIZED_NAME_NIC_MODEL) + @javax.annotation.Nullable private String nicModel; + + public static final String SERIALIZED_NAME_OPERATING_SYSTEM = "operatingSystem"; + + @SerializedName(SERIALIZED_NAME_OPERATING_SYSTEM) + @javax.annotation.Nullable private String operatingSystem; + + public static final String SERIALIZED_NAME_OPERATING_SYSTEM_DISTRO = "operatingSystemDistro"; + + @SerializedName(SERIALIZED_NAME_OPERATING_SYSTEM_DISTRO) + @javax.annotation.Nullable private String operatingSystemDistro; + + public static final String SERIALIZED_NAME_OPERATING_SYSTEM_VERSION = "operatingSystemVersion"; + + @SerializedName(SERIALIZED_NAME_OPERATING_SYSTEM_VERSION) + @javax.annotation.Nullable private String operatingSystemVersion; + + public static final String SERIALIZED_NAME_RESCUE_BUS = "rescueBus"; + + @SerializedName(SERIALIZED_NAME_RESCUE_BUS) + @javax.annotation.Nullable private String rescueBus; + + public static final String SERIALIZED_NAME_RESCUE_DEVICE = "rescueDevice"; + + @SerializedName(SERIALIZED_NAME_RESCUE_DEVICE) + @javax.annotation.Nullable private String rescueDevice; + + public static final String SERIALIZED_NAME_SECURE_BOOT = "secureBoot"; + + @SerializedName(SERIALIZED_NAME_SECURE_BOOT) + @javax.annotation.Nullable private Boolean secureBoot; + + public static final String SERIALIZED_NAME_UEFI = "uefi"; + + @SerializedName(SERIALIZED_NAME_UEFI) + @javax.annotation.Nullable private Boolean uefi; + + public static final String SERIALIZED_NAME_VIDEO_MODEL = "videoModel"; + + @SerializedName(SERIALIZED_NAME_VIDEO_MODEL) + @javax.annotation.Nullable private String videoModel; + + public static final String SERIALIZED_NAME_VIRTIO_SCSI = "virtioScsi"; + + @SerializedName(SERIALIZED_NAME_VIRTIO_SCSI) + @javax.annotation.Nullable private Boolean virtioScsi; + + public ImageConfig() {} + + public ImageConfig architecture(@javax.annotation.Nullable String architecture) { + this.architecture = architecture; + return this; + } + + /** + * Represents CPU architecture. The default for new images is x86. Possible values: + * `arm64`, `x86`. + * + * @return architecture + */ + @javax.annotation.Nullable public String getArchitecture() { + return architecture; + } + + public void setArchitecture(@javax.annotation.Nullable String architecture) { + this.architecture = architecture; + } + + public ImageConfig bootMenu(@javax.annotation.Nullable Boolean bootMenu) { + this.bootMenu = bootMenu; + return this; + } + + /** + * Enables the BIOS bootmenu. The default for new images is disabled. + * + * @return bootMenu + */ + @javax.annotation.Nullable public Boolean getBootMenu() { + return bootMenu; + } + + public void setBootMenu(@javax.annotation.Nullable Boolean bootMenu) { + this.bootMenu = bootMenu; + } + + public ImageConfig cdromBus(@javax.annotation.Nullable String cdromBus) { + this.cdromBus = cdromBus; + return this; + } + + /** + * Sets CDROM bus controller type. Possible values: `scsi`, `virtio`, + * `ide`, `usb`. + * + * @return cdromBus + */ + @javax.annotation.Nullable public String getCdromBus() { + return cdromBus; + } + + public void setCdromBus(@javax.annotation.Nullable String cdromBus) { + this.cdromBus = cdromBus; + } + + public ImageConfig diskBus(@javax.annotation.Nullable String diskBus) { + this.diskBus = diskBus; + return this; + } + + /** + * Sets Disk bus controller type. Possible values: `scsi`, `virtio`, + * `ide`, `usb`. + * + * @return diskBus + */ + @javax.annotation.Nullable public String getDiskBus() { + return diskBus; + } + + public void setDiskBus(@javax.annotation.Nullable String diskBus) { + this.diskBus = diskBus; + } + + public ImageConfig nicModel(@javax.annotation.Nullable String nicModel) { + this.nicModel = nicModel; + return this; + } + + /** + * Sets virtual nic model. Possible values: `e1000`, `e1000e`, + * `ne2k_pci`, `pcnet`, `rtl8139`, `virtio`, + * `vmxnet3`. + * + * @return nicModel + */ + @javax.annotation.Nullable public String getNicModel() { + return nicModel; + } + + public void setNicModel(@javax.annotation.Nullable String nicModel) { + this.nicModel = nicModel; + } + + public ImageConfig operatingSystem(@javax.annotation.Nullable String operatingSystem) { + this.operatingSystem = operatingSystem; + return this; + } + + /** + * Enables OS specific optimizations. Possible values: `windows`, `linux`. + * + * @return operatingSystem + */ + @javax.annotation.Nullable public String getOperatingSystem() { + return operatingSystem; + } + + public void setOperatingSystem(@javax.annotation.Nullable String operatingSystem) { + this.operatingSystem = operatingSystem; + } + + public ImageConfig operatingSystemDistro( + @javax.annotation.Nullable String operatingSystemDistro) { + this.operatingSystemDistro = operatingSystemDistro; + return this; + } + + /** + * Operating System Distribution. + * + * @return operatingSystemDistro + */ + @javax.annotation.Nullable public String getOperatingSystemDistro() { + return operatingSystemDistro; + } + + public void setOperatingSystemDistro(@javax.annotation.Nullable String operatingSystemDistro) { + this.operatingSystemDistro = operatingSystemDistro; + } + + public ImageConfig operatingSystemVersion( + @javax.annotation.Nullable String operatingSystemVersion) { + this.operatingSystemVersion = operatingSystemVersion; + return this; + } + + /** + * Version of the OS. + * + * @return operatingSystemVersion + */ + @javax.annotation.Nullable public String getOperatingSystemVersion() { + return operatingSystemVersion; + } + + public void setOperatingSystemVersion( + @javax.annotation.Nullable String operatingSystemVersion) { + this.operatingSystemVersion = operatingSystemVersion; + } + + public ImageConfig rescueBus(@javax.annotation.Nullable String rescueBus) { + this.rescueBus = rescueBus; + return this; + } + + /** + * Sets the device bus when the image is used as a rescue image. Possible values: + * `sata`, `scsi`, `virtio`, `usb`. + * + * @return rescueBus + */ + @javax.annotation.Nullable public String getRescueBus() { + return rescueBus; + } + + public void setRescueBus(@javax.annotation.Nullable String rescueBus) { + this.rescueBus = rescueBus; + } + + public ImageConfig rescueDevice(@javax.annotation.Nullable String rescueDevice) { + this.rescueDevice = rescueDevice; + return this; + } + + /** + * Sets the device when the image is used as a rescue image. Possible values: `cdrom`, + * `disk`. + * + * @return rescueDevice + */ + @javax.annotation.Nullable public String getRescueDevice() { + return rescueDevice; + } + + public void setRescueDevice(@javax.annotation.Nullable String rescueDevice) { + this.rescueDevice = rescueDevice; + } + + public ImageConfig secureBoot(@javax.annotation.Nullable Boolean secureBoot) { + this.secureBoot = secureBoot; + return this; + } + + /** + * Enables Secure Boot. The default for new images is disabled. + * + * @return secureBoot + */ + @javax.annotation.Nullable public Boolean getSecureBoot() { + return secureBoot; + } + + public void setSecureBoot(@javax.annotation.Nullable Boolean secureBoot) { + this.secureBoot = secureBoot; + } + + public ImageConfig uefi(@javax.annotation.Nullable Boolean uefi) { + this.uefi = uefi; + return this; + } + + /** + * Configure UEFI boot. The default for new images is enabled. + * + * @return uefi + */ + @javax.annotation.Nullable public Boolean getUefi() { + return uefi; + } + + public void setUefi(@javax.annotation.Nullable Boolean uefi) { + this.uefi = uefi; + } + + public ImageConfig videoModel(@javax.annotation.Nullable String videoModel) { + this.videoModel = videoModel; + return this; + } + + /** + * Sets Graphic device model. Possible values: `vga`, `cirrus`, + * `vmvga`, `qxl`, `virtio`, `none`. + * + * @return videoModel + */ + @javax.annotation.Nullable public String getVideoModel() { + return videoModel; + } + + public void setVideoModel(@javax.annotation.Nullable String videoModel) { + this.videoModel = videoModel; + } + + public ImageConfig virtioScsi(@javax.annotation.Nullable Boolean virtioScsi) { + this.virtioScsi = virtioScsi; + return this; + } + + /** + * Enables the use of VirtIO SCSI to provide block device access. By default servers use VirtIO + * Block. + * + * @return virtioScsi + */ + @javax.annotation.Nullable public Boolean getVirtioScsi() { + return virtioScsi; + } + + public void setVirtioScsi(@javax.annotation.Nullable Boolean virtioScsi) { + this.virtioScsi = virtioScsi; + } + + /** + * 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 ImageConfig instance itself + */ + public ImageConfig 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; + } + ImageConfig imageConfig = (ImageConfig) o; + return Objects.equals(this.architecture, imageConfig.architecture) + && Objects.equals(this.bootMenu, imageConfig.bootMenu) + && Objects.equals(this.cdromBus, imageConfig.cdromBus) + && Objects.equals(this.diskBus, imageConfig.diskBus) + && Objects.equals(this.nicModel, imageConfig.nicModel) + && Objects.equals(this.operatingSystem, imageConfig.operatingSystem) + && Objects.equals(this.operatingSystemDistro, imageConfig.operatingSystemDistro) + && Objects.equals(this.operatingSystemVersion, imageConfig.operatingSystemVersion) + && Objects.equals(this.rescueBus, imageConfig.rescueBus) + && Objects.equals(this.rescueDevice, imageConfig.rescueDevice) + && Objects.equals(this.secureBoot, imageConfig.secureBoot) + && Objects.equals(this.uefi, imageConfig.uefi) + && Objects.equals(this.videoModel, imageConfig.videoModel) + && Objects.equals(this.virtioScsi, imageConfig.virtioScsi) + && Objects.equals(this.additionalProperties, imageConfig.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash( + architecture, + bootMenu, + cdromBus, + diskBus, + nicModel, + operatingSystem, + operatingSystemDistro, + operatingSystemVersion, + rescueBus, + rescueDevice, + secureBoot, + uefi, + videoModel, + virtioScsi, + additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ImageConfig {\n"); + sb.append(" architecture: ").append(toIndentedString(architecture)).append("\n"); + sb.append(" bootMenu: ").append(toIndentedString(bootMenu)).append("\n"); + sb.append(" cdromBus: ").append(toIndentedString(cdromBus)).append("\n"); + sb.append(" diskBus: ").append(toIndentedString(diskBus)).append("\n"); + sb.append(" nicModel: ").append(toIndentedString(nicModel)).append("\n"); + sb.append(" operatingSystem: ").append(toIndentedString(operatingSystem)).append("\n"); + sb.append(" operatingSystemDistro: ") + .append(toIndentedString(operatingSystemDistro)) + .append("\n"); + sb.append(" operatingSystemVersion: ") + .append(toIndentedString(operatingSystemVersion)) + .append("\n"); + sb.append(" rescueBus: ").append(toIndentedString(rescueBus)).append("\n"); + sb.append(" rescueDevice: ").append(toIndentedString(rescueDevice)).append("\n"); + sb.append(" secureBoot: ").append(toIndentedString(secureBoot)).append("\n"); + sb.append(" uefi: ").append(toIndentedString(uefi)).append("\n"); + sb.append(" videoModel: ").append(toIndentedString(videoModel)).append("\n"); + sb.append(" virtioScsi: ").append(toIndentedString(virtioScsi)).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( + "architecture", + "bootMenu", + "cdromBus", + "diskBus", + "nicModel", + "operatingSystem", + "operatingSystemDistro", + "operatingSystemVersion", + "rescueBus", + "rescueDevice", + "secureBoot", + "uefi", + "videoModel", + "virtioScsi")); + + // 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 ImageConfig + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ImageConfig.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 ImageConfig is not found in the empty JSON string", + ImageConfig.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("architecture") != null && !jsonObj.get("architecture").isJsonNull()) + && !jsonObj.get("architecture").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `architecture` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("architecture").toString())); + } + if ((jsonObj.get("cdromBus") != null && !jsonObj.get("cdromBus").isJsonNull()) + && !jsonObj.get("cdromBus").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `cdromBus` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("cdromBus").toString())); + } + if ((jsonObj.get("diskBus") != null && !jsonObj.get("diskBus").isJsonNull()) + && !jsonObj.get("diskBus").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `diskBus` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("diskBus").toString())); + } + if ((jsonObj.get("nicModel") != null && !jsonObj.get("nicModel").isJsonNull()) + && !jsonObj.get("nicModel").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `nicModel` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("nicModel").toString())); + } + if ((jsonObj.get("operatingSystem") != null && !jsonObj.get("operatingSystem").isJsonNull()) + && !jsonObj.get("operatingSystem").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `operatingSystem` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("operatingSystem").toString())); + } + if ((jsonObj.get("operatingSystemDistro") != null + && !jsonObj.get("operatingSystemDistro").isJsonNull()) + && !jsonObj.get("operatingSystemDistro").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `operatingSystemDistro` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("operatingSystemDistro").toString())); + } + if ((jsonObj.get("operatingSystemVersion") != null + && !jsonObj.get("operatingSystemVersion").isJsonNull()) + && !jsonObj.get("operatingSystemVersion").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `operatingSystemVersion` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("operatingSystemVersion").toString())); + } + if ((jsonObj.get("rescueBus") != null && !jsonObj.get("rescueBus").isJsonNull()) + && !jsonObj.get("rescueBus").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `rescueBus` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("rescueBus").toString())); + } + if ((jsonObj.get("rescueDevice") != null && !jsonObj.get("rescueDevice").isJsonNull()) + && !jsonObj.get("rescueDevice").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `rescueDevice` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("rescueDevice").toString())); + } + if ((jsonObj.get("videoModel") != null && !jsonObj.get("videoModel").isJsonNull()) + && !jsonObj.get("videoModel").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `videoModel` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("videoModel").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ImageConfig.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ImageConfig' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ImageConfig.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ImageConfig 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 ImageConfig read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ImageConfig 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 ImageConfig given an JSON string + * + * @param jsonString JSON string + * @return An instance of ImageConfig + * @throws IOException if the JSON string is invalid with respect to ImageConfig + */ + public static ImageConfig fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ImageConfig.class); + } + + /** + * Convert an instance of ImageConfig to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ImageCreateResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ImageCreateResponse.java new file mode 100644 index 00000000..dc3b916b --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ImageCreateResponse.java @@ -0,0 +1,344 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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.net.URI; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +/** Image creation response. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class ImageCreateResponse { + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private UUID id; + + public static final String SERIALIZED_NAME_UPLOAD_URL = "uploadUrl"; + + @SerializedName(SERIALIZED_NAME_UPLOAD_URL) + @javax.annotation.Nonnull + private URI uploadUrl; + + public ImageCreateResponse() {} + + public ImageCreateResponse id(@javax.annotation.Nonnull UUID id) { + this.id = id; + return this; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nonnull + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull UUID id) { + this.id = id; + } + + public ImageCreateResponse uploadUrl(@javax.annotation.Nonnull URI uploadUrl) { + this.uploadUrl = uploadUrl; + return this; + } + + /** + * Get uploadUrl + * + * @return uploadUrl + */ + @javax.annotation.Nonnull + public URI getUploadUrl() { + return uploadUrl; + } + + public void setUploadUrl(@javax.annotation.Nonnull URI uploadUrl) { + this.uploadUrl = uploadUrl; + } + + /** + * 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 ImageCreateResponse instance itself + */ + public ImageCreateResponse 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; + } + ImageCreateResponse imageCreateResponse = (ImageCreateResponse) o; + return Objects.equals(this.id, imageCreateResponse.id) + && Objects.equals(this.uploadUrl, imageCreateResponse.uploadUrl) + && Objects.equals( + this.additionalProperties, imageCreateResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, uploadUrl, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ImageCreateResponse {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" uploadUrl: ").append(toIndentedString(uploadUrl)).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("id", "uploadUrl")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("id", "uploadUrl")); + } + + /** + * 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 ImageCreateResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ImageCreateResponse.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 ImageCreateResponse is not found in the empty JSON string", + ImageCreateResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ImageCreateResponse.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("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if (!jsonObj.get("uploadUrl").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `uploadUrl` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("uploadUrl").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ImageCreateResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ImageCreateResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ImageCreateResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ImageCreateResponse 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 ImageCreateResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ImageCreateResponse 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 ImageCreateResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ImageCreateResponse + * @throws IOException if the JSON string is invalid with respect to ImageCreateResponse + */ + public static ImageCreateResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ImageCreateResponse.class); + } + + /** + * Convert an instance of ImageCreateResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ImageListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ImageListResponse.java new file mode 100644 index 00000000..7c8e0715 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ImageListResponse.java @@ -0,0 +1,326 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** Image list response. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class ImageListResponse { + public static final String SERIALIZED_NAME_ITEMS = "items"; + + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public ImageListResponse() {} + + public ImageListResponse items(@javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public ImageListResponse addItemsItem(Image itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list containing image objects. + * + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ImageListResponse instance itself + */ + public ImageListResponse 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; + } + ImageListResponse imageListResponse = (ImageListResponse) o; + return Objects.equals(this.items, imageListResponse.items) + && Objects.equals( + this.additionalProperties, imageListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ImageListResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("items")); + } + + /** + * 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 ImageListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ImageListResponse.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 ImageListResponse is not found in the empty JSON string", + ImageListResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ImageListResponse.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("items").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `items` to be an array in the JSON string but got `%s`", + jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + Image.validateJsonElement(jsonArrayitems.get(i)); + } + ; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ImageListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ImageListResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ImageListResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ImageListResponse 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 ImageListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ImageListResponse 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 ImageListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ImageListResponse + * @throws IOException if the JSON string is invalid with respect to ImageListResponse + */ + public static ImageListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ImageListResponse.class); + } + + /** + * Convert an instance of ImageListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ImageShare.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ImageShare.java new file mode 100644 index 00000000..6d8617a0 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ImageShare.java @@ -0,0 +1,334 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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.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; +import java.util.UUID; + +/** + * Share details of an Image. For requests ParentOrganization and Projects are mutually exclusive. + */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class ImageShare { + public static final String SERIALIZED_NAME_PARENT_ORGANIZATION = "parentOrganization"; + + @SerializedName(SERIALIZED_NAME_PARENT_ORGANIZATION) + @javax.annotation.Nullable private Boolean parentOrganization; + + public static final String SERIALIZED_NAME_PROJECTS = "projects"; + + @SerializedName(SERIALIZED_NAME_PROJECTS) + @javax.annotation.Nullable private List projects = new ArrayList<>(); + + public ImageShare() {} + + public ImageShare parentOrganization(@javax.annotation.Nullable Boolean parentOrganization) { + this.parentOrganization = parentOrganization; + return this; + } + + /** + * Image is shared with all projects inside the image owners organization. + * + * @return parentOrganization + */ + @javax.annotation.Nullable public Boolean getParentOrganization() { + return parentOrganization; + } + + public void setParentOrganization(@javax.annotation.Nullable Boolean parentOrganization) { + this.parentOrganization = parentOrganization; + } + + public ImageShare projects(@javax.annotation.Nullable List projects) { + this.projects = projects; + return this; + } + + public ImageShare addProjectsItem(UUID projectsItem) { + if (this.projects == null) { + this.projects = new ArrayList<>(); + } + this.projects.add(projectsItem); + return this; + } + + /** + * List of all projects the Image is shared with. + * + * @return projects + */ + @javax.annotation.Nullable public List getProjects() { + return projects; + } + + public void setProjects(@javax.annotation.Nullable List projects) { + this.projects = projects; + } + + /** + * 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 ImageShare instance itself + */ + public ImageShare 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; + } + ImageShare imageShare = (ImageShare) o; + return Objects.equals(this.parentOrganization, imageShare.parentOrganization) + && Objects.equals(this.projects, imageShare.projects) + && Objects.equals(this.additionalProperties, imageShare.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(parentOrganization, projects, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ImageShare {\n"); + sb.append(" parentOrganization: ") + .append(toIndentedString(parentOrganization)) + .append("\n"); + sb.append(" projects: ").append(toIndentedString(projects)).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("parentOrganization", "projects")); + + // 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 ImageShare + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ImageShare.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 ImageShare is not found in the empty JSON string", + ImageShare.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("projects") != null + && !jsonObj.get("projects").isJsonNull() + && !jsonObj.get("projects").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `projects` to be an array in the JSON string but got `%s`", + jsonObj.get("projects").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ImageShare.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ImageShare' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ImageShare.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ImageShare 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 ImageShare read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ImageShare 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 ImageShare given an JSON string + * + * @param jsonString JSON string + * @return An instance of ImageShare + * @throws IOException if the JSON string is invalid with respect to ImageShare + */ + public static ImageShare fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ImageShare.class); + } + + /** + * Convert an instance of ImageShare to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ImageShareConsumer.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ImageShareConsumer.java new file mode 100644 index 00000000..8eee8ef7 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ImageShareConsumer.java @@ -0,0 +1,361 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; +import java.util.UUID; + +/** The details of an Image share consumer. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class ImageShareConsumer { + public static final String SERIALIZED_NAME_CONSUMER_PROJECT_ID = "consumerProjectId"; + + @SerializedName(SERIALIZED_NAME_CONSUMER_PROJECT_ID) + @javax.annotation.Nullable private UUID consumerProjectId; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_IMAGE_ID = "imageId"; + + @SerializedName(SERIALIZED_NAME_IMAGE_ID) + @javax.annotation.Nullable private UUID imageId; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable private OffsetDateTime updatedAt; + + public ImageShareConsumer() {} + + public ImageShareConsumer( + UUID consumerProjectId, + OffsetDateTime createdAt, + UUID imageId, + OffsetDateTime updatedAt) { + this(); + this.consumerProjectId = consumerProjectId; + this.createdAt = createdAt; + this.imageId = imageId; + this.updatedAt = updatedAt; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return consumerProjectId + */ + @javax.annotation.Nullable public UUID getConsumerProjectId() { + return consumerProjectId; + } + + /** + * Date-time when resource was created. + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return imageId + */ + @javax.annotation.Nullable public UUID getImageId() { + return imageId; + } + + /** + * Date-time when resource was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nullable public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * 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 ImageShareConsumer instance itself + */ + public ImageShareConsumer 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; + } + ImageShareConsumer imageShareConsumer = (ImageShareConsumer) o; + return Objects.equals(this.consumerProjectId, imageShareConsumer.consumerProjectId) + && Objects.equals(this.createdAt, imageShareConsumer.createdAt) + && Objects.equals(this.imageId, imageShareConsumer.imageId) + && Objects.equals(this.updatedAt, imageShareConsumer.updatedAt) + && Objects.equals( + this.additionalProperties, imageShareConsumer.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(consumerProjectId, createdAt, imageId, updatedAt, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ImageShareConsumer {\n"); + sb.append(" consumerProjectId: ") + .append(toIndentedString(consumerProjectId)) + .append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" imageId: ").append(toIndentedString(imageId)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).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("consumerProjectId", "createdAt", "imageId", "updatedAt")); + + // 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 ImageShareConsumer + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ImageShareConsumer.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 ImageShareConsumer is not found in the empty JSON string", + ImageShareConsumer.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("consumerProjectId") != null + && !jsonObj.get("consumerProjectId").isJsonNull()) + && !jsonObj.get("consumerProjectId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `consumerProjectId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("consumerProjectId").toString())); + } + if ((jsonObj.get("imageId") != null && !jsonObj.get("imageId").isJsonNull()) + && !jsonObj.get("imageId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `imageId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("imageId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ImageShareConsumer.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ImageShareConsumer' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ImageShareConsumer.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ImageShareConsumer 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 ImageShareConsumer read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ImageShareConsumer 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 ImageShareConsumer given an JSON string + * + * @param jsonString JSON string + * @return An instance of ImageShareConsumer + * @throws IOException if the JSON string is invalid with respect to ImageShareConsumer + */ + public static ImageShareConsumer fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ImageShareConsumer.class); + } + + /** + * Convert an instance of ImageShareConsumer to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/KeyPairListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/KeyPairListResponse.java new file mode 100644 index 00000000..6023db9d --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/KeyPairListResponse.java @@ -0,0 +1,326 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** SSH keypair list response. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class KeyPairListResponse { + public static final String SERIALIZED_NAME_ITEMS = "items"; + + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public KeyPairListResponse() {} + + public KeyPairListResponse items(@javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public KeyPairListResponse addItemsItem(Keypair itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list of SSH keypairs. + * + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the KeyPairListResponse instance itself + */ + public KeyPairListResponse 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; + } + KeyPairListResponse keyPairListResponse = (KeyPairListResponse) o; + return Objects.equals(this.items, keyPairListResponse.items) + && Objects.equals( + this.additionalProperties, keyPairListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class KeyPairListResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("items")); + } + + /** + * 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 KeyPairListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!KeyPairListResponse.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 KeyPairListResponse is not found in the empty JSON string", + KeyPairListResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : KeyPairListResponse.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("items").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `items` to be an array in the JSON string but got `%s`", + jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + Keypair.validateJsonElement(jsonArrayitems.get(i)); + } + ; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!KeyPairListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'KeyPairListResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(KeyPairListResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, KeyPairListResponse 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 KeyPairListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + KeyPairListResponse 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 KeyPairListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of KeyPairListResponse + * @throws IOException if the JSON string is invalid with respect to KeyPairListResponse + */ + public static KeyPairListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, KeyPairListResponse.class); + } + + /** + * Convert an instance of KeyPairListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/Keypair.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/Keypair.java new file mode 100644 index 00000000..fd0a5b3b --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/Keypair.java @@ -0,0 +1,442 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** Object that represents the public key of an SSH keypair and its name. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class Keypair { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_FINGERPRINT = "fingerprint"; + + @SerializedName(SERIALIZED_NAME_FINGERPRINT) + @javax.annotation.Nullable private String fingerprint; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; + + public static final String SERIALIZED_NAME_PUBLIC_KEY = "publicKey"; + + @SerializedName(SERIALIZED_NAME_PUBLIC_KEY) + @javax.annotation.Nonnull + private String publicKey; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable private OffsetDateTime updatedAt; + + public Keypair() {} + + public Keypair(OffsetDateTime createdAt, String fingerprint, OffsetDateTime updatedAt) { + this(); + this.createdAt = createdAt; + this.fingerprint = fingerprint; + this.updatedAt = updatedAt; + } + + /** + * Date-time when resource was created. + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * Object that represents an SSH keypair MD5 fingerprint. + * + * @return fingerprint + */ + @javax.annotation.Nullable public String getFingerprint() { + return fingerprint; + } + + public Keypair labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public Keypair name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The name of an SSH keypair. Allowed characters are letters [a-zA-Z], digits [0-9] and the + * following special characters: [@._-]. + * + * @return name + */ + @javax.annotation.Nullable public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + public Keypair publicKey(@javax.annotation.Nonnull String publicKey) { + this.publicKey = publicKey; + return this; + } + + /** + * Object that represents a public SSH key. + * + * @return publicKey + */ + @javax.annotation.Nonnull + public String getPublicKey() { + return publicKey; + } + + public void setPublicKey(@javax.annotation.Nonnull String publicKey) { + this.publicKey = publicKey; + } + + /** + * Date-time when resource was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nullable public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * 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 Keypair instance itself + */ + public Keypair 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; + } + Keypair keypair = (Keypair) o; + return Objects.equals(this.createdAt, keypair.createdAt) + && Objects.equals(this.fingerprint, keypair.fingerprint) + && Objects.equals(this.labels, keypair.labels) + && Objects.equals(this.name, keypair.name) + && Objects.equals(this.publicKey, keypair.publicKey) + && Objects.equals(this.updatedAt, keypair.updatedAt) + && Objects.equals(this.additionalProperties, keypair.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + createdAt, fingerprint, labels, name, publicKey, updatedAt, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Keypair {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" fingerprint: ").append(toIndentedString(fingerprint)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" publicKey: ").append(toIndentedString(publicKey)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).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( + "createdAt", + "fingerprint", + "labels", + "name", + "publicKey", + "updatedAt")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("publicKey")); + } + + /** + * 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 Keypair + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Keypair.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 Keypair is not found in the empty JSON string", + Keypair.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Keypair.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("fingerprint") != null && !jsonObj.get("fingerprint").isJsonNull()) + && !jsonObj.get("fingerprint").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `fingerprint` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("fingerprint").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `name` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("name").toString())); + } + if (!jsonObj.get("publicKey").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `publicKey` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("publicKey").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Keypair.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Keypair' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(Keypair.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, Keypair 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 Keypair read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Keypair 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 Keypair given an JSON string + * + * @param jsonString JSON string + * @return An instance of Keypair + * @throws IOException if the JSON string is invalid with respect to Keypair + */ + public static Keypair fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Keypair.class); + } + + /** + * Convert an instance of Keypair to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/MachineType.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/MachineType.java new file mode 100644 index 00000000..cab0c108 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/MachineType.java @@ -0,0 +1,450 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** + * Machine Type. Filterable Fields: `disk`, `extraSpecs`, `name`, + * `ram`, `vcpus`. + */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class MachineType { + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable private String description; + + public static final String SERIALIZED_NAME_DISK = "disk"; + + @SerializedName(SERIALIZED_NAME_DISK) + @javax.annotation.Nonnull + private Long disk; + + public static final String SERIALIZED_NAME_EXTRA_SPECS = "extraSpecs"; + + @SerializedName(SERIALIZED_NAME_EXTRA_SPECS) + @javax.annotation.Nullable private Object extraSpecs; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_RAM = "ram"; + + @SerializedName(SERIALIZED_NAME_RAM) + @javax.annotation.Nonnull + private Long ram; + + public static final String SERIALIZED_NAME_VCPUS = "vcpus"; + + @SerializedName(SERIALIZED_NAME_VCPUS) + @javax.annotation.Nonnull + private Long vcpus; + + public MachineType() {} + + public MachineType description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Description Object. Allows string up to 255 Characters. + * + * @return description + */ + @javax.annotation.Nullable public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + public MachineType disk(@javax.annotation.Nonnull Long disk) { + this.disk = disk; + return this; + } + + /** + * Size in Gigabyte. + * + * @return disk + */ + @javax.annotation.Nonnull + public Long getDisk() { + return disk; + } + + public void setDisk(@javax.annotation.Nonnull Long disk) { + this.disk = disk; + } + + public MachineType extraSpecs(@javax.annotation.Nullable Object extraSpecs) { + this.extraSpecs = extraSpecs; + return this; + } + + /** + * Properties to control certain aspects or scheduling behavior for an object. + * + * @return extraSpecs + */ + @javax.annotation.Nullable public Object getExtraSpecs() { + return extraSpecs; + } + + public void setExtraSpecs(@javax.annotation.Nullable Object extraSpecs) { + this.extraSpecs = extraSpecs; + } + + public MachineType name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + public MachineType ram(@javax.annotation.Nonnull Long ram) { + this.ram = ram; + return this; + } + + /** + * Size in Megabyte. + * + * @return ram + */ + @javax.annotation.Nonnull + public Long getRam() { + return ram; + } + + public void setRam(@javax.annotation.Nonnull Long ram) { + this.ram = ram; + } + + public MachineType vcpus(@javax.annotation.Nonnull Long vcpus) { + this.vcpus = vcpus; + return this; + } + + /** + * The number of virtual CPUs of a server. minimum: 1 + * + * @return vcpus + */ + @javax.annotation.Nonnull + public Long getVcpus() { + return vcpus; + } + + public void setVcpus(@javax.annotation.Nonnull Long vcpus) { + this.vcpus = vcpus; + } + + /** + * 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 MachineType instance itself + */ + public MachineType 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; + } + MachineType machineType = (MachineType) o; + return Objects.equals(this.description, machineType.description) + && Objects.equals(this.disk, machineType.disk) + && Objects.equals(this.extraSpecs, machineType.extraSpecs) + && Objects.equals(this.name, machineType.name) + && Objects.equals(this.ram, machineType.ram) + && Objects.equals(this.vcpus, machineType.vcpus) + && Objects.equals(this.additionalProperties, machineType.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(description, disk, extraSpecs, name, ram, vcpus, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MachineType {\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" disk: ").append(toIndentedString(disk)).append("\n"); + sb.append(" extraSpecs: ").append(toIndentedString(extraSpecs)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" ram: ").append(toIndentedString(ram)).append("\n"); + sb.append(" vcpus: ").append(toIndentedString(vcpus)).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("description", "disk", "extraSpecs", "name", "ram", "vcpus")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("disk", "name", "ram", "vcpus")); + } + + /** + * 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 MachineType + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MachineType.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 MachineType is not found in the empty JSON string", + MachineType.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : MachineType.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("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `description` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("description").toString())); + } + if (!jsonObj.get("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())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MachineType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MachineType' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(MachineType.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, MachineType 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 MachineType read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + MachineType 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 MachineType given an JSON string + * + * @param jsonString JSON string + * @return An instance of MachineType + * @throws IOException if the JSON string is invalid with respect to MachineType + */ + public static MachineType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MachineType.class); + } + + /** + * Convert an instance of MachineType to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/MachineTypeListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/MachineTypeListResponse.java new file mode 100644 index 00000000..aaf6f49c --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/MachineTypeListResponse.java @@ -0,0 +1,327 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** Machine type list response. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class MachineTypeListResponse { + public static final String SERIALIZED_NAME_ITEMS = "items"; + + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public MachineTypeListResponse() {} + + public MachineTypeListResponse items(@javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public MachineTypeListResponse addItemsItem(MachineType itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * Machine type list. + * + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the MachineTypeListResponse instance itself + */ + public MachineTypeListResponse 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; + } + MachineTypeListResponse machineTypeListResponse = (MachineTypeListResponse) o; + return Objects.equals(this.items, machineTypeListResponse.items) + && Objects.equals( + this.additionalProperties, machineTypeListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MachineTypeListResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("items")); + } + + /** + * 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 MachineTypeListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MachineTypeListResponse.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 MachineTypeListResponse is not found in the empty JSON string", + MachineTypeListResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : MachineTypeListResponse.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("items").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `items` to be an array in the JSON string but got `%s`", + jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + MachineType.validateJsonElement(jsonArrayitems.get(i)); + } + ; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MachineTypeListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MachineTypeListResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(MachineTypeListResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, MachineTypeListResponse 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 MachineTypeListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + MachineTypeListResponse 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 MachineTypeListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of MachineTypeListResponse + * @throws IOException if the JSON string is invalid with respect to MachineTypeListResponse + */ + public static MachineTypeListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MachineTypeListResponse.class); + } + + /** + * Convert an instance of MachineTypeListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/NIC.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/NIC.java new file mode 100644 index 00000000..7b0c92db --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/NIC.java @@ -0,0 +1,733 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; +import java.util.UUID; + +/** Object that represents a network interface. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class NIC { + public static final String SERIALIZED_NAME_ALLOWED_ADDRESSES = "allowedAddresses"; + + @SerializedName(SERIALIZED_NAME_ALLOWED_ADDRESSES) + @javax.annotation.Nullable private List allowedAddresses = new ArrayList<>(); + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable private String description; + + public static final String SERIALIZED_NAME_DEVICE = "device"; + + @SerializedName(SERIALIZED_NAME_DEVICE) + @javax.annotation.Nullable private UUID device; + + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_IPV4 = "ipv4"; + + @SerializedName(SERIALIZED_NAME_IPV4) + @javax.annotation.Nullable private String ipv4; + + public static final String SERIALIZED_NAME_IPV6 = "ipv6"; + + @SerializedName(SERIALIZED_NAME_IPV6) + @javax.annotation.Nullable private String ipv6; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_MAC = "mac"; + + @SerializedName(SERIALIZED_NAME_MAC) + @javax.annotation.Nullable private String mac; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; + + public static final String SERIALIZED_NAME_NETWORK_ID = "networkId"; + + @SerializedName(SERIALIZED_NAME_NETWORK_ID) + @javax.annotation.Nullable private UUID networkId; + + public static final String SERIALIZED_NAME_NIC_SECURITY = "nicSecurity"; + + @SerializedName(SERIALIZED_NAME_NIC_SECURITY) + @javax.annotation.Nullable private Boolean nicSecurity = true; + + public static final String SERIALIZED_NAME_SECURITY_GROUPS = "securityGroups"; + + @SerializedName(SERIALIZED_NAME_SECURITY_GROUPS) + @javax.annotation.Nullable private List securityGroups = new ArrayList<>(); + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable private String status; + + public static final String SERIALIZED_NAME_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable private String type; + + public NIC() {} + + public NIC(UUID device, UUID id, String mac, UUID networkId, String status, String type) { + this(); + this.device = device; + this.id = id; + this.mac = mac; + this.networkId = networkId; + this.status = status; + this.type = type; + } + + public NIC allowedAddresses( + @javax.annotation.Nullable List allowedAddresses) { + this.allowedAddresses = allowedAddresses; + return this; + } + + public NIC addAllowedAddressesItem(AllowedAddressesInner allowedAddressesItem) { + if (this.allowedAddresses == null) { + this.allowedAddresses = new ArrayList<>(); + } + this.allowedAddresses.add(allowedAddressesItem); + return this; + } + + /** + * A list of IPs or CIDR notations. + * + * @return allowedAddresses + */ + @javax.annotation.Nullable public List getAllowedAddresses() { + return allowedAddresses; + } + + public void setAllowedAddresses( + @javax.annotation.Nullable List allowedAddresses) { + this.allowedAddresses = allowedAddresses; + } + + public NIC description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Description Object. Allows string up to 255 Characters. + * + * @return description + */ + @javax.annotation.Nullable public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return device + */ + @javax.annotation.Nullable public UUID getDevice() { + return device; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + public NIC ipv4(@javax.annotation.Nullable String ipv4) { + this.ipv4 = ipv4; + return this; + } + + /** + * Object that represents an IP address. + * + * @return ipv4 + */ + @javax.annotation.Nullable public String getIpv4() { + return ipv4; + } + + public void setIpv4(@javax.annotation.Nullable String ipv4) { + this.ipv4 = ipv4; + } + + public NIC ipv6(@javax.annotation.Nullable String ipv6) { + this.ipv6 = ipv6; + return this; + } + + /** + * String that represents an IPv6 address. + * + * @return ipv6 + */ + @javax.annotation.Nullable public String getIpv6() { + return ipv6; + } + + public void setIpv6(@javax.annotation.Nullable String ipv6) { + this.ipv6 = ipv6; + } + + public NIC labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + /** + * Object that represents an MAC address. + * + * @return mac + */ + @javax.annotation.Nullable public String getMac() { + return mac; + } + + public NIC name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nullable public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return networkId + */ + @javax.annotation.Nullable public UUID getNetworkId() { + return networkId; + } + + public NIC nicSecurity(@javax.annotation.Nullable Boolean nicSecurity) { + this.nicSecurity = nicSecurity; + return this; + } + + /** + * If this is set to false, then no security groups will apply to this network interface. + * + * @return nicSecurity + */ + @javax.annotation.Nullable public Boolean getNicSecurity() { + return nicSecurity; + } + + public void setNicSecurity(@javax.annotation.Nullable Boolean nicSecurity) { + this.nicSecurity = nicSecurity; + } + + public NIC securityGroups(@javax.annotation.Nullable List securityGroups) { + this.securityGroups = securityGroups; + return this; + } + + public NIC addSecurityGroupsItem(UUID securityGroupsItem) { + if (this.securityGroups == null) { + this.securityGroups = new ArrayList<>(); + } + this.securityGroups.add(securityGroupsItem); + return this; + } + + /** + * A list of UUIDs. + * + * @return securityGroups + */ + @javax.annotation.Nullable public List getSecurityGroups() { + return securityGroups; + } + + public void setSecurityGroups(@javax.annotation.Nullable List securityGroups) { + this.securityGroups = securityGroups; + } + + /** + * Possible values: `ACTIVE`, `DOWN`. + * + * @return status + */ + @javax.annotation.Nullable public String getStatus() { + return status; + } + + /** + * Possible values: `server`, `metadata`, `gateway`, + * `none`. + * + * @return type + */ + @javax.annotation.Nullable public String getType() { + return 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 NIC instance itself + */ + public NIC 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; + } + NIC NIC = (NIC) o; + return Objects.equals(this.allowedAddresses, NIC.allowedAddresses) + && Objects.equals(this.description, NIC.description) + && Objects.equals(this.device, NIC.device) + && Objects.equals(this.id, NIC.id) + && Objects.equals(this.ipv4, NIC.ipv4) + && Objects.equals(this.ipv6, NIC.ipv6) + && Objects.equals(this.labels, NIC.labels) + && Objects.equals(this.mac, NIC.mac) + && Objects.equals(this.name, NIC.name) + && Objects.equals(this.networkId, NIC.networkId) + && Objects.equals(this.nicSecurity, NIC.nicSecurity) + && Objects.equals(this.securityGroups, NIC.securityGroups) + && Objects.equals(this.status, NIC.status) + && Objects.equals(this.type, NIC.type) + && Objects.equals(this.additionalProperties, NIC.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + allowedAddresses, + description, + device, + id, + ipv4, + ipv6, + labels, + mac, + name, + networkId, + nicSecurity, + securityGroups, + status, + type, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NIC {\n"); + sb.append(" allowedAddresses: ").append(toIndentedString(allowedAddresses)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" device: ").append(toIndentedString(device)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" ipv4: ").append(toIndentedString(ipv4)).append("\n"); + sb.append(" ipv6: ").append(toIndentedString(ipv6)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" mac: ").append(toIndentedString(mac)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" networkId: ").append(toIndentedString(networkId)).append("\n"); + sb.append(" nicSecurity: ").append(toIndentedString(nicSecurity)).append("\n"); + sb.append(" securityGroups: ").append(toIndentedString(securityGroups)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).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( + "allowedAddresses", + "description", + "device", + "id", + "ipv4", + "ipv6", + "labels", + "mac", + "name", + "networkId", + "nicSecurity", + "securityGroups", + "status", + "type")); + + // 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 NIC + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NIC.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 NIC is not found in the empty JSON string", + NIC.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("allowedAddresses") != null + && !jsonObj.get("allowedAddresses").isJsonNull()) { + JsonArray jsonArrayallowedAddresses = jsonObj.getAsJsonArray("allowedAddresses"); + if (jsonArrayallowedAddresses != null) { + // ensure the json data is an array + if (!jsonObj.get("allowedAddresses").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `allowedAddresses` to be an array in the JSON string but got `%s`", + jsonObj.get("allowedAddresses").toString())); + } + + // validate the optional field `allowedAddresses` (array) + for (int i = 0; i < jsonArrayallowedAddresses.size(); i++) { + AllowedAddressesInner.validateJsonElement(jsonArrayallowedAddresses.get(i)); + } + ; + } + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `description` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("description").toString())); + } + if ((jsonObj.get("device") != null && !jsonObj.get("device").isJsonNull()) + && !jsonObj.get("device").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `device` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("device").toString())); + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if ((jsonObj.get("ipv4") != null && !jsonObj.get("ipv4").isJsonNull()) + && !jsonObj.get("ipv4").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `ipv4` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("ipv4").toString())); + } + if ((jsonObj.get("ipv6") != null && !jsonObj.get("ipv6").isJsonNull()) + && !jsonObj.get("ipv6").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `ipv6` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("ipv6").toString())); + } + if ((jsonObj.get("mac") != null && !jsonObj.get("mac").isJsonNull()) + && !jsonObj.get("mac").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `mac` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("mac").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `name` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("name").toString())); + } + if ((jsonObj.get("networkId") != null && !jsonObj.get("networkId").isJsonNull()) + && !jsonObj.get("networkId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `networkId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("networkId").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("securityGroups") != null + && !jsonObj.get("securityGroups").isJsonNull() + && !jsonObj.get("securityGroups").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `securityGroups` to be an array in the JSON string but got `%s`", + jsonObj.get("securityGroups").toString())); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) + && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `status` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("status").toString())); + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) + && !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 (!NIC.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NIC' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(NIC.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, NIC 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 NIC read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + NIC 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 NIC given an JSON string + * + * @param jsonString JSON string + * @return An instance of NIC + * @throws IOException if the JSON string is invalid with respect to NIC + */ + public static NIC fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NIC.class); + } + + /** + * Convert an instance of NIC to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/NICListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/NICListResponse.java new file mode 100644 index 00000000..5cb6717a --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/NICListResponse.java @@ -0,0 +1,325 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** NIC list response. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class NICListResponse { + public static final String SERIALIZED_NAME_ITEMS = "items"; + + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public NICListResponse() {} + + public NICListResponse items(@javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public NICListResponse addItemsItem(NIC itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list of network interfaces. + * + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NICListResponse instance itself + */ + public NICListResponse 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; + } + NICListResponse niCListResponse = (NICListResponse) o; + return Objects.equals(this.items, niCListResponse.items) + && Objects.equals(this.additionalProperties, niCListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NICListResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("items")); + } + + /** + * 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 NICListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NICListResponse.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 NICListResponse is not found in the empty JSON string", + NICListResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : NICListResponse.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("items").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `items` to be an array in the JSON string but got `%s`", + jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + NIC.validateJsonElement(jsonArrayitems.get(i)); + } + ; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!NICListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NICListResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(NICListResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, NICListResponse 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 NICListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + NICListResponse 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 NICListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of NICListResponse + * @throws IOException if the JSON string is invalid with respect to NICListResponse + */ + public static NICListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NICListResponse.class); + } + + /** + * Convert an instance of NICListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/Network.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/Network.java new file mode 100644 index 00000000..7300a269 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/Network.java @@ -0,0 +1,819 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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.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; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Object that represents a network. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class Network { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_DHCP = "dhcp"; + + @SerializedName(SERIALIZED_NAME_DHCP) + @javax.annotation.Nullable private Boolean dhcp; + + public static final String SERIALIZED_NAME_GATEWAY = "gateway"; + + @SerializedName(SERIALIZED_NAME_GATEWAY) + @javax.annotation.Nullable private String gateway; + + public static final String SERIALIZED_NAME_GATEWAYV6 = "gatewayv6"; + + @SerializedName(SERIALIZED_NAME_GATEWAYV6) + @javax.annotation.Nullable private String gatewayv6; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_NAMESERVERS = "nameservers"; + + @SerializedName(SERIALIZED_NAME_NAMESERVERS) + @javax.annotation.Nullable private List nameservers = new ArrayList<>(); + + public static final String SERIALIZED_NAME_NAMESERVERS_V6 = "nameserversV6"; + + @SerializedName(SERIALIZED_NAME_NAMESERVERS_V6) + @javax.annotation.Nullable private List nameserversV6 = new ArrayList<>(); + + public static final String SERIALIZED_NAME_NETWORK_ID = "networkId"; + + @SerializedName(SERIALIZED_NAME_NETWORK_ID) + @javax.annotation.Nonnull + private UUID networkId; + + public static final String SERIALIZED_NAME_PREFIXES = "prefixes"; + + @SerializedName(SERIALIZED_NAME_PREFIXES) + @javax.annotation.Nullable private List prefixes = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PREFIXES_V6 = "prefixesV6"; + + @SerializedName(SERIALIZED_NAME_PREFIXES_V6) + @javax.annotation.Nullable private List prefixesV6 = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PUBLIC_IP = "publicIp"; + + @SerializedName(SERIALIZED_NAME_PUBLIC_IP) + @javax.annotation.Nullable private String publicIp; + + public static final String SERIALIZED_NAME_ROUTED = "routed"; + + @SerializedName(SERIALIZED_NAME_ROUTED) + @javax.annotation.Nullable private Boolean routed; + + public static final String SERIALIZED_NAME_STATE = "state"; + + @SerializedName(SERIALIZED_NAME_STATE) + @javax.annotation.Nonnull + private String state; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable private OffsetDateTime updatedAt; + + public Network() {} + + public Network(OffsetDateTime createdAt, OffsetDateTime updatedAt) { + this(); + this.createdAt = createdAt; + this.updatedAt = updatedAt; + } + + /** + * Date-time when resource was created. + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public Network dhcp(@javax.annotation.Nullable Boolean dhcp) { + this.dhcp = dhcp; + return this; + } + + /** + * Enable or disable DHCP for a network. + * + * @return dhcp + */ + @javax.annotation.Nullable public Boolean getDhcp() { + return dhcp; + } + + public void setDhcp(@javax.annotation.Nullable Boolean dhcp) { + this.dhcp = dhcp; + } + + public Network gateway(@javax.annotation.Nullable String gateway) { + this.gateway = gateway; + return this; + } + + /** + * The gateway of a network. If not specified the first IP of the network will be assigned as + * the gateway. If 'null' is sent, then the network doesn't have a gateway. + * + * @return gateway + */ + @javax.annotation.Nullable public String getGateway() { + return gateway; + } + + public void setGateway(@javax.annotation.Nullable String gateway) { + this.gateway = gateway; + } + + public Network gatewayv6(@javax.annotation.Nullable String gatewayv6) { + this.gatewayv6 = gatewayv6; + return this; + } + + /** + * The gateway of a network. If not specified the first IP of the network will be assigned as + * the gateway. If 'null' is sent, then the network doesn't have a gateway. + * + * @return gatewayv6 + */ + @javax.annotation.Nullable public String getGatewayv6() { + return gatewayv6; + } + + public void setGatewayv6(@javax.annotation.Nullable String gatewayv6) { + this.gatewayv6 = gatewayv6; + } + + public Network labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public Network 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 Network nameservers(@javax.annotation.Nullable List nameservers) { + this.nameservers = nameservers; + return this; + } + + public Network addNameserversItem(String nameserversItem) { + if (this.nameservers == null) { + this.nameservers = new ArrayList<>(); + } + this.nameservers.add(nameserversItem); + return this; + } + + /** + * A list containing DNS Servers/Nameservers for IPv4. + * + * @return nameservers + */ + @javax.annotation.Nullable public List getNameservers() { + return nameservers; + } + + public void setNameservers(@javax.annotation.Nullable List nameservers) { + this.nameservers = nameservers; + } + + public Network nameserversV6(@javax.annotation.Nullable List nameserversV6) { + this.nameserversV6 = nameserversV6; + return this; + } + + public Network addNameserversV6Item(String nameserversV6Item) { + if (this.nameserversV6 == null) { + this.nameserversV6 = new ArrayList<>(); + } + this.nameserversV6.add(nameserversV6Item); + return this; + } + + /** + * A list containing DNS Servers/Nameservers for IPv6. + * + * @return nameserversV6 + */ + @javax.annotation.Nullable public List getNameserversV6() { + return nameserversV6; + } + + public void setNameserversV6(@javax.annotation.Nullable List nameserversV6) { + this.nameserversV6 = nameserversV6; + } + + public Network networkId(@javax.annotation.Nonnull UUID networkId) { + this.networkId = networkId; + return this; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return networkId + */ + @javax.annotation.Nonnull + public UUID getNetworkId() { + return networkId; + } + + public void setNetworkId(@javax.annotation.Nonnull UUID networkId) { + this.networkId = networkId; + } + + public Network prefixes(@javax.annotation.Nullable List prefixes) { + this.prefixes = prefixes; + return this; + } + + public Network addPrefixesItem(String prefixesItem) { + if (this.prefixes == null) { + this.prefixes = new ArrayList<>(); + } + this.prefixes.add(prefixesItem); + return this; + } + + /** + * Get prefixes + * + * @return prefixes + */ + @javax.annotation.Nullable public List getPrefixes() { + return prefixes; + } + + public void setPrefixes(@javax.annotation.Nullable List prefixes) { + this.prefixes = prefixes; + } + + public Network prefixesV6(@javax.annotation.Nullable List prefixesV6) { + this.prefixesV6 = prefixesV6; + return this; + } + + public Network addPrefixesV6Item(String prefixesV6Item) { + if (this.prefixesV6 == null) { + this.prefixesV6 = new ArrayList<>(); + } + this.prefixesV6.add(prefixesV6Item); + return this; + } + + /** + * Get prefixesV6 + * + * @return prefixesV6 + */ + @javax.annotation.Nullable public List getPrefixesV6() { + return prefixesV6; + } + + public void setPrefixesV6(@javax.annotation.Nullable List prefixesV6) { + this.prefixesV6 = prefixesV6; + } + + public Network publicIp(@javax.annotation.Nullable String publicIp) { + this.publicIp = publicIp; + return this; + } + + /** + * Object that represents an IP address. + * + * @return publicIp + */ + @javax.annotation.Nullable public String getPublicIp() { + return publicIp; + } + + public void setPublicIp(@javax.annotation.Nullable String publicIp) { + this.publicIp = publicIp; + } + + public Network routed(@javax.annotation.Nullable Boolean routed) { + this.routed = routed; + return this; + } + + /** + * Shows if the network is routed and therefore accessible from other networks. + * + * @return routed + */ + @javax.annotation.Nullable public Boolean getRouted() { + return routed; + } + + public void setRouted(@javax.annotation.Nullable Boolean routed) { + this.routed = routed; + } + + public Network state(@javax.annotation.Nonnull String state) { + this.state = state; + return this; + } + + /** + * The state of a resource object. Possible values: `CREATING`, `CREATED`, + * `DELETING`, `DELETED`, `FAILED`, `UPDATED`, + * `UPDATING`. + * + * @return state + */ + @javax.annotation.Nonnull + public String getState() { + return state; + } + + public void setState(@javax.annotation.Nonnull String state) { + this.state = state; + } + + /** + * Date-time when resource was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nullable public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * 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 Network instance itself + */ + public Network 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; + } + Network network = (Network) o; + return Objects.equals(this.createdAt, network.createdAt) + && Objects.equals(this.dhcp, network.dhcp) + && Objects.equals(this.gateway, network.gateway) + && Objects.equals(this.gatewayv6, network.gatewayv6) + && Objects.equals(this.labels, network.labels) + && Objects.equals(this.name, network.name) + && Objects.equals(this.nameservers, network.nameservers) + && Objects.equals(this.nameserversV6, network.nameserversV6) + && Objects.equals(this.networkId, network.networkId) + && Objects.equals(this.prefixes, network.prefixes) + && Objects.equals(this.prefixesV6, network.prefixesV6) + && Objects.equals(this.publicIp, network.publicIp) + && Objects.equals(this.routed, network.routed) + && Objects.equals(this.state, network.state) + && Objects.equals(this.updatedAt, network.updatedAt) + && Objects.equals(this.additionalProperties, network.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash( + createdAt, + dhcp, + gateway, + gatewayv6, + labels, + name, + nameservers, + nameserversV6, + networkId, + prefixes, + prefixesV6, + publicIp, + routed, + state, + updatedAt, + additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Network {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" dhcp: ").append(toIndentedString(dhcp)).append("\n"); + sb.append(" gateway: ").append(toIndentedString(gateway)).append("\n"); + sb.append(" gatewayv6: ").append(toIndentedString(gatewayv6)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" nameservers: ").append(toIndentedString(nameservers)).append("\n"); + sb.append(" nameserversV6: ").append(toIndentedString(nameserversV6)).append("\n"); + sb.append(" networkId: ").append(toIndentedString(networkId)).append("\n"); + sb.append(" prefixes: ").append(toIndentedString(prefixes)).append("\n"); + sb.append(" prefixesV6: ").append(toIndentedString(prefixesV6)).append("\n"); + sb.append(" publicIp: ").append(toIndentedString(publicIp)).append("\n"); + sb.append(" routed: ").append(toIndentedString(routed)).append("\n"); + sb.append(" state: ").append(toIndentedString(state)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).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( + "createdAt", + "dhcp", + "gateway", + "gatewayv6", + "labels", + "name", + "nameservers", + "nameserversV6", + "networkId", + "prefixes", + "prefixesV6", + "publicIp", + "routed", + "state", + "updatedAt")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name", "networkId", "state")); + } + + /** + * 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 Network + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Network.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 Network is not found in the empty JSON string", + Network.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Network.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("gateway") != null && !jsonObj.get("gateway").isJsonNull()) + && !jsonObj.get("gateway").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `gateway` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("gateway").toString())); + } + if ((jsonObj.get("gatewayv6") != null && !jsonObj.get("gatewayv6").isJsonNull()) + && !jsonObj.get("gatewayv6").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `gatewayv6` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("gatewayv6").toString())); + } + 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())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("nameservers") != null + && !jsonObj.get("nameservers").isJsonNull() + && !jsonObj.get("nameservers").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `nameservers` to be an array in the JSON string but got `%s`", + jsonObj.get("nameservers").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("nameserversV6") != null + && !jsonObj.get("nameserversV6").isJsonNull() + && !jsonObj.get("nameserversV6").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `nameserversV6` to be an array in the JSON string but got `%s`", + jsonObj.get("nameserversV6").toString())); + } + if (!jsonObj.get("networkId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `networkId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("networkId").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("prefixes") != null + && !jsonObj.get("prefixes").isJsonNull() + && !jsonObj.get("prefixes").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `prefixes` to be an array in the JSON string but got `%s`", + jsonObj.get("prefixes").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("prefixesV6") != null + && !jsonObj.get("prefixesV6").isJsonNull() + && !jsonObj.get("prefixesV6").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `prefixesV6` to be an array in the JSON string but got `%s`", + jsonObj.get("prefixesV6").toString())); + } + if ((jsonObj.get("publicIp") != null && !jsonObj.get("publicIp").isJsonNull()) + && !jsonObj.get("publicIp").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `publicIp` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("publicIp").toString())); + } + if (!jsonObj.get("state").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `state` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("state").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Network.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Network' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(Network.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, Network 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 Network read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Network 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 Network given an JSON string + * + * @param jsonString JSON string + * @return An instance of Network + * @throws IOException if the JSON string is invalid with respect to Network + */ + public static Network fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Network.class); + } + + /** + * Convert an instance of Network to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/NetworkArea.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/NetworkArea.java new file mode 100644 index 00000000..57f12b37 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/NetworkArea.java @@ -0,0 +1,521 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; +import java.util.UUID; + +/** Object that represents a network area. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class NetworkArea { + public static final String SERIALIZED_NAME_AREA_ID = "areaId"; + + @SerializedName(SERIALIZED_NAME_AREA_ID) + @javax.annotation.Nonnull + private UUID areaId; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_IPV4 = "ipv4"; + + @SerializedName(SERIALIZED_NAME_IPV4) + @javax.annotation.Nullable private NetworkAreaIPv4 ipv4; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_PROJECT_COUNT = "projectCount"; + + @SerializedName(SERIALIZED_NAME_PROJECT_COUNT) + @javax.annotation.Nonnull + private Long projectCount; + + public static final String SERIALIZED_NAME_STATE = "state"; + + @SerializedName(SERIALIZED_NAME_STATE) + @javax.annotation.Nonnull + private String state; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable private OffsetDateTime updatedAt; + + public NetworkArea() {} + + public NetworkArea(OffsetDateTime createdAt, OffsetDateTime updatedAt) { + this(); + this.createdAt = createdAt; + this.updatedAt = updatedAt; + } + + public NetworkArea areaId(@javax.annotation.Nonnull UUID areaId) { + this.areaId = areaId; + return this; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return areaId + */ + @javax.annotation.Nonnull + public UUID getAreaId() { + return areaId; + } + + public void setAreaId(@javax.annotation.Nonnull UUID areaId) { + this.areaId = areaId; + } + + /** + * Date-time when resource was created. + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public NetworkArea ipv4(@javax.annotation.Nullable NetworkAreaIPv4 ipv4) { + this.ipv4 = ipv4; + return this; + } + + /** + * Get ipv4 + * + * @return ipv4 + */ + @javax.annotation.Nullable public NetworkAreaIPv4 getIpv4() { + return ipv4; + } + + public void setIpv4(@javax.annotation.Nullable NetworkAreaIPv4 ipv4) { + this.ipv4 = ipv4; + } + + public NetworkArea labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public NetworkArea 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 NetworkArea projectCount(@javax.annotation.Nonnull Long projectCount) { + this.projectCount = projectCount; + return this; + } + + /** + * The amount of projects currently referencing a specific area. minimum: 0 + * + * @return projectCount + */ + @javax.annotation.Nonnull + public Long getProjectCount() { + return projectCount; + } + + public void setProjectCount(@javax.annotation.Nonnull Long projectCount) { + this.projectCount = projectCount; + } + + public NetworkArea state(@javax.annotation.Nonnull String state) { + this.state = state; + return this; + } + + /** + * The state of a resource object. Possible values: `CREATING`, `CREATED`, + * `DELETING`, `DELETED`, `FAILED`, `UPDATED`, + * `UPDATING`. + * + * @return state + */ + @javax.annotation.Nonnull + public String getState() { + return state; + } + + public void setState(@javax.annotation.Nonnull String state) { + this.state = state; + } + + /** + * Date-time when resource was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nullable public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * 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 NetworkArea instance itself + */ + public NetworkArea 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; + } + NetworkArea networkArea = (NetworkArea) o; + return Objects.equals(this.areaId, networkArea.areaId) + && Objects.equals(this.createdAt, networkArea.createdAt) + && Objects.equals(this.ipv4, networkArea.ipv4) + && Objects.equals(this.labels, networkArea.labels) + && Objects.equals(this.name, networkArea.name) + && Objects.equals(this.projectCount, networkArea.projectCount) + && Objects.equals(this.state, networkArea.state) + && Objects.equals(this.updatedAt, networkArea.updatedAt) + && Objects.equals(this.additionalProperties, networkArea.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + areaId, + createdAt, + ipv4, + labels, + name, + projectCount, + state, + updatedAt, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NetworkArea {\n"); + sb.append(" areaId: ").append(toIndentedString(areaId)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" ipv4: ").append(toIndentedString(ipv4)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" projectCount: ").append(toIndentedString(projectCount)).append("\n"); + sb.append(" state: ").append(toIndentedString(state)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).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( + "areaId", + "createdAt", + "ipv4", + "labels", + "name", + "projectCount", + "state", + "updatedAt")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = + new HashSet(Arrays.asList("areaId", "name", "projectCount", "state")); + } + + /** + * 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 NetworkArea + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NetworkArea.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 NetworkArea is not found in the empty JSON string", + NetworkArea.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : NetworkArea.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("areaId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `areaId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("areaId").toString())); + } + // validate the optional field `ipv4` + if (jsonObj.get("ipv4") != null && !jsonObj.get("ipv4").isJsonNull()) { + NetworkAreaIPv4.validateJsonElement(jsonObj.get("ipv4")); + } + 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("state").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `state` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("state").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!NetworkArea.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NetworkArea' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(NetworkArea.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, NetworkArea 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 NetworkArea read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + NetworkArea 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 NetworkArea given an JSON string + * + * @param jsonString JSON string + * @return An instance of NetworkArea + * @throws IOException if the JSON string is invalid with respect to NetworkArea + */ + public static NetworkArea fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NetworkArea.class); + } + + /** + * Convert an instance of NetworkArea to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/NetworkAreaIPv4.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/NetworkAreaIPv4.java new file mode 100644 index 00000000..16ce0600 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/NetworkAreaIPv4.java @@ -0,0 +1,539 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** The IPv4 properties of a network area. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class NetworkAreaIPv4 { + public static final String SERIALIZED_NAME_DEFAULT_NAMESERVERS = "defaultNameservers"; + + @SerializedName(SERIALIZED_NAME_DEFAULT_NAMESERVERS) + @javax.annotation.Nullable private List defaultNameservers = new ArrayList<>(); + + public static final String SERIALIZED_NAME_NETWORK_RANGES = "networkRanges"; + + @SerializedName(SERIALIZED_NAME_NETWORK_RANGES) + @javax.annotation.Nullable private List networkRanges = new ArrayList<>(); + + public static final String SERIALIZED_NAME_ROUTES = "routes"; + + @SerializedName(SERIALIZED_NAME_ROUTES) + @javax.annotation.Nullable private List routes = new ArrayList<>(); + + public static final String SERIALIZED_NAME_TRANSFER_NETWORK = "transferNetwork"; + + @SerializedName(SERIALIZED_NAME_TRANSFER_NETWORK) + @javax.annotation.Nullable private String transferNetwork; + + public static final String SERIALIZED_NAME_DEFAULT_PREFIX_LEN = "defaultPrefixLen"; + + @SerializedName(SERIALIZED_NAME_DEFAULT_PREFIX_LEN) + @javax.annotation.Nullable private Integer defaultPrefixLen = 25; + + public static final String SERIALIZED_NAME_MAX_PREFIX_LEN = "maxPrefixLen"; + + @SerializedName(SERIALIZED_NAME_MAX_PREFIX_LEN) + @javax.annotation.Nullable private Integer maxPrefixLen = 29; + + public static final String SERIALIZED_NAME_MIN_PREFIX_LEN = "minPrefixLen"; + + @SerializedName(SERIALIZED_NAME_MIN_PREFIX_LEN) + @javax.annotation.Nullable private Integer minPrefixLen = 24; + + public NetworkAreaIPv4() {} + + public NetworkAreaIPv4 defaultNameservers( + @javax.annotation.Nullable List defaultNameservers) { + this.defaultNameservers = defaultNameservers; + return this; + } + + public NetworkAreaIPv4 addDefaultNameserversItem(String defaultNameserversItem) { + if (this.defaultNameservers == null) { + this.defaultNameservers = new ArrayList<>(); + } + this.defaultNameservers.add(defaultNameserversItem); + return this; + } + + /** + * A list containing DNS Servers/Nameservers for IPv4. + * + * @return defaultNameservers + */ + @javax.annotation.Nullable public List getDefaultNameservers() { + return defaultNameservers; + } + + public void setDefaultNameservers(@javax.annotation.Nullable List defaultNameservers) { + this.defaultNameservers = defaultNameservers; + } + + public NetworkAreaIPv4 networkRanges( + @javax.annotation.Nullable List networkRanges) { + this.networkRanges = networkRanges; + return this; + } + + public NetworkAreaIPv4 addNetworkRangesItem(NetworkRange networkRangesItem) { + if (this.networkRanges == null) { + this.networkRanges = new ArrayList<>(); + } + this.networkRanges.add(networkRangesItem); + return this; + } + + /** + * A list of network ranges. + * + * @return networkRanges + */ + @javax.annotation.Nullable public List getNetworkRanges() { + return networkRanges; + } + + public void setNetworkRanges(@javax.annotation.Nullable List networkRanges) { + this.networkRanges = networkRanges; + } + + public NetworkAreaIPv4 routes(@javax.annotation.Nullable List routes) { + this.routes = routes; + return this; + } + + public NetworkAreaIPv4 addRoutesItem(Route routesItem) { + if (this.routes == null) { + this.routes = new ArrayList<>(); + } + this.routes.add(routesItem); + return this; + } + + /** + * A list of routes. + * + * @return routes + */ + @javax.annotation.Nullable public List getRoutes() { + return routes; + } + + public void setRoutes(@javax.annotation.Nullable List routes) { + this.routes = routes; + } + + public NetworkAreaIPv4 transferNetwork(@javax.annotation.Nullable String transferNetwork) { + this.transferNetwork = transferNetwork; + return this; + } + + /** + * Classless Inter-Domain Routing (CIDR). + * + * @return transferNetwork + */ + @javax.annotation.Nullable public String getTransferNetwork() { + return transferNetwork; + } + + public void setTransferNetwork(@javax.annotation.Nullable String transferNetwork) { + this.transferNetwork = transferNetwork; + } + + public NetworkAreaIPv4 defaultPrefixLen(@javax.annotation.Nullable Integer defaultPrefixLen) { + this.defaultPrefixLen = defaultPrefixLen; + return this; + } + + /** + * The default prefix length for networks in the network area. minimum: 24 maximum: 29 + * + * @return defaultPrefixLen + */ + @javax.annotation.Nullable public Integer getDefaultPrefixLen() { + return defaultPrefixLen; + } + + public void setDefaultPrefixLen(@javax.annotation.Nullable Integer defaultPrefixLen) { + this.defaultPrefixLen = defaultPrefixLen; + } + + public NetworkAreaIPv4 maxPrefixLen(@javax.annotation.Nullable Integer maxPrefixLen) { + this.maxPrefixLen = maxPrefixLen; + return this; + } + + /** + * The maximal prefix length for networks in the network area. minimum: 24 maximum: 29 + * + * @return maxPrefixLen + */ + @javax.annotation.Nullable public Integer getMaxPrefixLen() { + return maxPrefixLen; + } + + public void setMaxPrefixLen(@javax.annotation.Nullable Integer maxPrefixLen) { + this.maxPrefixLen = maxPrefixLen; + } + + public NetworkAreaIPv4 minPrefixLen(@javax.annotation.Nullable Integer minPrefixLen) { + this.minPrefixLen = minPrefixLen; + return this; + } + + /** + * The minimal prefix length for networks in the network area. minimum: 8 maximum: 29 + * + * @return minPrefixLen + */ + @javax.annotation.Nullable public Integer getMinPrefixLen() { + return minPrefixLen; + } + + public void setMinPrefixLen(@javax.annotation.Nullable Integer minPrefixLen) { + this.minPrefixLen = minPrefixLen; + } + + /** + * 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 NetworkAreaIPv4 instance itself + */ + public NetworkAreaIPv4 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; + } + NetworkAreaIPv4 networkAreaIPv4 = (NetworkAreaIPv4) o; + return Objects.equals(this.defaultNameservers, networkAreaIPv4.defaultNameservers) + && Objects.equals(this.networkRanges, networkAreaIPv4.networkRanges) + && Objects.equals(this.routes, networkAreaIPv4.routes) + && Objects.equals(this.transferNetwork, networkAreaIPv4.transferNetwork) + && Objects.equals(this.defaultPrefixLen, networkAreaIPv4.defaultPrefixLen) + && Objects.equals(this.maxPrefixLen, networkAreaIPv4.maxPrefixLen) + && Objects.equals(this.minPrefixLen, networkAreaIPv4.minPrefixLen) + && Objects.equals(this.additionalProperties, networkAreaIPv4.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + defaultNameservers, + networkRanges, + routes, + transferNetwork, + defaultPrefixLen, + maxPrefixLen, + minPrefixLen, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NetworkAreaIPv4 {\n"); + sb.append(" defaultNameservers: ") + .append(toIndentedString(defaultNameservers)) + .append("\n"); + sb.append(" networkRanges: ").append(toIndentedString(networkRanges)).append("\n"); + sb.append(" routes: ").append(toIndentedString(routes)).append("\n"); + sb.append(" transferNetwork: ").append(toIndentedString(transferNetwork)).append("\n"); + sb.append(" defaultPrefixLen: ").append(toIndentedString(defaultPrefixLen)).append("\n"); + sb.append(" maxPrefixLen: ").append(toIndentedString(maxPrefixLen)).append("\n"); + sb.append(" minPrefixLen: ").append(toIndentedString(minPrefixLen)).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( + "defaultNameservers", + "networkRanges", + "routes", + "transferNetwork", + "defaultPrefixLen", + "maxPrefixLen", + "minPrefixLen")); + + // 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 NetworkAreaIPv4 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NetworkAreaIPv4.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 NetworkAreaIPv4 is not found in the empty JSON string", + NetworkAreaIPv4.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("defaultNameservers") != null + && !jsonObj.get("defaultNameservers").isJsonNull() + && !jsonObj.get("defaultNameservers").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `defaultNameservers` to be an array in the JSON string but got `%s`", + jsonObj.get("defaultNameservers").toString())); + } + if (jsonObj.get("networkRanges") != null && !jsonObj.get("networkRanges").isJsonNull()) { + JsonArray jsonArraynetworkRanges = jsonObj.getAsJsonArray("networkRanges"); + if (jsonArraynetworkRanges != null) { + // ensure the json data is an array + if (!jsonObj.get("networkRanges").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `networkRanges` to be an array in the JSON string but got `%s`", + jsonObj.get("networkRanges").toString())); + } + + // validate the optional field `networkRanges` (array) + for (int i = 0; i < jsonArraynetworkRanges.size(); i++) { + NetworkRange.validateJsonElement(jsonArraynetworkRanges.get(i)); + } + ; + } + } + if (jsonObj.get("routes") != null && !jsonObj.get("routes").isJsonNull()) { + JsonArray jsonArrayroutes = jsonObj.getAsJsonArray("routes"); + if (jsonArrayroutes != null) { + // ensure the json data is an array + if (!jsonObj.get("routes").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `routes` to be an array in the JSON string but got `%s`", + jsonObj.get("routes").toString())); + } + + // validate the optional field `routes` (array) + for (int i = 0; i < jsonArrayroutes.size(); i++) { + Route.validateJsonElement(jsonArrayroutes.get(i)); + } + ; + } + } + if ((jsonObj.get("transferNetwork") != null && !jsonObj.get("transferNetwork").isJsonNull()) + && !jsonObj.get("transferNetwork").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `transferNetwork` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("transferNetwork").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!NetworkAreaIPv4.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NetworkAreaIPv4' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(NetworkAreaIPv4.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, NetworkAreaIPv4 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 NetworkAreaIPv4 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + NetworkAreaIPv4 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 NetworkAreaIPv4 given an JSON string + * + * @param jsonString JSON string + * @return An instance of NetworkAreaIPv4 + * @throws IOException if the JSON string is invalid with respect to NetworkAreaIPv4 + */ + public static NetworkAreaIPv4 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NetworkAreaIPv4.class); + } + + /** + * Convert an instance of NetworkAreaIPv4 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/NetworkAreaListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/NetworkAreaListResponse.java new file mode 100644 index 00000000..d93ee129 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/NetworkAreaListResponse.java @@ -0,0 +1,327 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** Network area list response. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class NetworkAreaListResponse { + public static final String SERIALIZED_NAME_ITEMS = "items"; + + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public NetworkAreaListResponse() {} + + public NetworkAreaListResponse items(@javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public NetworkAreaListResponse addItemsItem(NetworkArea itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list of network areas. + * + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NetworkAreaListResponse instance itself + */ + public NetworkAreaListResponse 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; + } + NetworkAreaListResponse networkAreaListResponse = (NetworkAreaListResponse) o; + return Objects.equals(this.items, networkAreaListResponse.items) + && Objects.equals( + this.additionalProperties, networkAreaListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NetworkAreaListResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("items")); + } + + /** + * 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 NetworkAreaListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NetworkAreaListResponse.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 NetworkAreaListResponse is not found in the empty JSON string", + NetworkAreaListResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : NetworkAreaListResponse.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("items").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `items` to be an array in the JSON string but got `%s`", + jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + NetworkArea.validateJsonElement(jsonArrayitems.get(i)); + } + ; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!NetworkAreaListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NetworkAreaListResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(NetworkAreaListResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, NetworkAreaListResponse 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 NetworkAreaListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + NetworkAreaListResponse 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 NetworkAreaListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of NetworkAreaListResponse + * @throws IOException if the JSON string is invalid with respect to NetworkAreaListResponse + */ + public static NetworkAreaListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NetworkAreaListResponse.class); + } + + /** + * Convert an instance of NetworkAreaListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/NetworkListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/NetworkListResponse.java new file mode 100644 index 00000000..ab935363 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/NetworkListResponse.java @@ -0,0 +1,326 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** Network list response. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class NetworkListResponse { + public static final String SERIALIZED_NAME_ITEMS = "items"; + + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public NetworkListResponse() {} + + public NetworkListResponse items(@javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public NetworkListResponse addItemsItem(Network itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list of networks. + * + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NetworkListResponse instance itself + */ + public NetworkListResponse 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; + } + NetworkListResponse networkListResponse = (NetworkListResponse) o; + return Objects.equals(this.items, networkListResponse.items) + && Objects.equals( + this.additionalProperties, networkListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NetworkListResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("items")); + } + + /** + * 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 NetworkListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NetworkListResponse.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 NetworkListResponse is not found in the empty JSON string", + NetworkListResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : NetworkListResponse.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("items").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `items` to be an array in the JSON string but got `%s`", + jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + Network.validateJsonElement(jsonArrayitems.get(i)); + } + ; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!NetworkListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NetworkListResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(NetworkListResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, NetworkListResponse 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 NetworkListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + NetworkListResponse 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 NetworkListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of NetworkListResponse + * @throws IOException if the JSON string is invalid with respect to NetworkListResponse + */ + public static NetworkListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NetworkListResponse.class); + } + + /** + * Convert an instance of NetworkListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/NetworkRange.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/NetworkRange.java new file mode 100644 index 00000000..7fc36db2 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/NetworkRange.java @@ -0,0 +1,373 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; +import java.util.UUID; + +/** Object that represents a network range. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class NetworkRange { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_NETWORK_RANGE_ID = "networkRangeId"; + + @SerializedName(SERIALIZED_NAME_NETWORK_RANGE_ID) + @javax.annotation.Nullable private UUID networkRangeId; + + public static final String SERIALIZED_NAME_PREFIX = "prefix"; + + @SerializedName(SERIALIZED_NAME_PREFIX) + @javax.annotation.Nonnull + private String prefix; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable private OffsetDateTime updatedAt; + + public NetworkRange() {} + + public NetworkRange(OffsetDateTime createdAt, UUID networkRangeId, OffsetDateTime updatedAt) { + this(); + this.createdAt = createdAt; + this.networkRangeId = networkRangeId; + this.updatedAt = updatedAt; + } + + /** + * Date-time when resource was created. + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return networkRangeId + */ + @javax.annotation.Nullable public UUID getNetworkRangeId() { + return networkRangeId; + } + + public NetworkRange prefix(@javax.annotation.Nonnull String prefix) { + this.prefix = prefix; + return this; + } + + /** + * Classless Inter-Domain Routing (CIDR). + * + * @return prefix + */ + @javax.annotation.Nonnull + public String getPrefix() { + return prefix; + } + + public void setPrefix(@javax.annotation.Nonnull String prefix) { + this.prefix = prefix; + } + + /** + * Date-time when resource was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nullable public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * 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 NetworkRange instance itself + */ + public NetworkRange 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; + } + NetworkRange networkRange = (NetworkRange) o; + return Objects.equals(this.createdAt, networkRange.createdAt) + && Objects.equals(this.networkRangeId, networkRange.networkRangeId) + && Objects.equals(this.prefix, networkRange.prefix) + && Objects.equals(this.updatedAt, networkRange.updatedAt) + && Objects.equals(this.additionalProperties, networkRange.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, networkRangeId, prefix, updatedAt, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NetworkRange {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" networkRangeId: ").append(toIndentedString(networkRangeId)).append("\n"); + sb.append(" prefix: ").append(toIndentedString(prefix)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).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("createdAt", "networkRangeId", "prefix", "updatedAt")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("prefix")); + } + + /** + * 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 NetworkRange + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NetworkRange.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 NetworkRange is not found in the empty JSON string", + NetworkRange.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : NetworkRange.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("networkRangeId") != null && !jsonObj.get("networkRangeId").isJsonNull()) + && !jsonObj.get("networkRangeId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `networkRangeId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("networkRangeId").toString())); + } + if (!jsonObj.get("prefix").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `prefix` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("prefix").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!NetworkRange.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NetworkRange' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(NetworkRange.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, NetworkRange 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 NetworkRange read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + NetworkRange 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 NetworkRange given an JSON string + * + * @param jsonString JSON string + * @return An instance of NetworkRange + * @throws IOException if the JSON string is invalid with respect to NetworkRange + */ + public static NetworkRange fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NetworkRange.class); + } + + /** + * Convert an instance of NetworkRange to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/NetworkRangeListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/NetworkRangeListResponse.java new file mode 100644 index 00000000..7b6ccac2 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/NetworkRangeListResponse.java @@ -0,0 +1,327 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** Network Range list response. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class NetworkRangeListResponse { + public static final String SERIALIZED_NAME_ITEMS = "items"; + + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public NetworkRangeListResponse() {} + + public NetworkRangeListResponse items(@javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public NetworkRangeListResponse addItemsItem(NetworkRange itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list of network ranges. + * + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NetworkRangeListResponse instance itself + */ + public NetworkRangeListResponse 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; + } + NetworkRangeListResponse networkRangeListResponse = (NetworkRangeListResponse) o; + return Objects.equals(this.items, networkRangeListResponse.items) + && Objects.equals( + this.additionalProperties, networkRangeListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NetworkRangeListResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("items")); + } + + /** + * 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 NetworkRangeListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NetworkRangeListResponse.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 NetworkRangeListResponse is not found in the empty JSON string", + NetworkRangeListResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : NetworkRangeListResponse.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("items").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `items` to be an array in the JSON string but got `%s`", + jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + NetworkRange.validateJsonElement(jsonArrayitems.get(i)); + } + ; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!NetworkRangeListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NetworkRangeListResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(NetworkRangeListResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, NetworkRangeListResponse 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 NetworkRangeListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + NetworkRangeListResponse 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 NetworkRangeListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of NetworkRangeListResponse + * @throws IOException if the JSON string is invalid with respect to NetworkRangeListResponse + */ + public static NetworkRangeListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NetworkRangeListResponse.class); + } + + /** + * Convert an instance of NetworkRangeListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/PartialUpdateNetworkAreaPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/PartialUpdateNetworkAreaPayload.java new file mode 100644 index 00000000..4a8ba498 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/PartialUpdateNetworkAreaPayload.java @@ -0,0 +1,362 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** PartialUpdateNetworkAreaPayload */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class PartialUpdateNetworkAreaPayload { + public static final String SERIALIZED_NAME_ADDRESS_FAMILY = "addressFamily"; + + @SerializedName(SERIALIZED_NAME_ADDRESS_FAMILY) + @javax.annotation.Nullable private UpdateAreaAddressFamily addressFamily; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; + + public PartialUpdateNetworkAreaPayload() {} + + public PartialUpdateNetworkAreaPayload addressFamily( + @javax.annotation.Nullable UpdateAreaAddressFamily addressFamily) { + this.addressFamily = addressFamily; + return this; + } + + /** + * Get addressFamily + * + * @return addressFamily + */ + @javax.annotation.Nullable public UpdateAreaAddressFamily getAddressFamily() { + return addressFamily; + } + + public void setAddressFamily(@javax.annotation.Nullable UpdateAreaAddressFamily addressFamily) { + this.addressFamily = addressFamily; + } + + public PartialUpdateNetworkAreaPayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public PartialUpdateNetworkAreaPayload name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nullable public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * 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 PartialUpdateNetworkAreaPayload instance itself + */ + public PartialUpdateNetworkAreaPayload 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; + } + PartialUpdateNetworkAreaPayload partialUpdateNetworkAreaPayload = + (PartialUpdateNetworkAreaPayload) o; + return Objects.equals(this.addressFamily, partialUpdateNetworkAreaPayload.addressFamily) + && Objects.equals(this.labels, partialUpdateNetworkAreaPayload.labels) + && Objects.equals(this.name, partialUpdateNetworkAreaPayload.name) + && Objects.equals( + this.additionalProperties, + partialUpdateNetworkAreaPayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(addressFamily, labels, name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PartialUpdateNetworkAreaPayload {\n"); + sb.append(" addressFamily: ").append(toIndentedString(addressFamily)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).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("addressFamily", "labels", "name")); + + // 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 + * PartialUpdateNetworkAreaPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PartialUpdateNetworkAreaPayload.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 PartialUpdateNetworkAreaPayload is not found in the empty JSON string", + PartialUpdateNetworkAreaPayload.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `addressFamily` + if (jsonObj.get("addressFamily") != null && !jsonObj.get("addressFamily").isJsonNull()) { + UpdateAreaAddressFamily.validateJsonElement(jsonObj.get("addressFamily")); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `name` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PartialUpdateNetworkAreaPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PartialUpdateNetworkAreaPayload' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(PartialUpdateNetworkAreaPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, PartialUpdateNetworkAreaPayload 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 PartialUpdateNetworkAreaPayload read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PartialUpdateNetworkAreaPayload 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 PartialUpdateNetworkAreaPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of PartialUpdateNetworkAreaPayload + * @throws IOException if the JSON string is invalid with respect to + * PartialUpdateNetworkAreaPayload + */ + public static PartialUpdateNetworkAreaPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PartialUpdateNetworkAreaPayload.class); + } + + /** + * Convert an instance of PartialUpdateNetworkAreaPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/PartialUpdateNetworkPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/PartialUpdateNetworkPayload.java new file mode 100644 index 00000000..d8987936 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/PartialUpdateNetworkPayload.java @@ -0,0 +1,411 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** Object that represents the request body for a network update. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class PartialUpdateNetworkPayload { + public static final String SERIALIZED_NAME_ADDRESS_FAMILY = "addressFamily"; + + @SerializedName(SERIALIZED_NAME_ADDRESS_FAMILY) + @javax.annotation.Nullable private UpdateNetworkAddressFamily addressFamily; + + public static final String SERIALIZED_NAME_DHCP = "dhcp"; + + @SerializedName(SERIALIZED_NAME_DHCP) + @javax.annotation.Nullable private Boolean dhcp; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; + + public static final String SERIALIZED_NAME_ROUTED = "routed"; + + @SerializedName(SERIALIZED_NAME_ROUTED) + @javax.annotation.Nullable private Boolean routed; + + public PartialUpdateNetworkPayload() {} + + public PartialUpdateNetworkPayload addressFamily( + @javax.annotation.Nullable UpdateNetworkAddressFamily addressFamily) { + this.addressFamily = addressFamily; + return this; + } + + /** + * Get addressFamily + * + * @return addressFamily + */ + @javax.annotation.Nullable public UpdateNetworkAddressFamily getAddressFamily() { + return addressFamily; + } + + public void setAddressFamily( + @javax.annotation.Nullable UpdateNetworkAddressFamily addressFamily) { + this.addressFamily = addressFamily; + } + + public PartialUpdateNetworkPayload dhcp(@javax.annotation.Nullable Boolean dhcp) { + this.dhcp = dhcp; + return this; + } + + /** + * Enable or disable DHCP for a network. + * + * @return dhcp + */ + @javax.annotation.Nullable public Boolean getDhcp() { + return dhcp; + } + + public void setDhcp(@javax.annotation.Nullable Boolean dhcp) { + this.dhcp = dhcp; + } + + public PartialUpdateNetworkPayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public PartialUpdateNetworkPayload name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nullable public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + public PartialUpdateNetworkPayload routed(@javax.annotation.Nullable Boolean routed) { + this.routed = routed; + return this; + } + + /** + * Shows if the network is routed and therefore accessible from other networks. + * + * @return routed + */ + @javax.annotation.Nullable public Boolean getRouted() { + return routed; + } + + public void setRouted(@javax.annotation.Nullable Boolean routed) { + this.routed = routed; + } + + /** + * 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 PartialUpdateNetworkPayload instance itself + */ + public PartialUpdateNetworkPayload 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; + } + PartialUpdateNetworkPayload partialUpdateNetworkPayload = (PartialUpdateNetworkPayload) o; + return Objects.equals(this.addressFamily, partialUpdateNetworkPayload.addressFamily) + && Objects.equals(this.dhcp, partialUpdateNetworkPayload.dhcp) + && Objects.equals(this.labels, partialUpdateNetworkPayload.labels) + && Objects.equals(this.name, partialUpdateNetworkPayload.name) + && Objects.equals(this.routed, partialUpdateNetworkPayload.routed) + && Objects.equals( + this.additionalProperties, + partialUpdateNetworkPayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(addressFamily, dhcp, labels, name, routed, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PartialUpdateNetworkPayload {\n"); + sb.append(" addressFamily: ").append(toIndentedString(addressFamily)).append("\n"); + sb.append(" dhcp: ").append(toIndentedString(dhcp)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" routed: ").append(toIndentedString(routed)).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("addressFamily", "dhcp", "labels", "name", "routed")); + + // 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 + * PartialUpdateNetworkPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PartialUpdateNetworkPayload.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 PartialUpdateNetworkPayload is not found in the empty JSON string", + PartialUpdateNetworkPayload.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `addressFamily` + if (jsonObj.get("addressFamily") != null && !jsonObj.get("addressFamily").isJsonNull()) { + UpdateNetworkAddressFamily.validateJsonElement(jsonObj.get("addressFamily")); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `name` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PartialUpdateNetworkPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PartialUpdateNetworkPayload' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(PartialUpdateNetworkPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, PartialUpdateNetworkPayload 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 PartialUpdateNetworkPayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PartialUpdateNetworkPayload 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 PartialUpdateNetworkPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of PartialUpdateNetworkPayload + * @throws IOException if the JSON string is invalid with respect to PartialUpdateNetworkPayload + */ + public static PartialUpdateNetworkPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PartialUpdateNetworkPayload.class); + } + + /** + * Convert an instance of PartialUpdateNetworkPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/PortRange.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/PortRange.java new file mode 100644 index 00000000..8c130e39 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/PortRange.java @@ -0,0 +1,329 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** + * Object that represents a range of ports (this will be omitted if it covers the full default range + * 0/1-65535). + */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class PortRange { + public static final String SERIALIZED_NAME_MAX = "max"; + + @SerializedName(SERIALIZED_NAME_MAX) + @javax.annotation.Nonnull + private Long max; + + public static final String SERIALIZED_NAME_MIN = "min"; + + @SerializedName(SERIALIZED_NAME_MIN) + @javax.annotation.Nonnull + private Long min; + + public PortRange() {} + + public PortRange max(@javax.annotation.Nonnull Long max) { + this.max = max; + return this; + } + + /** + * The maximum port number. Should be greater or equal to the minimum. minimum: 0 maximum: 65535 + * + * @return max + */ + @javax.annotation.Nonnull + public Long getMax() { + return max; + } + + public void setMax(@javax.annotation.Nonnull Long max) { + this.max = max; + } + + public PortRange min(@javax.annotation.Nonnull Long min) { + this.min = min; + return this; + } + + /** + * The minimum port number. Should be less or equal to the maximum. minimum: 0 maximum: 65535 + * + * @return min + */ + @javax.annotation.Nonnull + public Long getMin() { + return min; + } + + public void setMin(@javax.annotation.Nonnull Long min) { + this.min = min; + } + + /** + * 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 PortRange instance itself + */ + public PortRange 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; + } + PortRange portRange = (PortRange) o; + return Objects.equals(this.max, portRange.max) + && Objects.equals(this.min, portRange.min) + && Objects.equals(this.additionalProperties, portRange.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(max, min, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PortRange {\n"); + sb.append(" max: ").append(toIndentedString(max)).append("\n"); + sb.append(" min: ").append(toIndentedString(min)).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("max", "min")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("max", "min")); + } + + /** + * 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 PortRange + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PortRange.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 PortRange is not found in the empty JSON string", + PortRange.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PortRange.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "The required field `%s` is not found in the JSON string: %s", + requiredField, + jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PortRange.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PortRange' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(PortRange.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, PortRange 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 PortRange read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PortRange 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 PortRange given an JSON string + * + * @param jsonString JSON string + * @return An instance of PortRange + * @throws IOException if the JSON string is invalid with respect to PortRange + */ + public static PortRange fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PortRange.class); + } + + /** + * Convert an instance of PortRange to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/Project.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/Project.java new file mode 100644 index 00000000..1fca7f51 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/Project.java @@ -0,0 +1,481 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; +import java.util.UUID; + +/** Object that represents a STACKIT project. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class Project { + public static final String SERIALIZED_NAME_AREA_ID = "areaId"; + + @SerializedName(SERIALIZED_NAME_AREA_ID) + @javax.annotation.Nonnull + private AreaId areaId; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_INTERNET_ACCESS = "internetAccess"; + + @SerializedName(SERIALIZED_NAME_INTERNET_ACCESS) + @javax.annotation.Nullable private Boolean internetAccess; + + public static final String SERIALIZED_NAME_OPENSTACK_PROJECT_ID = "openstackProjectId"; + + @SerializedName(SERIALIZED_NAME_OPENSTACK_PROJECT_ID) + @javax.annotation.Nullable private String openstackProjectId; + + public static final String SERIALIZED_NAME_PROJECT_ID = "projectId"; + + @SerializedName(SERIALIZED_NAME_PROJECT_ID) + @javax.annotation.Nonnull + private UUID projectId; + + public static final String SERIALIZED_NAME_STATE = "state"; + + @SerializedName(SERIALIZED_NAME_STATE) + @javax.annotation.Nonnull + private String state; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable private OffsetDateTime updatedAt; + + public Project() {} + + public Project(OffsetDateTime createdAt, String openstackProjectId, OffsetDateTime updatedAt) { + this(); + this.createdAt = createdAt; + this.openstackProjectId = openstackProjectId; + this.updatedAt = updatedAt; + } + + public Project areaId(@javax.annotation.Nonnull AreaId areaId) { + this.areaId = areaId; + return this; + } + + /** + * Get areaId + * + * @return areaId + */ + @javax.annotation.Nonnull + public AreaId getAreaId() { + return areaId; + } + + public void setAreaId(@javax.annotation.Nonnull AreaId areaId) { + this.areaId = areaId; + } + + /** + * Date-time when resource was created. + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public Project internetAccess(@javax.annotation.Nullable Boolean internetAccess) { + this.internetAccess = internetAccess; + return this; + } + + /** + * Get internetAccess + * + * @return internetAccess + */ + @javax.annotation.Nullable public Boolean getInternetAccess() { + return internetAccess; + } + + public void setInternetAccess(@javax.annotation.Nullable Boolean internetAccess) { + this.internetAccess = internetAccess; + } + + /** + * The identifier (ID) of the OpenStack project in the main region eu01. + * + * @return openstackProjectId + */ + @javax.annotation.Nullable public String getOpenstackProjectId() { + return openstackProjectId; + } + + public Project projectId(@javax.annotation.Nonnull UUID projectId) { + this.projectId = projectId; + return this; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return projectId + */ + @javax.annotation.Nonnull + public UUID getProjectId() { + return projectId; + } + + public void setProjectId(@javax.annotation.Nonnull UUID projectId) { + this.projectId = projectId; + } + + public Project state(@javax.annotation.Nonnull String state) { + this.state = state; + return this; + } + + /** + * The state of a resource object. Possible values: `CREATING`, `CREATED`, + * `DELETING`, `DELETED`, `FAILED`, `UPDATED`, + * `UPDATING`. + * + * @return state + */ + @javax.annotation.Nonnull + public String getState() { + return state; + } + + public void setState(@javax.annotation.Nonnull String state) { + this.state = state; + } + + /** + * Date-time when resource was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nullable public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * 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 Project instance itself + */ + public Project 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; + } + Project project = (Project) o; + return Objects.equals(this.areaId, project.areaId) + && Objects.equals(this.createdAt, project.createdAt) + && Objects.equals(this.internetAccess, project.internetAccess) + && Objects.equals(this.openstackProjectId, project.openstackProjectId) + && Objects.equals(this.projectId, project.projectId) + && Objects.equals(this.state, project.state) + && Objects.equals(this.updatedAt, project.updatedAt) + && Objects.equals(this.additionalProperties, project.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + areaId, + createdAt, + internetAccess, + openstackProjectId, + projectId, + state, + updatedAt, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Project {\n"); + sb.append(" areaId: ").append(toIndentedString(areaId)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" internetAccess: ").append(toIndentedString(internetAccess)).append("\n"); + sb.append(" openstackProjectId: ") + .append(toIndentedString(openstackProjectId)) + .append("\n"); + sb.append(" projectId: ").append(toIndentedString(projectId)).append("\n"); + sb.append(" state: ").append(toIndentedString(state)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).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( + "areaId", + "createdAt", + "internetAccess", + "openstackProjectId", + "projectId", + "state", + "updatedAt")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("areaId", "projectId", "state")); + } + + /** + * 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 Project + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Project.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 Project is not found in the empty JSON string", + Project.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Project.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 `areaId` + AreaId.validateJsonElement(jsonObj.get("areaId")); + if ((jsonObj.get("openstackProjectId") != null + && !jsonObj.get("openstackProjectId").isJsonNull()) + && !jsonObj.get("openstackProjectId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `openstackProjectId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("openstackProjectId").toString())); + } + if (!jsonObj.get("projectId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `projectId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("projectId").toString())); + } + if (!jsonObj.get("state").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `state` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("state").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Project.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Project' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(Project.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, Project 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 Project read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Project 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 Project given an JSON string + * + * @param jsonString JSON string + * @return An instance of Project + * @throws IOException if the JSON string is invalid with respect to Project + */ + public static Project fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Project.class); + } + + /** + * Convert an instance of Project to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ProjectListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ProjectListResponse.java new file mode 100644 index 00000000..e36e1fb9 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ProjectListResponse.java @@ -0,0 +1,322 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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.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; +import java.util.UUID; + +/** Project list response. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class ProjectListResponse { + public static final String SERIALIZED_NAME_ITEMS = "items"; + + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public ProjectListResponse() {} + + public ProjectListResponse items(@javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public ProjectListResponse addItemsItem(UUID itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list of STACKIT projects. + * + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ProjectListResponse instance itself + */ + public ProjectListResponse 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; + } + ProjectListResponse projectListResponse = (ProjectListResponse) o; + return Objects.equals(this.items, projectListResponse.items) + && Objects.equals( + this.additionalProperties, projectListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProjectListResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("items")); + } + + /** + * 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 ProjectListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProjectListResponse.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 ProjectListResponse is not found in the empty JSON string", + ProjectListResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ProjectListResponse.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 required json array is present + if (jsonObj.get("items") == null) { + throw new IllegalArgumentException( + "Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("items").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `items` to be an array in the JSON string but got `%s`", + jsonObj.get("items").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProjectListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProjectListResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ProjectListResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ProjectListResponse 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 ProjectListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ProjectListResponse 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 ProjectListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProjectListResponse + * @throws IOException if the JSON string is invalid with respect to ProjectListResponse + */ + public static ProjectListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProjectListResponse.class); + } + + /** + * Convert an instance of ProjectListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/Protocol.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/Protocol.java new file mode 100644 index 00000000..83eaf6ff --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/Protocol.java @@ -0,0 +1,323 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** The schema for a protocol of a security group rule. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class Protocol { + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; + + public static final String SERIALIZED_NAME_NUMBER = "number"; + + @SerializedName(SERIALIZED_NAME_NUMBER) + @javax.annotation.Nullable private Long number; + + public Protocol() {} + + public Protocol name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The protocol name which the rule should match. Possible values: `ah`, + * `dccp`, `egp`, `esp`, `gre`, `icmp`, + * `igmp`, `ipip`, `ipv6-encap`, `ipv6-frag`, + * `ipv6-icmp`, `ipv6-nonxt`, `ipv6-opts`, `ipv6-route`, + * `ospf`, `pgm`, `rsvp`, `sctp`, `tcp`, + * `udp`, `udplite`, `vrrp`. + * + * @return name + */ + @javax.annotation.Nullable public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + public Protocol number(@javax.annotation.Nullable Long number) { + this.number = number; + return this; + } + + /** + * The protocol number which the rule should match. minimum: 0 maximum: 255 + * + * @return number + */ + @javax.annotation.Nullable public Long getNumber() { + return number; + } + + public void setNumber(@javax.annotation.Nullable Long number) { + this.number = number; + } + + /** + * 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 Protocol instance itself + */ + public Protocol 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; + } + Protocol protocol = (Protocol) o; + return Objects.equals(this.name, protocol.name) + && Objects.equals(this.number, protocol.number) + && Objects.equals(this.additionalProperties, protocol.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(name, number, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Protocol {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" number: ").append(toIndentedString(number)).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", "number")); + + // 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 Protocol + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Protocol.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 Protocol is not found in the empty JSON string", + Protocol.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `name` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Protocol.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Protocol' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(Protocol.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, Protocol 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 Protocol read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Protocol 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 Protocol given an JSON string + * + * @param jsonString JSON string + * @return An instance of Protocol + * @throws IOException if the JSON string is invalid with respect to Protocol + */ + public static Protocol fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Protocol.class); + } + + /** + * Convert an instance of Protocol to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/PublicIp.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/PublicIp.java new file mode 100644 index 00000000..df9bb9f8 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/PublicIp.java @@ -0,0 +1,396 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.v1api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Object that represents a public IP. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class PublicIp { + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_IP = "ip"; + + @SerializedName(SERIALIZED_NAME_IP) + @javax.annotation.Nullable private String ip; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NETWORK_INTERFACE = "networkInterface"; + + @SerializedName(SERIALIZED_NAME_NETWORK_INTERFACE) + @javax.annotation.Nullable private UUID networkInterface; + + public PublicIp() {} + + public PublicIp(UUID id, String ip) { + this(); + this.id = id; + this.ip = ip; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + /** + * Object that represents an IP address. + * + * @return ip + */ + @javax.annotation.Nullable public String getIp() { + return ip; + } + + public PublicIp labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public PublicIp networkInterface(@javax.annotation.Nullable UUID networkInterface) { + this.networkInterface = networkInterface; + return this; + } + + /** + * Associate the public IP with a network interface (ID). + * + * @return networkInterface + */ + @javax.annotation.Nullable public UUID getNetworkInterface() { + return networkInterface; + } + + public void setNetworkInterface(@javax.annotation.Nullable UUID networkInterface) { + this.networkInterface = networkInterface; + } + + /** + * 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 PublicIp instance itself + */ + public PublicIp 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; + } + PublicIp publicIp = (PublicIp) o; + return Objects.equals(this.id, publicIp.id) + && Objects.equals(this.ip, publicIp.ip) + && Objects.equals(this.labels, publicIp.labels) + && Objects.equals(this.networkInterface, publicIp.networkInterface) + && Objects.equals(this.additionalProperties, publicIp.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(id, ip, labels, networkInterface, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PublicIp {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" ip: ").append(toIndentedString(ip)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" networkInterface: ").append(toIndentedString(networkInterface)).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("id", "ip", "labels", "networkInterface")); + + // 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 PublicIp + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PublicIp.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 PublicIp is not found in the empty JSON string", + PublicIp.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if ((jsonObj.get("ip") != null && !jsonObj.get("ip").isJsonNull()) + && !jsonObj.get("ip").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `ip` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("ip").toString())); + } + if ((jsonObj.get("networkInterface") != null + && !jsonObj.get("networkInterface").isJsonNull()) + && !jsonObj.get("networkInterface").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `networkInterface` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("networkInterface").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PublicIp.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PublicIp' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(PublicIp.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, PublicIp 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 PublicIp read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PublicIp 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 PublicIp given an JSON string + * + * @param jsonString JSON string + * @return An instance of PublicIp + * @throws IOException if the JSON string is invalid with respect to PublicIp + */ + public static PublicIp fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PublicIp.class); + } + + /** + * Convert an instance of PublicIp to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/PublicIpListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/PublicIpListResponse.java new file mode 100644 index 00000000..4cd372c8 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/PublicIpListResponse.java @@ -0,0 +1,326 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** Public IP list response. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class PublicIpListResponse { + public static final String SERIALIZED_NAME_ITEMS = "items"; + + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public PublicIpListResponse() {} + + public PublicIpListResponse items(@javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public PublicIpListResponse addItemsItem(PublicIp itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list of public IPs. + * + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PublicIpListResponse instance itself + */ + public PublicIpListResponse 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; + } + PublicIpListResponse publicIpListResponse = (PublicIpListResponse) o; + return Objects.equals(this.items, publicIpListResponse.items) + && Objects.equals( + this.additionalProperties, publicIpListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PublicIpListResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("items")); + } + + /** + * 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 PublicIpListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PublicIpListResponse.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 PublicIpListResponse is not found in the empty JSON string", + PublicIpListResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PublicIpListResponse.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("items").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `items` to be an array in the JSON string but got `%s`", + jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + PublicIp.validateJsonElement(jsonArrayitems.get(i)); + } + ; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PublicIpListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PublicIpListResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(PublicIpListResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, PublicIpListResponse 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 PublicIpListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PublicIpListResponse 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 PublicIpListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of PublicIpListResponse + * @throws IOException if the JSON string is invalid with respect to PublicIpListResponse + */ + public static PublicIpListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PublicIpListResponse.class); + } + + /** + * Convert an instance of PublicIpListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/PublicNetwork.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/PublicNetwork.java new file mode 100644 index 00000000..64668233 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/PublicNetwork.java @@ -0,0 +1,306 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** Public network. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class PublicNetwork { + public static final String SERIALIZED_NAME_CIDR = "cidr"; + + @SerializedName(SERIALIZED_NAME_CIDR) + @javax.annotation.Nonnull + private String cidr; + + public PublicNetwork() {} + + public PublicNetwork cidr(@javax.annotation.Nonnull String cidr) { + this.cidr = cidr; + return this; + } + + /** + * Classless Inter-Domain Routing (CIDR). + * + * @return cidr + */ + @javax.annotation.Nonnull + public String getCidr() { + return cidr; + } + + public void setCidr(@javax.annotation.Nonnull String cidr) { + this.cidr = cidr; + } + + /** + * 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 PublicNetwork instance itself + */ + public PublicNetwork 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; + } + PublicNetwork publicNetwork = (PublicNetwork) o; + return Objects.equals(this.cidr, publicNetwork.cidr) + && Objects.equals(this.additionalProperties, publicNetwork.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(cidr, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PublicNetwork {\n"); + sb.append(" cidr: ").append(toIndentedString(cidr)).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("cidr")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("cidr")); + } + + /** + * 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 PublicNetwork + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PublicNetwork.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 PublicNetwork is not found in the empty JSON string", + PublicNetwork.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PublicNetwork.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("cidr").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `cidr` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("cidr").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PublicNetwork.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PublicNetwork' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(PublicNetwork.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, PublicNetwork 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 PublicNetwork read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PublicNetwork 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 PublicNetwork given an JSON string + * + * @param jsonString JSON string + * @return An instance of PublicNetwork + * @throws IOException if the JSON string is invalid with respect to PublicNetwork + */ + public static PublicNetwork fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PublicNetwork.class); + } + + /** + * Convert an instance of PublicNetwork to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/PublicNetworkListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/PublicNetworkListResponse.java new file mode 100644 index 00000000..689a2bf3 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/PublicNetworkListResponse.java @@ -0,0 +1,327 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** Public network list response. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class PublicNetworkListResponse { + public static final String SERIALIZED_NAME_ITEMS = "items"; + + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public PublicNetworkListResponse() {} + + public PublicNetworkListResponse items(@javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public PublicNetworkListResponse addItemsItem(PublicNetwork itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list of public networks. + * + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PublicNetworkListResponse instance itself + */ + public PublicNetworkListResponse 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; + } + PublicNetworkListResponse publicNetworkListResponse = (PublicNetworkListResponse) o; + return Objects.equals(this.items, publicNetworkListResponse.items) + && Objects.equals( + this.additionalProperties, publicNetworkListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PublicNetworkListResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("items")); + } + + /** + * 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 PublicNetworkListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PublicNetworkListResponse.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 PublicNetworkListResponse is not found in the empty JSON string", + PublicNetworkListResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PublicNetworkListResponse.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("items").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `items` to be an array in the JSON string but got `%s`", + jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + PublicNetwork.validateJsonElement(jsonArrayitems.get(i)); + } + ; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PublicNetworkListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PublicNetworkListResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(PublicNetworkListResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, PublicNetworkListResponse 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 PublicNetworkListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PublicNetworkListResponse 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 PublicNetworkListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of PublicNetworkListResponse + * @throws IOException if the JSON string is invalid with respect to PublicNetworkListResponse + */ + public static PublicNetworkListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PublicNetworkListResponse.class); + } + + /** + * Convert an instance of PublicNetworkListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/Quota.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/Quota.java new file mode 100644 index 00000000..51abcc2e --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/Quota.java @@ -0,0 +1,326 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** Object that represents a single resource quota. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class Quota { + public static final String SERIALIZED_NAME_LIMIT = "limit"; + + @SerializedName(SERIALIZED_NAME_LIMIT) + @javax.annotation.Nonnull + private Long limit; + + public static final String SERIALIZED_NAME_USAGE = "usage"; + + @SerializedName(SERIALIZED_NAME_USAGE) + @javax.annotation.Nonnull + private Long usage; + + public Quota() {} + + public Quota limit(@javax.annotation.Nonnull Long limit) { + this.limit = limit; + return this; + } + + /** + * Get limit + * + * @return limit + */ + @javax.annotation.Nonnull + public Long getLimit() { + return limit; + } + + public void setLimit(@javax.annotation.Nonnull Long limit) { + this.limit = limit; + } + + public Quota usage(@javax.annotation.Nonnull Long usage) { + this.usage = usage; + return this; + } + + /** + * Get usage + * + * @return usage + */ + @javax.annotation.Nonnull + public Long getUsage() { + return usage; + } + + public void setUsage(@javax.annotation.Nonnull Long usage) { + this.usage = usage; + } + + /** + * 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 Quota instance itself + */ + public Quota 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; + } + Quota quota = (Quota) o; + return Objects.equals(this.limit, quota.limit) + && Objects.equals(this.usage, quota.usage) + && Objects.equals(this.additionalProperties, quota.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(limit, usage, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Quota {\n"); + sb.append(" limit: ").append(toIndentedString(limit)).append("\n"); + sb.append(" usage: ").append(toIndentedString(usage)).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("limit", "usage")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("limit", "usage")); + } + + /** + * 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 Quota + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Quota.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 Quota is not found in the empty JSON string", + Quota.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Quota.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "The required field `%s` is not found in the JSON string: %s", + requiredField, + jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Quota.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Quota' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(Quota.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, Quota 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 Quota read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Quota 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 Quota given an JSON string + * + * @param jsonString JSON string + * @return An instance of Quota + * @throws IOException if the JSON string is invalid with respect to Quota + */ + public static Quota fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Quota.class); + } + + /** + * Convert an instance of Quota to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/QuotaList.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/QuotaList.java new file mode 100644 index 00000000..537dc299 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/QuotaList.java @@ -0,0 +1,663 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** Object that represents the quotas for a project. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class QuotaList { + public static final String SERIALIZED_NAME_BACKUP_GIGABYTES = "backupGigabytes"; + + @SerializedName(SERIALIZED_NAME_BACKUP_GIGABYTES) + @javax.annotation.Nonnull + private Quota backupGigabytes; + + public static final String SERIALIZED_NAME_BACKUPS = "backups"; + + @SerializedName(SERIALIZED_NAME_BACKUPS) + @javax.annotation.Nonnull + private Quota backups; + + public static final String SERIALIZED_NAME_GIGABYTES = "gigabytes"; + + @SerializedName(SERIALIZED_NAME_GIGABYTES) + @javax.annotation.Nonnull + private Quota gigabytes; + + public static final String SERIALIZED_NAME_NETWORKS = "networks"; + + @SerializedName(SERIALIZED_NAME_NETWORKS) + @javax.annotation.Nonnull + private Quota networks; + + public static final String SERIALIZED_NAME_NICS = "nics"; + + @SerializedName(SERIALIZED_NAME_NICS) + @javax.annotation.Nonnull + private Quota nics; + + public static final String SERIALIZED_NAME_PUBLIC_IPS = "publicIps"; + + @SerializedName(SERIALIZED_NAME_PUBLIC_IPS) + @javax.annotation.Nonnull + private Quota publicIps; + + public static final String SERIALIZED_NAME_RAM = "ram"; + + @SerializedName(SERIALIZED_NAME_RAM) + @javax.annotation.Nonnull + private Quota ram; + + public static final String SERIALIZED_NAME_SECURITY_GROUP_RULES = "securityGroupRules"; + + @SerializedName(SERIALIZED_NAME_SECURITY_GROUP_RULES) + @javax.annotation.Nonnull + private Quota securityGroupRules; + + public static final String SERIALIZED_NAME_SECURITY_GROUPS = "securityGroups"; + + @SerializedName(SERIALIZED_NAME_SECURITY_GROUPS) + @javax.annotation.Nonnull + private Quota securityGroups; + + public static final String SERIALIZED_NAME_SNAPSHOTS = "snapshots"; + + @SerializedName(SERIALIZED_NAME_SNAPSHOTS) + @javax.annotation.Nonnull + private Quota snapshots; + + public static final String SERIALIZED_NAME_VCPU = "vcpu"; + + @SerializedName(SERIALIZED_NAME_VCPU) + @javax.annotation.Nonnull + private Quota vcpu; + + public static final String SERIALIZED_NAME_VOLUMES = "volumes"; + + @SerializedName(SERIALIZED_NAME_VOLUMES) + @javax.annotation.Nonnull + private Quota volumes; + + public QuotaList() {} + + public QuotaList backupGigabytes(@javax.annotation.Nonnull Quota backupGigabytes) { + this.backupGigabytes = backupGigabytes; + return this; + } + + /** + * Total size in GiB of backups. + * + * @return backupGigabytes + */ + @javax.annotation.Nonnull + public Quota getBackupGigabytes() { + return backupGigabytes; + } + + public void setBackupGigabytes(@javax.annotation.Nonnull Quota backupGigabytes) { + this.backupGigabytes = backupGigabytes; + } + + public QuotaList backups(@javax.annotation.Nonnull Quota backups) { + this.backups = backups; + return this; + } + + /** + * Number of backups. + * + * @return backups + */ + @javax.annotation.Nonnull + public Quota getBackups() { + return backups; + } + + public void setBackups(@javax.annotation.Nonnull Quota backups) { + this.backups = backups; + } + + public QuotaList gigabytes(@javax.annotation.Nonnull Quota gigabytes) { + this.gigabytes = gigabytes; + return this; + } + + /** + * Total size in GiB of volumes and snapshots. + * + * @return gigabytes + */ + @javax.annotation.Nonnull + public Quota getGigabytes() { + return gigabytes; + } + + public void setGigabytes(@javax.annotation.Nonnull Quota gigabytes) { + this.gigabytes = gigabytes; + } + + public QuotaList networks(@javax.annotation.Nonnull Quota networks) { + this.networks = networks; + return this; + } + + /** + * Number of networks. + * + * @return networks + */ + @javax.annotation.Nonnull + public Quota getNetworks() { + return networks; + } + + public void setNetworks(@javax.annotation.Nonnull Quota networks) { + this.networks = networks; + } + + public QuotaList nics(@javax.annotation.Nonnull Quota nics) { + this.nics = nics; + return this; + } + + /** + * Number of network interfaces. + * + * @return nics + */ + @javax.annotation.Nonnull + public Quota getNics() { + return nics; + } + + public void setNics(@javax.annotation.Nonnull Quota nics) { + this.nics = nics; + } + + public QuotaList publicIps(@javax.annotation.Nonnull Quota publicIps) { + this.publicIps = publicIps; + return this; + } + + /** + * Number of public IP addresses. + * + * @return publicIps + */ + @javax.annotation.Nonnull + public Quota getPublicIps() { + return publicIps; + } + + public void setPublicIps(@javax.annotation.Nonnull Quota publicIps) { + this.publicIps = publicIps; + } + + public QuotaList ram(@javax.annotation.Nonnull Quota ram) { + this.ram = ram; + return this; + } + + /** + * Amount of server RAM in MiB. + * + * @return ram + */ + @javax.annotation.Nonnull + public Quota getRam() { + return ram; + } + + public void setRam(@javax.annotation.Nonnull Quota ram) { + this.ram = ram; + } + + public QuotaList securityGroupRules(@javax.annotation.Nonnull Quota securityGroupRules) { + this.securityGroupRules = securityGroupRules; + return this; + } + + /** + * Number of security group rules. + * + * @return securityGroupRules + */ + @javax.annotation.Nonnull + public Quota getSecurityGroupRules() { + return securityGroupRules; + } + + public void setSecurityGroupRules(@javax.annotation.Nonnull Quota securityGroupRules) { + this.securityGroupRules = securityGroupRules; + } + + public QuotaList securityGroups(@javax.annotation.Nonnull Quota securityGroups) { + this.securityGroups = securityGroups; + return this; + } + + /** + * Number of security groups. + * + * @return securityGroups + */ + @javax.annotation.Nonnull + public Quota getSecurityGroups() { + return securityGroups; + } + + public void setSecurityGroups(@javax.annotation.Nonnull Quota securityGroups) { + this.securityGroups = securityGroups; + } + + public QuotaList snapshots(@javax.annotation.Nonnull Quota snapshots) { + this.snapshots = snapshots; + return this; + } + + /** + * Number of snapshots. + * + * @return snapshots + */ + @javax.annotation.Nonnull + public Quota getSnapshots() { + return snapshots; + } + + public void setSnapshots(@javax.annotation.Nonnull Quota snapshots) { + this.snapshots = snapshots; + } + + public QuotaList vcpu(@javax.annotation.Nonnull Quota vcpu) { + this.vcpu = vcpu; + return this; + } + + /** + * Number of server cores. + * + * @return vcpu + */ + @javax.annotation.Nonnull + public Quota getVcpu() { + return vcpu; + } + + public void setVcpu(@javax.annotation.Nonnull Quota vcpu) { + this.vcpu = vcpu; + } + + public QuotaList volumes(@javax.annotation.Nonnull Quota volumes) { + this.volumes = volumes; + return this; + } + + /** + * Number of volumes. + * + * @return volumes + */ + @javax.annotation.Nonnull + public Quota getVolumes() { + return volumes; + } + + public void setVolumes(@javax.annotation.Nonnull Quota volumes) { + this.volumes = volumes; + } + + /** + * 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 QuotaList instance itself + */ + public QuotaList 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; + } + QuotaList quotaList = (QuotaList) o; + return Objects.equals(this.backupGigabytes, quotaList.backupGigabytes) + && Objects.equals(this.backups, quotaList.backups) + && Objects.equals(this.gigabytes, quotaList.gigabytes) + && Objects.equals(this.networks, quotaList.networks) + && Objects.equals(this.nics, quotaList.nics) + && Objects.equals(this.publicIps, quotaList.publicIps) + && Objects.equals(this.ram, quotaList.ram) + && Objects.equals(this.securityGroupRules, quotaList.securityGroupRules) + && Objects.equals(this.securityGroups, quotaList.securityGroups) + && Objects.equals(this.snapshots, quotaList.snapshots) + && Objects.equals(this.vcpu, quotaList.vcpu) + && Objects.equals(this.volumes, quotaList.volumes) + && Objects.equals(this.additionalProperties, quotaList.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + backupGigabytes, + backups, + gigabytes, + networks, + nics, + publicIps, + ram, + securityGroupRules, + securityGroups, + snapshots, + vcpu, + volumes, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class QuotaList {\n"); + sb.append(" backupGigabytes: ").append(toIndentedString(backupGigabytes)).append("\n"); + sb.append(" backups: ").append(toIndentedString(backups)).append("\n"); + sb.append(" gigabytes: ").append(toIndentedString(gigabytes)).append("\n"); + sb.append(" networks: ").append(toIndentedString(networks)).append("\n"); + sb.append(" nics: ").append(toIndentedString(nics)).append("\n"); + sb.append(" publicIps: ").append(toIndentedString(publicIps)).append("\n"); + sb.append(" ram: ").append(toIndentedString(ram)).append("\n"); + sb.append(" securityGroupRules: ") + .append(toIndentedString(securityGroupRules)) + .append("\n"); + sb.append(" securityGroups: ").append(toIndentedString(securityGroups)).append("\n"); + sb.append(" snapshots: ").append(toIndentedString(snapshots)).append("\n"); + sb.append(" vcpu: ").append(toIndentedString(vcpu)).append("\n"); + sb.append(" volumes: ").append(toIndentedString(volumes)).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( + "backupGigabytes", + "backups", + "gigabytes", + "networks", + "nics", + "publicIps", + "ram", + "securityGroupRules", + "securityGroups", + "snapshots", + "vcpu", + "volumes")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = + new HashSet( + Arrays.asList( + "backupGigabytes", + "backups", + "gigabytes", + "networks", + "nics", + "publicIps", + "ram", + "securityGroupRules", + "securityGroups", + "snapshots", + "vcpu", + "volumes")); + } + + /** + * 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 QuotaList + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!QuotaList.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 QuotaList is not found in the empty JSON string", + QuotaList.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : QuotaList.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 `backupGigabytes` + Quota.validateJsonElement(jsonObj.get("backupGigabytes")); + // validate the required field `backups` + Quota.validateJsonElement(jsonObj.get("backups")); + // validate the required field `gigabytes` + Quota.validateJsonElement(jsonObj.get("gigabytes")); + // validate the required field `networks` + Quota.validateJsonElement(jsonObj.get("networks")); + // validate the required field `nics` + Quota.validateJsonElement(jsonObj.get("nics")); + // validate the required field `publicIps` + Quota.validateJsonElement(jsonObj.get("publicIps")); + // validate the required field `ram` + Quota.validateJsonElement(jsonObj.get("ram")); + // validate the required field `securityGroupRules` + Quota.validateJsonElement(jsonObj.get("securityGroupRules")); + // validate the required field `securityGroups` + Quota.validateJsonElement(jsonObj.get("securityGroups")); + // validate the required field `snapshots` + Quota.validateJsonElement(jsonObj.get("snapshots")); + // validate the required field `vcpu` + Quota.validateJsonElement(jsonObj.get("vcpu")); + // validate the required field `volumes` + Quota.validateJsonElement(jsonObj.get("volumes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!QuotaList.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'QuotaList' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(QuotaList.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, QuotaList 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 QuotaList read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + QuotaList 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 QuotaList given an JSON string + * + * @param jsonString JSON string + * @return An instance of QuotaList + * @throws IOException if the JSON string is invalid with respect to QuotaList + */ + public static QuotaList fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, QuotaList.class); + } + + /** + * Convert an instance of QuotaList to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/QuotaListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/QuotaListResponse.java new file mode 100644 index 00000000..2c7dde0f --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/QuotaListResponse.java @@ -0,0 +1,303 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** Quotas list response. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class QuotaListResponse { + public static final String SERIALIZED_NAME_QUOTAS = "quotas"; + + @SerializedName(SERIALIZED_NAME_QUOTAS) + @javax.annotation.Nonnull + private QuotaList quotas; + + public QuotaListResponse() {} + + public QuotaListResponse quotas(@javax.annotation.Nonnull QuotaList quotas) { + this.quotas = quotas; + return this; + } + + /** + * Get quotas + * + * @return quotas + */ + @javax.annotation.Nonnull + public QuotaList getQuotas() { + return quotas; + } + + public void setQuotas(@javax.annotation.Nonnull QuotaList quotas) { + this.quotas = quotas; + } + + /** + * 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 QuotaListResponse instance itself + */ + public QuotaListResponse 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; + } + QuotaListResponse quotaListResponse = (QuotaListResponse) o; + return Objects.equals(this.quotas, quotaListResponse.quotas) + && Objects.equals( + this.additionalProperties, quotaListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(quotas, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class QuotaListResponse {\n"); + sb.append(" quotas: ").append(toIndentedString(quotas)).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("quotas")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("quotas")); + } + + /** + * 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 QuotaListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!QuotaListResponse.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 QuotaListResponse is not found in the empty JSON string", + QuotaListResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : QuotaListResponse.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 `quotas` + QuotaList.validateJsonElement(jsonObj.get("quotas")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!QuotaListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'QuotaListResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(QuotaListResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, QuotaListResponse 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 QuotaListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + QuotaListResponse 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 QuotaListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of QuotaListResponse + * @throws IOException if the JSON string is invalid with respect to QuotaListResponse + */ + public static QuotaListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, QuotaListResponse.class); + } + + /** + * Convert an instance of QuotaListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/Request.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/Request.java new file mode 100644 index 00000000..02ef51ef --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/Request.java @@ -0,0 +1,521 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** Object that represents a request. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class Request { + public static final String SERIALIZED_NAME_DETAILS = "details"; + + @SerializedName(SERIALIZED_NAME_DETAILS) + @javax.annotation.Nullable private String details; + + public static final String SERIALIZED_NAME_REQUEST_ACTION = "requestAction"; + + @SerializedName(SERIALIZED_NAME_REQUEST_ACTION) + @javax.annotation.Nonnull + private String requestAction; + + public static final String SERIALIZED_NAME_REQUEST_ID = "requestId"; + + @SerializedName(SERIALIZED_NAME_REQUEST_ID) + @javax.annotation.Nonnull + private String requestId; + + public static final String SERIALIZED_NAME_REQUEST_TYPE = "requestType"; + + @SerializedName(SERIALIZED_NAME_REQUEST_TYPE) + @javax.annotation.Nonnull + private String requestType; + + public static final String SERIALIZED_NAME_RESOURCES = "resources"; + + @SerializedName(SERIALIZED_NAME_RESOURCES) + @javax.annotation.Nonnull + private List resources = new ArrayList<>(); + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nonnull + private String status; + + public Request() {} + + public Request details(@javax.annotation.Nullable String details) { + this.details = details; + return this; + } + + /** + * Get details + * + * @return details + */ + @javax.annotation.Nullable public String getDetails() { + return details; + } + + public void setDetails(@javax.annotation.Nullable String details) { + this.details = details; + } + + public Request requestAction(@javax.annotation.Nonnull String requestAction) { + this.requestAction = requestAction; + return this; + } + + /** + * Object that represents a resource action. Possible values: `CREATE`, + * `DELETE`, `UPDATE`. + * + * @return requestAction + */ + @javax.annotation.Nonnull + public String getRequestAction() { + return requestAction; + } + + public void setRequestAction(@javax.annotation.Nonnull String requestAction) { + this.requestAction = requestAction; + } + + public Request requestId(@javax.annotation.Nonnull String requestId) { + this.requestId = requestId; + return this; + } + + /** + * Identifier (ID) representing a single API request. + * + * @return requestId + */ + @javax.annotation.Nonnull + public String getRequestId() { + return requestId; + } + + public void setRequestId(@javax.annotation.Nonnull String requestId) { + this.requestId = requestId; + } + + public Request requestType(@javax.annotation.Nonnull String requestType) { + this.requestType = requestType; + return this; + } + + /** + * Object that represents a resource type. Possible values: `BACKUP`, + * `IMAGE`, `NETWORK`, `NETWORKAREA`, `NIC`, + * `PROJECT`, `ROUTE`, `SERVER`, `SERVICEACCOUNT`, + * `SNAPSHOT`, `VIRTUALIP`, `VOLUME`. + * + * @return requestType + */ + @javax.annotation.Nonnull + public String getRequestType() { + return requestType; + } + + public void setRequestType(@javax.annotation.Nonnull String requestType) { + this.requestType = requestType; + } + + public Request resources(@javax.annotation.Nonnull List resources) { + this.resources = resources; + return this; + } + + public Request addResourcesItem(RequestResource resourcesItem) { + if (this.resources == null) { + this.resources = new ArrayList<>(); + } + this.resources.add(resourcesItem); + return this; + } + + /** + * Get resources + * + * @return resources + */ + @javax.annotation.Nonnull + public List getResources() { + return resources; + } + + public void setResources(@javax.annotation.Nonnull List resources) { + this.resources = resources; + } + + public Request status(@javax.annotation.Nonnull String status) { + this.status = status; + return this; + } + + /** + * The state of a resource object. Possible values: `CREATING`, `CREATED`, + * `DELETING`, `DELETED`, `FAILED`, `UPDATED`, + * `UPDATING`. + * + * @return status + */ + @javax.annotation.Nonnull + public String getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nonnull String status) { + this.status = status; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Request instance itself + */ + public Request 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; + } + Request request = (Request) o; + return Objects.equals(this.details, request.details) + && Objects.equals(this.requestAction, request.requestAction) + && Objects.equals(this.requestId, request.requestId) + && Objects.equals(this.requestType, request.requestType) + && Objects.equals(this.resources, request.resources) + && Objects.equals(this.status, request.status) + && Objects.equals(this.additionalProperties, request.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + details, + requestAction, + requestId, + requestType, + resources, + status, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Request {\n"); + sb.append(" details: ").append(toIndentedString(details)).append("\n"); + sb.append(" requestAction: ").append(toIndentedString(requestAction)).append("\n"); + sb.append(" requestId: ").append(toIndentedString(requestId)).append("\n"); + sb.append(" requestType: ").append(toIndentedString(requestType)).append("\n"); + sb.append(" resources: ").append(toIndentedString(resources)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = + new HashSet( + Arrays.asList( + "details", + "requestAction", + "requestId", + "requestType", + "resources", + "status")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = + new HashSet( + Arrays.asList( + "requestAction", + "requestId", + "requestType", + "resources", + "status")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Request + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Request.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 Request is not found in the empty JSON string", + Request.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Request.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("details") != null && !jsonObj.get("details").isJsonNull()) + && !jsonObj.get("details").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `details` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("details").toString())); + } + if (!jsonObj.get("requestAction").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `requestAction` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("requestAction").toString())); + } + if (!jsonObj.get("requestId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `requestId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("requestId").toString())); + } + if (!jsonObj.get("requestType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `requestType` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("requestType").toString())); + } + // ensure the json data is an array + if (!jsonObj.get("resources").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `resources` to be an array in the JSON string but got `%s`", + jsonObj.get("resources").toString())); + } + + JsonArray jsonArrayresources = jsonObj.getAsJsonArray("resources"); + // validate the required field `resources` (array) + for (int i = 0; i < jsonArrayresources.size(); i++) { + RequestResource.validateJsonElement(jsonArrayresources.get(i)); + } + ; + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `status` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("status").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Request.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Request' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(Request.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, Request 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 Request read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Request 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 Request given an JSON string + * + * @param jsonString JSON string + * @return An instance of Request + * @throws IOException if the JSON string is invalid with respect to Request + */ + public static Request fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Request.class); + } + + /** + * Convert an instance of Request to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/RequestResource.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/RequestResource.java new file mode 100644 index 00000000..b41135a5 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/RequestResource.java @@ -0,0 +1,381 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.v1api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +/** Object that represents a resource as part of a request. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class RequestResource { + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private UUID id; + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nonnull + private String status; + + public static final String SERIALIZED_NAME_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private String type; + + public RequestResource() {} + + public RequestResource id(@javax.annotation.Nonnull UUID id) { + this.id = id; + return this; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nonnull + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull UUID id) { + this.id = id; + } + + public RequestResource status(@javax.annotation.Nonnull String status) { + this.status = status; + return this; + } + + /** + * The state of a resource object. Possible values: `CREATING`, `CREATED`, + * `DELETING`, `DELETED`, `FAILED`, `UPDATED`, + * `UPDATING`. + * + * @return status + */ + @javax.annotation.Nonnull + public String getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nonnull String status) { + this.status = status; + } + + public RequestResource type(@javax.annotation.Nonnull String type) { + this.type = type; + return this; + } + + /** + * Object that represents a resource type. Possible values: `BACKUP`, + * `IMAGE`, `NETWORK`, `NETWORKAREA`, `NIC`, + * `PROJECT`, `ROUTE`, `SERVER`, `SERVICEACCOUNT`, + * `SNAPSHOT`, `VIRTUALIP`, `VOLUME`. + * + * @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 RequestResource instance itself + */ + public RequestResource 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; + } + RequestResource requestResource = (RequestResource) o; + return Objects.equals(this.id, requestResource.id) + && Objects.equals(this.status, requestResource.status) + && Objects.equals(this.type, requestResource.type) + && Objects.equals(this.additionalProperties, requestResource.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, status, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RequestResource {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).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("id", "status", "type")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("id", "status", "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 RequestResource + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RequestResource.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 RequestResource is not found in the empty JSON string", + RequestResource.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RequestResource.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("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `status` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("status").toString())); + } + 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 (!RequestResource.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RequestResource' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(RequestResource.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, RequestResource 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 RequestResource read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + RequestResource 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 RequestResource given an JSON string + * + * @param jsonString JSON string + * @return An instance of RequestResource + * @throws IOException if the JSON string is invalid with respect to RequestResource + */ + public static RequestResource fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RequestResource.class); + } + + /** + * Convert an instance of RequestResource to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/RescueServerPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/RescueServerPayload.java new file mode 100644 index 00000000..6f0c12c8 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/RescueServerPayload.java @@ -0,0 +1,309 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.v1api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +/** RescueServerPayload */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class RescueServerPayload { + public static final String SERIALIZED_NAME_IMAGE = "image"; + + @SerializedName(SERIALIZED_NAME_IMAGE) + @javax.annotation.Nonnull + private UUID image; + + public RescueServerPayload() {} + + public RescueServerPayload image(@javax.annotation.Nonnull UUID image) { + this.image = image; + return this; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return image + */ + @javax.annotation.Nonnull + public UUID getImage() { + return image; + } + + public void setImage(@javax.annotation.Nonnull UUID image) { + this.image = image; + } + + /** + * 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 RescueServerPayload instance itself + */ + public RescueServerPayload 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; + } + RescueServerPayload rescueServerPayload = (RescueServerPayload) o; + return Objects.equals(this.image, rescueServerPayload.image) + && Objects.equals( + this.additionalProperties, rescueServerPayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(image, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RescueServerPayload {\n"); + sb.append(" image: ").append(toIndentedString(image)).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("image")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("image")); + } + + /** + * 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 RescueServerPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RescueServerPayload.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 RescueServerPayload is not found in the empty JSON string", + RescueServerPayload.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RescueServerPayload.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("image").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `image` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("image").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RescueServerPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RescueServerPayload' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(RescueServerPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, RescueServerPayload 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 RescueServerPayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + RescueServerPayload 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 RescueServerPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of RescueServerPayload + * @throws IOException if the JSON string is invalid with respect to RescueServerPayload + */ + public static RescueServerPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RescueServerPayload.class); + } + + /** + * Convert an instance of RescueServerPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ResizeServerPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ResizeServerPayload.java new file mode 100644 index 00000000..4db2873a --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ResizeServerPayload.java @@ -0,0 +1,308 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** ResizeServerPayload */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class ResizeServerPayload { + public static final String SERIALIZED_NAME_MACHINE_TYPE = "machineType"; + + @SerializedName(SERIALIZED_NAME_MACHINE_TYPE) + @javax.annotation.Nonnull + private String machineType; + + public ResizeServerPayload() {} + + public ResizeServerPayload machineType(@javax.annotation.Nonnull String machineType) { + this.machineType = machineType; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return machineType + */ + @javax.annotation.Nonnull + public String getMachineType() { + return machineType; + } + + public void setMachineType(@javax.annotation.Nonnull String machineType) { + this.machineType = machineType; + } + + /** + * 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 ResizeServerPayload instance itself + */ + public ResizeServerPayload 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; + } + ResizeServerPayload resizeServerPayload = (ResizeServerPayload) o; + return Objects.equals(this.machineType, resizeServerPayload.machineType) + && Objects.equals( + this.additionalProperties, resizeServerPayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(machineType, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ResizeServerPayload {\n"); + sb.append(" machineType: ").append(toIndentedString(machineType)).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("machineType")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("machineType")); + } + + /** + * 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 ResizeServerPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ResizeServerPayload.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 ResizeServerPayload is not found in the empty JSON string", + ResizeServerPayload.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ResizeServerPayload.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("machineType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `machineType` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("machineType").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ResizeServerPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ResizeServerPayload' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ResizeServerPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ResizeServerPayload 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 ResizeServerPayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ResizeServerPayload 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 ResizeServerPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of ResizeServerPayload + * @throws IOException if the JSON string is invalid with respect to ResizeServerPayload + */ + public static ResizeServerPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ResizeServerPayload.class); + } + + /** + * Convert an instance of ResizeServerPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ResizeVolumePayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ResizeVolumePayload.java new file mode 100644 index 00000000..73c193dc --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ResizeVolumePayload.java @@ -0,0 +1,301 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** ResizeVolumePayload */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class ResizeVolumePayload { + public static final String SERIALIZED_NAME_SIZE = "size"; + + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nonnull + private Long size; + + public ResizeVolumePayload() {} + + public ResizeVolumePayload size(@javax.annotation.Nonnull Long size) { + this.size = size; + return this; + } + + /** + * Size in Gigabyte. + * + * @return size + */ + @javax.annotation.Nonnull + public Long getSize() { + return size; + } + + public void setSize(@javax.annotation.Nonnull Long size) { + this.size = size; + } + + /** + * 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 ResizeVolumePayload instance itself + */ + public ResizeVolumePayload 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; + } + ResizeVolumePayload resizeVolumePayload = (ResizeVolumePayload) o; + return Objects.equals(this.size, resizeVolumePayload.size) + && Objects.equals( + this.additionalProperties, resizeVolumePayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(size, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ResizeVolumePayload {\n"); + sb.append(" size: ").append(toIndentedString(size)).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("size")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("size")); + } + + /** + * 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 ResizeVolumePayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ResizeVolumePayload.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 ResizeVolumePayload is not found in the empty JSON string", + ResizeVolumePayload.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ResizeVolumePayload.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "The required field `%s` is not found in the JSON string: %s", + requiredField, + jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ResizeVolumePayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ResizeVolumePayload' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ResizeVolumePayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ResizeVolumePayload 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 ResizeVolumePayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ResizeVolumePayload 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 ResizeVolumePayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of ResizeVolumePayload + * @throws IOException if the JSON string is invalid with respect to ResizeVolumePayload + */ + public static ResizeVolumePayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ResizeVolumePayload.class); + } + + /** + * Convert an instance of ResizeVolumePayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/Route.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/Route.java new file mode 100644 index 00000000..8cf5f808 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/Route.java @@ -0,0 +1,443 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; +import java.util.UUID; + +/** Object represents a network route. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class Route { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NEXTHOP = "nexthop"; + + @SerializedName(SERIALIZED_NAME_NEXTHOP) + @javax.annotation.Nonnull + private String nexthop; + + public static final String SERIALIZED_NAME_PREFIX = "prefix"; + + @SerializedName(SERIALIZED_NAME_PREFIX) + @javax.annotation.Nonnull + private String prefix; + + public static final String SERIALIZED_NAME_ROUTE_ID = "routeId"; + + @SerializedName(SERIALIZED_NAME_ROUTE_ID) + @javax.annotation.Nullable private UUID routeId; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable private OffsetDateTime updatedAt; + + public Route() {} + + public Route(OffsetDateTime createdAt, UUID routeId, OffsetDateTime updatedAt) { + this(); + this.createdAt = createdAt; + this.routeId = routeId; + this.updatedAt = updatedAt; + } + + /** + * Date-time when resource was created. + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public Route labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public Route nexthop(@javax.annotation.Nonnull String nexthop) { + this.nexthop = nexthop; + return this; + } + + /** + * Object that represents an IP address. + * + * @return nexthop + */ + @javax.annotation.Nonnull + public String getNexthop() { + return nexthop; + } + + public void setNexthop(@javax.annotation.Nonnull String nexthop) { + this.nexthop = nexthop; + } + + public Route prefix(@javax.annotation.Nonnull String prefix) { + this.prefix = prefix; + return this; + } + + /** + * Classless Inter-Domain Routing (CIDR). + * + * @return prefix + */ + @javax.annotation.Nonnull + public String getPrefix() { + return prefix; + } + + public void setPrefix(@javax.annotation.Nonnull String prefix) { + this.prefix = prefix; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return routeId + */ + @javax.annotation.Nullable public UUID getRouteId() { + return routeId; + } + + /** + * Date-time when resource was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nullable public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * 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 Route instance itself + */ + public Route 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; + } + Route route = (Route) o; + return Objects.equals(this.createdAt, route.createdAt) + && Objects.equals(this.labels, route.labels) + && Objects.equals(this.nexthop, route.nexthop) + && Objects.equals(this.prefix, route.prefix) + && Objects.equals(this.routeId, route.routeId) + && Objects.equals(this.updatedAt, route.updatedAt) + && Objects.equals(this.additionalProperties, route.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + createdAt, labels, nexthop, prefix, routeId, updatedAt, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Route {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" nexthop: ").append(toIndentedString(nexthop)).append("\n"); + sb.append(" prefix: ").append(toIndentedString(prefix)).append("\n"); + sb.append(" routeId: ").append(toIndentedString(routeId)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).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( + "createdAt", + "labels", + "nexthop", + "prefix", + "routeId", + "updatedAt")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("nexthop", "prefix")); + } + + /** + * 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 Route + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Route.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 Route is not found in the empty JSON string", + Route.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Route.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("nexthop").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `nexthop` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("nexthop").toString())); + } + if (!jsonObj.get("prefix").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `prefix` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("prefix").toString())); + } + if ((jsonObj.get("routeId") != null && !jsonObj.get("routeId").isJsonNull()) + && !jsonObj.get("routeId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `routeId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("routeId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Route.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Route' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(Route.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, Route 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 Route read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Route 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 Route given an JSON string + * + * @param jsonString JSON string + * @return An instance of Route + * @throws IOException if the JSON string is invalid with respect to Route + */ + public static Route fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Route.class); + } + + /** + * Convert an instance of Route to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/RouteListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/RouteListResponse.java new file mode 100644 index 00000000..3b349d51 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/RouteListResponse.java @@ -0,0 +1,326 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** Route list response. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class RouteListResponse { + public static final String SERIALIZED_NAME_ITEMS = "items"; + + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public RouteListResponse() {} + + public RouteListResponse items(@javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public RouteListResponse addItemsItem(Route itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list of routes. + * + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the RouteListResponse instance itself + */ + public RouteListResponse 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; + } + RouteListResponse routeListResponse = (RouteListResponse) o; + return Objects.equals(this.items, routeListResponse.items) + && Objects.equals( + this.additionalProperties, routeListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RouteListResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("items")); + } + + /** + * 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 RouteListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RouteListResponse.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 RouteListResponse is not found in the empty JSON string", + RouteListResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RouteListResponse.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("items").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `items` to be an array in the JSON string but got `%s`", + jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + Route.validateJsonElement(jsonArrayitems.get(i)); + } + ; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RouteListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RouteListResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(RouteListResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, RouteListResponse 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 RouteListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + RouteListResponse 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 RouteListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of RouteListResponse + * @throws IOException if the JSON string is invalid with respect to RouteListResponse + */ + public static RouteListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RouteListResponse.class); + } + + /** + * Convert an instance of RouteListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/SecurityGroup.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/SecurityGroup.java new file mode 100644 index 00000000..97c539e9 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/SecurityGroup.java @@ -0,0 +1,519 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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.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; +import java.util.UUID; + +/** Object that represents a security group. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class SecurityGroup { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable private String description; + + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_RULES = "rules"; + + @SerializedName(SERIALIZED_NAME_RULES) + @javax.annotation.Nullable private List rules; + + public static final String SERIALIZED_NAME_STATEFUL = "stateful"; + + @SerializedName(SERIALIZED_NAME_STATEFUL) + @javax.annotation.Nullable private Boolean stateful = true; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable private OffsetDateTime updatedAt; + + public SecurityGroup() {} + + public SecurityGroup( + OffsetDateTime createdAt, + UUID id, + List rules, + OffsetDateTime updatedAt) { + this(); + this.createdAt = createdAt; + this.id = id; + this.rules = rules; + this.updatedAt = updatedAt; + } + + /** + * Date-time when resource was created. + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public SecurityGroup description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Description Object. Allows string up to 255 Characters. + * + * @return description + */ + @javax.annotation.Nullable public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + public SecurityGroup labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public SecurityGroup name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + /** + * A list containing security group rule objects. + * + * @return rules + */ + @javax.annotation.Nullable public List getRules() { + return rules; + } + + public SecurityGroup stateful(@javax.annotation.Nullable Boolean stateful) { + this.stateful = stateful; + return this; + } + + /** + * Shows if a security group is stateful or stateless. You can only have one type of security + * groups per network interface/server. + * + * @return stateful + */ + @javax.annotation.Nullable public Boolean getStateful() { + return stateful; + } + + public void setStateful(@javax.annotation.Nullable Boolean stateful) { + this.stateful = stateful; + } + + /** + * Date-time when resource was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nullable public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * 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 SecurityGroup instance itself + */ + public SecurityGroup 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; + } + SecurityGroup securityGroup = (SecurityGroup) o; + return Objects.equals(this.createdAt, securityGroup.createdAt) + && Objects.equals(this.description, securityGroup.description) + && Objects.equals(this.id, securityGroup.id) + && Objects.equals(this.labels, securityGroup.labels) + && Objects.equals(this.name, securityGroup.name) + && Objects.equals(this.rules, securityGroup.rules) + && Objects.equals(this.stateful, securityGroup.stateful) + && Objects.equals(this.updatedAt, securityGroup.updatedAt) + && Objects.equals(this.additionalProperties, securityGroup.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + createdAt, + description, + id, + labels, + name, + rules, + stateful, + updatedAt, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SecurityGroup {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" rules: ").append(toIndentedString(rules)).append("\n"); + sb.append(" stateful: ").append(toIndentedString(stateful)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).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( + "createdAt", + "description", + "id", + "labels", + "name", + "rules", + "stateful", + "updatedAt")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name")); + } + + /** + * 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 SecurityGroup + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SecurityGroup.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 SecurityGroup is not found in the empty JSON string", + SecurityGroup.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SecurityGroup.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("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `description` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("description").toString())); + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if (!jsonObj.get("name").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("rules") != null && !jsonObj.get("rules").isJsonNull()) { + JsonArray jsonArrayrules = jsonObj.getAsJsonArray("rules"); + if (jsonArrayrules != null) { + // ensure the json data is an array + if (!jsonObj.get("rules").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `rules` to be an array in the JSON string but got `%s`", + jsonObj.get("rules").toString())); + } + + // validate the optional field `rules` (array) + for (int i = 0; i < jsonArrayrules.size(); i++) { + SecurityGroupRule.validateJsonElement(jsonArrayrules.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SecurityGroup.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SecurityGroup' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(SecurityGroup.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, SecurityGroup 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 SecurityGroup read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SecurityGroup 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 SecurityGroup given an JSON string + * + * @param jsonString JSON string + * @return An instance of SecurityGroup + * @throws IOException if the JSON string is invalid with respect to SecurityGroup + */ + public static SecurityGroup fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SecurityGroup.class); + } + + /** + * Convert an instance of SecurityGroup to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/SecurityGroupListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/SecurityGroupListResponse.java new file mode 100644 index 00000000..2119ae13 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/SecurityGroupListResponse.java @@ -0,0 +1,327 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** Security group list response. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class SecurityGroupListResponse { + public static final String SERIALIZED_NAME_ITEMS = "items"; + + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public SecurityGroupListResponse() {} + + public SecurityGroupListResponse items(@javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public SecurityGroupListResponse addItemsItem(SecurityGroup itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list containing security group objects. + * + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SecurityGroupListResponse instance itself + */ + public SecurityGroupListResponse 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; + } + SecurityGroupListResponse securityGroupListResponse = (SecurityGroupListResponse) o; + return Objects.equals(this.items, securityGroupListResponse.items) + && Objects.equals( + this.additionalProperties, securityGroupListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SecurityGroupListResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("items")); + } + + /** + * 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 SecurityGroupListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SecurityGroupListResponse.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 SecurityGroupListResponse is not found in the empty JSON string", + SecurityGroupListResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SecurityGroupListResponse.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("items").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `items` to be an array in the JSON string but got `%s`", + jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + SecurityGroup.validateJsonElement(jsonArrayitems.get(i)); + } + ; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SecurityGroupListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SecurityGroupListResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(SecurityGroupListResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, SecurityGroupListResponse 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 SecurityGroupListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SecurityGroupListResponse 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 SecurityGroupListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of SecurityGroupListResponse + * @throws IOException if the JSON string is invalid with respect to SecurityGroupListResponse + */ + public static SecurityGroupListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SecurityGroupListResponse.class); + } + + /** + * Convert an instance of SecurityGroupListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/SecurityGroupRule.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/SecurityGroupRule.java new file mode 100644 index 00000000..363a303f --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/SecurityGroupRule.java @@ -0,0 +1,653 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; +import java.util.UUID; + +/** Object that represents a security group rule. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class SecurityGroupRule { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable private String description; + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + + @SerializedName(SERIALIZED_NAME_DIRECTION) + @javax.annotation.Nonnull + private String direction; + + public static final String SERIALIZED_NAME_ETHERTYPE = "ethertype"; + + @SerializedName(SERIALIZED_NAME_ETHERTYPE) + @javax.annotation.Nullable private String ethertype = "IPv4"; + + public static final String SERIALIZED_NAME_ICMP_PARAMETERS = "icmpParameters"; + + @SerializedName(SERIALIZED_NAME_ICMP_PARAMETERS) + @javax.annotation.Nullable private ICMPParameters icmpParameters; + + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_IP_RANGE = "ipRange"; + + @SerializedName(SERIALIZED_NAME_IP_RANGE) + @javax.annotation.Nullable private String ipRange; + + public static final String SERIALIZED_NAME_PORT_RANGE = "portRange"; + + @SerializedName(SERIALIZED_NAME_PORT_RANGE) + @javax.annotation.Nullable private PortRange portRange; + + public static final String SERIALIZED_NAME_REMOTE_SECURITY_GROUP_ID = "remoteSecurityGroupId"; + + @SerializedName(SERIALIZED_NAME_REMOTE_SECURITY_GROUP_ID) + @javax.annotation.Nullable private UUID remoteSecurityGroupId; + + public static final String SERIALIZED_NAME_SECURITY_GROUP_ID = "securityGroupId"; + + @SerializedName(SERIALIZED_NAME_SECURITY_GROUP_ID) + @javax.annotation.Nullable private UUID securityGroupId; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable private OffsetDateTime updatedAt; + + public static final String SERIALIZED_NAME_PROTOCOL = "protocol"; + + @SerializedName(SERIALIZED_NAME_PROTOCOL) + @javax.annotation.Nullable private Protocol protocol; + + public SecurityGroupRule() {} + + public SecurityGroupRule( + OffsetDateTime createdAt, UUID id, UUID securityGroupId, OffsetDateTime updatedAt) { + this(); + this.createdAt = createdAt; + this.id = id; + this.securityGroupId = securityGroupId; + this.updatedAt = updatedAt; + } + + /** + * Date-time when resource was created. + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public SecurityGroupRule description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Description Object. Allows string up to 255 Characters. + * + * @return description + */ + @javax.annotation.Nullable public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + public SecurityGroupRule direction(@javax.annotation.Nonnull String direction) { + this.direction = direction; + return this; + } + + /** + * The direction of the traffic which the rule should match. Possible values: + * `ingress`, `egress`. + * + * @return direction + */ + @javax.annotation.Nonnull + public String getDirection() { + return direction; + } + + public void setDirection(@javax.annotation.Nonnull String direction) { + this.direction = direction; + } + + public SecurityGroupRule ethertype(@javax.annotation.Nullable String ethertype) { + this.ethertype = ethertype; + return this; + } + + /** + * The ethertype which the rule should match. Possible values: `IPv4`, + * `IPv6`. + * + * @return ethertype + */ + @javax.annotation.Nullable public String getEthertype() { + return ethertype; + } + + public void setEthertype(@javax.annotation.Nullable String ethertype) { + this.ethertype = ethertype; + } + + public SecurityGroupRule icmpParameters( + @javax.annotation.Nullable ICMPParameters icmpParameters) { + this.icmpParameters = icmpParameters; + return this; + } + + /** + * Get icmpParameters + * + * @return icmpParameters + */ + @javax.annotation.Nullable public ICMPParameters getIcmpParameters() { + return icmpParameters; + } + + public void setIcmpParameters(@javax.annotation.Nullable ICMPParameters icmpParameters) { + this.icmpParameters = icmpParameters; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + public SecurityGroupRule ipRange(@javax.annotation.Nullable String ipRange) { + this.ipRange = ipRange; + return this; + } + + /** + * The remote IP range which the rule should match. + * + * @return ipRange + */ + @javax.annotation.Nullable public String getIpRange() { + return ipRange; + } + + public void setIpRange(@javax.annotation.Nullable String ipRange) { + this.ipRange = ipRange; + } + + public SecurityGroupRule portRange(@javax.annotation.Nullable PortRange portRange) { + this.portRange = portRange; + return this; + } + + /** + * Get portRange + * + * @return portRange + */ + @javax.annotation.Nullable public PortRange getPortRange() { + return portRange; + } + + public void setPortRange(@javax.annotation.Nullable PortRange portRange) { + this.portRange = portRange; + } + + public SecurityGroupRule remoteSecurityGroupId( + @javax.annotation.Nullable UUID remoteSecurityGroupId) { + this.remoteSecurityGroupId = remoteSecurityGroupId; + return this; + } + + /** + * The remote security group which the rule should match. + * + * @return remoteSecurityGroupId + */ + @javax.annotation.Nullable public UUID getRemoteSecurityGroupId() { + return remoteSecurityGroupId; + } + + public void setRemoteSecurityGroupId(@javax.annotation.Nullable UUID remoteSecurityGroupId) { + this.remoteSecurityGroupId = remoteSecurityGroupId; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return securityGroupId + */ + @javax.annotation.Nullable public UUID getSecurityGroupId() { + return securityGroupId; + } + + /** + * Date-time when resource was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nullable public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public SecurityGroupRule protocol(@javax.annotation.Nullable Protocol protocol) { + this.protocol = protocol; + return this; + } + + /** + * Get protocol + * + * @return protocol + */ + @javax.annotation.Nullable public Protocol getProtocol() { + return protocol; + } + + public void setProtocol(@javax.annotation.Nullable Protocol protocol) { + this.protocol = protocol; + } + + /** + * 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 SecurityGroupRule instance itself + */ + public SecurityGroupRule 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; + } + SecurityGroupRule securityGroupRule = (SecurityGroupRule) o; + return Objects.equals(this.createdAt, securityGroupRule.createdAt) + && Objects.equals(this.description, securityGroupRule.description) + && Objects.equals(this.direction, securityGroupRule.direction) + && Objects.equals(this.ethertype, securityGroupRule.ethertype) + && Objects.equals(this.icmpParameters, securityGroupRule.icmpParameters) + && Objects.equals(this.id, securityGroupRule.id) + && Objects.equals(this.ipRange, securityGroupRule.ipRange) + && Objects.equals(this.portRange, securityGroupRule.portRange) + && Objects.equals( + this.remoteSecurityGroupId, securityGroupRule.remoteSecurityGroupId) + && Objects.equals(this.securityGroupId, securityGroupRule.securityGroupId) + && Objects.equals(this.updatedAt, securityGroupRule.updatedAt) + && Objects.equals(this.protocol, securityGroupRule.protocol) + && Objects.equals( + this.additionalProperties, securityGroupRule.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + createdAt, + description, + direction, + ethertype, + icmpParameters, + id, + ipRange, + portRange, + remoteSecurityGroupId, + securityGroupId, + updatedAt, + protocol, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SecurityGroupRule {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" ethertype: ").append(toIndentedString(ethertype)).append("\n"); + sb.append(" icmpParameters: ").append(toIndentedString(icmpParameters)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" ipRange: ").append(toIndentedString(ipRange)).append("\n"); + sb.append(" portRange: ").append(toIndentedString(portRange)).append("\n"); + sb.append(" remoteSecurityGroupId: ") + .append(toIndentedString(remoteSecurityGroupId)) + .append("\n"); + sb.append(" securityGroupId: ").append(toIndentedString(securityGroupId)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" protocol: ").append(toIndentedString(protocol)).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( + "createdAt", + "description", + "direction", + "ethertype", + "icmpParameters", + "id", + "ipRange", + "portRange", + "remoteSecurityGroupId", + "securityGroupId", + "updatedAt", + "protocol")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("direction")); + } + + /** + * 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 SecurityGroupRule + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SecurityGroupRule.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 SecurityGroupRule is not found in the empty JSON string", + SecurityGroupRule.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SecurityGroupRule.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("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `description` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("description").toString())); + } + if (!jsonObj.get("direction").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `direction` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("direction").toString())); + } + if ((jsonObj.get("ethertype") != null && !jsonObj.get("ethertype").isJsonNull()) + && !jsonObj.get("ethertype").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `ethertype` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("ethertype").toString())); + } + // validate the optional field `icmpParameters` + if (jsonObj.get("icmpParameters") != null && !jsonObj.get("icmpParameters").isJsonNull()) { + ICMPParameters.validateJsonElement(jsonObj.get("icmpParameters")); + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if ((jsonObj.get("ipRange") != null && !jsonObj.get("ipRange").isJsonNull()) + && !jsonObj.get("ipRange").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `ipRange` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("ipRange").toString())); + } + // validate the optional field `portRange` + if (jsonObj.get("portRange") != null && !jsonObj.get("portRange").isJsonNull()) { + PortRange.validateJsonElement(jsonObj.get("portRange")); + } + if ((jsonObj.get("remoteSecurityGroupId") != null + && !jsonObj.get("remoteSecurityGroupId").isJsonNull()) + && !jsonObj.get("remoteSecurityGroupId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `remoteSecurityGroupId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("remoteSecurityGroupId").toString())); + } + if ((jsonObj.get("securityGroupId") != null && !jsonObj.get("securityGroupId").isJsonNull()) + && !jsonObj.get("securityGroupId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `securityGroupId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("securityGroupId").toString())); + } + // validate the optional field `protocol` + if (jsonObj.get("protocol") != null && !jsonObj.get("protocol").isJsonNull()) { + Protocol.validateJsonElement(jsonObj.get("protocol")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SecurityGroupRule.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SecurityGroupRule' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(SecurityGroupRule.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, SecurityGroupRule 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 SecurityGroupRule read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SecurityGroupRule 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 SecurityGroupRule given an JSON string + * + * @param jsonString JSON string + * @return An instance of SecurityGroupRule + * @throws IOException if the JSON string is invalid with respect to SecurityGroupRule + */ + public static SecurityGroupRule fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SecurityGroupRule.class); + } + + /** + * Convert an instance of SecurityGroupRule to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/SecurityGroupRuleListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/SecurityGroupRuleListResponse.java new file mode 100644 index 00000000..4e32278b --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/SecurityGroupRuleListResponse.java @@ -0,0 +1,335 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** Security group rule list response. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class SecurityGroupRuleListResponse { + public static final String SERIALIZED_NAME_ITEMS = "items"; + + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public SecurityGroupRuleListResponse() {} + + public SecurityGroupRuleListResponse items( + @javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public SecurityGroupRuleListResponse addItemsItem(SecurityGroupRule itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list containing security group rule objects. + * + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SecurityGroupRuleListResponse instance itself + */ + public SecurityGroupRuleListResponse 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; + } + SecurityGroupRuleListResponse securityGroupRuleListResponse = + (SecurityGroupRuleListResponse) o; + return Objects.equals(this.items, securityGroupRuleListResponse.items) + && Objects.equals( + this.additionalProperties, + securityGroupRuleListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SecurityGroupRuleListResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("items")); + } + + /** + * 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 + * SecurityGroupRuleListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SecurityGroupRuleListResponse.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 SecurityGroupRuleListResponse is not found in the empty JSON string", + SecurityGroupRuleListResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SecurityGroupRuleListResponse.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("items").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `items` to be an array in the JSON string but got `%s`", + jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + SecurityGroupRule.validateJsonElement(jsonArrayitems.get(i)); + } + ; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SecurityGroupRuleListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SecurityGroupRuleListResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(SecurityGroupRuleListResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, SecurityGroupRuleListResponse 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 SecurityGroupRuleListResponse read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SecurityGroupRuleListResponse 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 SecurityGroupRuleListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of SecurityGroupRuleListResponse + * @throws IOException if the JSON string is invalid with respect to + * SecurityGroupRuleListResponse + */ + public static SecurityGroupRuleListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SecurityGroupRuleListResponse.class); + } + + /** + * Convert an instance of SecurityGroupRuleListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/SecurityGroupRuleProtocol.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/SecurityGroupRuleProtocol.java new file mode 100644 index 00000000..bde10322 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/SecurityGroupRuleProtocol.java @@ -0,0 +1,292 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** The internet protocol which the rule matches. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class SecurityGroupRuleProtocol { + public static final String SERIALIZED_NAME_PROTOCOL = "protocol"; + + @SerializedName(SERIALIZED_NAME_PROTOCOL) + @javax.annotation.Nullable private Protocol protocol; + + public SecurityGroupRuleProtocol() {} + + public SecurityGroupRuleProtocol protocol(@javax.annotation.Nullable Protocol protocol) { + this.protocol = protocol; + return this; + } + + /** + * Get protocol + * + * @return protocol + */ + @javax.annotation.Nullable public Protocol getProtocol() { + return protocol; + } + + public void setProtocol(@javax.annotation.Nullable Protocol protocol) { + this.protocol = protocol; + } + + /** + * 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 SecurityGroupRuleProtocol instance itself + */ + public SecurityGroupRuleProtocol 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; + } + SecurityGroupRuleProtocol securityGroupRuleProtocol = (SecurityGroupRuleProtocol) o; + return Objects.equals(this.protocol, securityGroupRuleProtocol.protocol) + && Objects.equals( + this.additionalProperties, securityGroupRuleProtocol.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(protocol, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SecurityGroupRuleProtocol {\n"); + sb.append(" protocol: ").append(toIndentedString(protocol)).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("protocol")); + + // 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 SecurityGroupRuleProtocol + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SecurityGroupRuleProtocol.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 SecurityGroupRuleProtocol is not found in the empty JSON string", + SecurityGroupRuleProtocol.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `protocol` + if (jsonObj.get("protocol") != null && !jsonObj.get("protocol").isJsonNull()) { + Protocol.validateJsonElement(jsonObj.get("protocol")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SecurityGroupRuleProtocol.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SecurityGroupRuleProtocol' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(SecurityGroupRuleProtocol.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, SecurityGroupRuleProtocol 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 SecurityGroupRuleProtocol read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SecurityGroupRuleProtocol 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 SecurityGroupRuleProtocol given an JSON string + * + * @param jsonString JSON string + * @return An instance of SecurityGroupRuleProtocol + * @throws IOException if the JSON string is invalid with respect to SecurityGroupRuleProtocol + */ + public static SecurityGroupRuleProtocol fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SecurityGroupRuleProtocol.class); + } + + /** + * Convert an instance of SecurityGroupRuleProtocol to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/Server.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/Server.java new file mode 100644 index 00000000..04eddbad --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/Server.java @@ -0,0 +1,1091 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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.time.OffsetDateTime; +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; +import java.util.UUID; + +/** Representation of a single server object. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class Server { + public static final String SERIALIZED_NAME_AFFINITY_GROUP = "affinityGroup"; + + @SerializedName(SERIALIZED_NAME_AFFINITY_GROUP) + @javax.annotation.Nullable private UUID affinityGroup; + + public static final String SERIALIZED_NAME_AGENT = "agent"; + + @SerializedName(SERIALIZED_NAME_AGENT) + @javax.annotation.Nullable private ServerAgent agent; + + public static final String SERIALIZED_NAME_AVAILABILITY_ZONE = "availabilityZone"; + + @SerializedName(SERIALIZED_NAME_AVAILABILITY_ZONE) + @javax.annotation.Nullable private String availabilityZone; + + public static final String SERIALIZED_NAME_BOOT_VOLUME = "bootVolume"; + + @SerializedName(SERIALIZED_NAME_BOOT_VOLUME) + @javax.annotation.Nullable private BootVolume bootVolume; + + public static final String SERIALIZED_NAME_CONFIG_DRIVE = "configDrive"; + + @SerializedName(SERIALIZED_NAME_CONFIG_DRIVE) + @javax.annotation.Nullable private Boolean configDrive = false; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_ERROR_MESSAGE = "errorMessage"; + + @SerializedName(SERIALIZED_NAME_ERROR_MESSAGE) + @javax.annotation.Nullable private String errorMessage; + + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_IMAGE_ID = "imageId"; + + @SerializedName(SERIALIZED_NAME_IMAGE_ID) + @javax.annotation.Nullable private UUID imageId; + + public static final String SERIALIZED_NAME_KEYPAIR_NAME = "keypairName"; + + @SerializedName(SERIALIZED_NAME_KEYPAIR_NAME) + @javax.annotation.Nullable private String keypairName; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_LAUNCHED_AT = "launchedAt"; + + @SerializedName(SERIALIZED_NAME_LAUNCHED_AT) + @javax.annotation.Nullable private OffsetDateTime launchedAt; + + public static final String SERIALIZED_NAME_MACHINE_TYPE = "machineType"; + + @SerializedName(SERIALIZED_NAME_MACHINE_TYPE) + @javax.annotation.Nonnull + private String machineType; + + public static final String SERIALIZED_NAME_MAINTENANCE_WINDOW = "maintenanceWindow"; + + @SerializedName(SERIALIZED_NAME_MAINTENANCE_WINDOW) + @javax.annotation.Nullable private ServerMaintenance maintenanceWindow; + + public static final String SERIALIZED_NAME_METADATA = "metadata"; + + @SerializedName(SERIALIZED_NAME_METADATA) + @javax.annotation.Nullable private Object metadata; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_NETWORKING = "networking"; + + @SerializedName(SERIALIZED_NAME_NETWORKING) + @javax.annotation.Nullable private ServerNetworking networking; + + public static final String SERIALIZED_NAME_NICS = "nics"; + + @SerializedName(SERIALIZED_NAME_NICS) + @javax.annotation.Nullable private List nics; + + public static final String SERIALIZED_NAME_POWER_STATUS = "powerStatus"; + + @SerializedName(SERIALIZED_NAME_POWER_STATUS) + @javax.annotation.Nullable private String powerStatus; + + public static final String SERIALIZED_NAME_SECURITY_GROUPS = "securityGroups"; + + @SerializedName(SERIALIZED_NAME_SECURITY_GROUPS) + @javax.annotation.Nullable private List securityGroups; + + public static final String SERIALIZED_NAME_SERVICE_ACCOUNT_MAILS = "serviceAccountMails"; + + @SerializedName(SERIALIZED_NAME_SERVICE_ACCOUNT_MAILS) + @javax.annotation.Nullable private List serviceAccountMails; + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable private String status; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable private OffsetDateTime updatedAt; + + public static final String SERIALIZED_NAME_USER_DATA = "userData"; + + @SerializedName(SERIALIZED_NAME_USER_DATA) + @javax.annotation.Nullable private byte[] userData; + + public static final String SERIALIZED_NAME_VOLUMES = "volumes"; + + @SerializedName(SERIALIZED_NAME_VOLUMES) + @javax.annotation.Nullable private List volumes; + + public Server() {} + + public Server( + OffsetDateTime createdAt, + String errorMessage, + UUID id, + OffsetDateTime launchedAt, + ServerMaintenance maintenanceWindow, + List nics, + String powerStatus, + String status, + OffsetDateTime updatedAt) { + this(); + this.createdAt = createdAt; + this.errorMessage = errorMessage; + this.id = id; + this.launchedAt = launchedAt; + this.maintenanceWindow = maintenanceWindow; + this.nics = nics; + this.powerStatus = powerStatus; + this.status = status; + this.updatedAt = updatedAt; + } + + public Server affinityGroup(@javax.annotation.Nullable UUID affinityGroup) { + this.affinityGroup = affinityGroup; + return this; + } + + /** + * The affinity group the server is assigned to. + * + * @return affinityGroup + */ + @javax.annotation.Nullable public UUID getAffinityGroup() { + return affinityGroup; + } + + public void setAffinityGroup(@javax.annotation.Nullable UUID affinityGroup) { + this.affinityGroup = affinityGroup; + } + + public Server agent(@javax.annotation.Nullable ServerAgent agent) { + this.agent = agent; + return this; + } + + /** + * Get agent + * + * @return agent + */ + @javax.annotation.Nullable public ServerAgent getAgent() { + return agent; + } + + public void setAgent(@javax.annotation.Nullable ServerAgent agent) { + this.agent = agent; + } + + public Server availabilityZone(@javax.annotation.Nullable String availabilityZone) { + this.availabilityZone = availabilityZone; + return this; + } + + /** + * This is the availability zone requested during server creation. If none is provided during + * the creation request and an existing volume will be used as boot volume it will be set to the + * same availability zone as the volume. For requests with no volumes involved it will be set to + * the metro availability zone. + * + * @return availabilityZone + */ + @javax.annotation.Nullable public String getAvailabilityZone() { + return availabilityZone; + } + + public void setAvailabilityZone(@javax.annotation.Nullable String availabilityZone) { + this.availabilityZone = availabilityZone; + } + + public Server bootVolume(@javax.annotation.Nullable BootVolume bootVolume) { + this.bootVolume = bootVolume; + return this; + } + + /** + * Get bootVolume + * + * @return bootVolume + */ + @javax.annotation.Nullable public BootVolume getBootVolume() { + return bootVolume; + } + + public void setBootVolume(@javax.annotation.Nullable BootVolume bootVolume) { + this.bootVolume = bootVolume; + } + + public Server configDrive(@javax.annotation.Nullable Boolean configDrive) { + this.configDrive = configDrive; + return this; + } + + /** + * When true the server is created with a config drive. + * + * @return configDrive + */ + @javax.annotation.Nullable public Boolean getConfigDrive() { + return configDrive; + } + + public void setConfigDrive(@javax.annotation.Nullable Boolean configDrive) { + this.configDrive = configDrive; + } + + /** + * Date-time when resource was created. + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * An error message. + * + * @return errorMessage + */ + @javax.annotation.Nullable public String getErrorMessage() { + return errorMessage; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + public Server imageId(@javax.annotation.Nullable UUID imageId) { + this.imageId = imageId; + return this; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return imageId + */ + @javax.annotation.Nullable public UUID getImageId() { + return imageId; + } + + public void setImageId(@javax.annotation.Nullable UUID imageId) { + this.imageId = imageId; + } + + public Server keypairName(@javax.annotation.Nullable String keypairName) { + this.keypairName = keypairName; + return this; + } + + /** + * The SSH keypair used during the server creation. + * + * @return keypairName + */ + @javax.annotation.Nullable public String getKeypairName() { + return keypairName; + } + + public void setKeypairName(@javax.annotation.Nullable String keypairName) { + this.keypairName = keypairName; + } + + public Server labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + /** + * Date-time when resource was launched. + * + * @return launchedAt + */ + @javax.annotation.Nullable public OffsetDateTime getLaunchedAt() { + return launchedAt; + } + + public Server machineType(@javax.annotation.Nonnull String machineType) { + this.machineType = machineType; + return this; + } + + /** + * Name of the machine type the server shall belong to. + * + * @return machineType + */ + @javax.annotation.Nonnull + public String getMachineType() { + return machineType; + } + + public void setMachineType(@javax.annotation.Nonnull String machineType) { + this.machineType = machineType; + } + + /** + * Get maintenanceWindow + * + * @return maintenanceWindow + */ + @javax.annotation.Nullable public ServerMaintenance getMaintenanceWindow() { + return maintenanceWindow; + } + + public Server metadata(@javax.annotation.Nullable Object metadata) { + this.metadata = metadata; + return this; + } + + /** + * Object that represents the metadata of an object. Regex for keys: `^[a-zA-Z0-9-_:. + * ]{1,255}$`. Regex for values: `^.{0,255}$`. Providing a `null` value + * for a key will remove that key. + * + * @return metadata + */ + @javax.annotation.Nullable public Object getMetadata() { + return metadata; + } + + public void setMetadata(@javax.annotation.Nullable Object metadata) { + this.metadata = metadata; + } + + public Server name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * The name for a Server. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + public Server networking(@javax.annotation.Nullable ServerNetworking networking) { + this.networking = networking; + return this; + } + + /** + * Get networking + * + * @return networking + */ + @javax.annotation.Nullable public ServerNetworking getNetworking() { + return networking; + } + + public void setNetworking(@javax.annotation.Nullable ServerNetworking networking) { + this.networking = networking; + } + + /** + * The list of network interfaces (NICs) attached to the server. Only shown when detailed + * information is requested. + * + * @return nics + */ + @javax.annotation.Nullable public List getNics() { + return nics; + } + + /** + * The power status of a server. Possible values: `CRASHED`, `ERROR`, + * `RUNNING`, `STOPPED`. + * + * @return powerStatus + */ + @javax.annotation.Nullable public String getPowerStatus() { + return powerStatus; + } + + public Server securityGroups(@javax.annotation.Nullable List securityGroups) { + this.securityGroups = securityGroups; + return this; + } + + public Server addSecurityGroupsItem(String securityGroupsItem) { + if (this.securityGroups == null) { + this.securityGroups = new ArrayList<>(); + } + this.securityGroups.add(securityGroupsItem); + return this; + } + + /** + * The initial security groups for the server creation. + * + * @return securityGroups + */ + @javax.annotation.Nullable public List getSecurityGroups() { + return securityGroups; + } + + public void setSecurityGroups(@javax.annotation.Nullable List securityGroups) { + this.securityGroups = securityGroups; + } + + public Server serviceAccountMails(@javax.annotation.Nullable List serviceAccountMails) { + this.serviceAccountMails = serviceAccountMails; + return this; + } + + public Server addServiceAccountMailsItem(String serviceAccountMailsItem) { + if (this.serviceAccountMails == null) { + this.serviceAccountMails = new ArrayList<>(); + } + this.serviceAccountMails.add(serviceAccountMailsItem); + return this; + } + + /** + * A list of service account mails. Only shown when detailed information is requested. + * + * @return serviceAccountMails + */ + @javax.annotation.Nullable public List getServiceAccountMails() { + return serviceAccountMails; + } + + public void setServiceAccountMails( + @javax.annotation.Nullable List serviceAccountMails) { + this.serviceAccountMails = serviceAccountMails; + } + + /** + * The status of a server object. Possible values: `ACTIVE`, `BACKING-UP`, + * `CREATING`, `DEALLOCATED`, `DEALLOCATING`, `DELETED`, + * `DELETING`, `ERROR`, `INACTIVE`, `MIGRATING`, + * `PAUSED`, `REBOOT`, `REBOOTING`, `REBUILD`, + * `REBUILDING`, `RESCUE`, `RESCUING`, `RESIZING`, + * `RESTORING`, `SNAPSHOTTING`, `STARTING`, `STOPPING`, + * `UNRESCUING`, `UPDATING`. + * + * @return status + */ + @javax.annotation.Nullable public String getStatus() { + return status; + } + + /** + * Date-time when resource was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nullable public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public Server userData(@javax.annotation.Nullable byte[] userData) { + this.userData = userData; + return this; + } + + /** + * User Data that is provided to the server. Must be base64 encoded and is passed via cloud-init + * to the server. Only shown when detailed information is requested. + * + * @return userData + */ + @javax.annotation.Nullable public byte[] getUserData() { + return userData; + } + + public void setUserData(@javax.annotation.Nullable byte[] userData) { + this.userData = userData; + } + + public Server volumes(@javax.annotation.Nullable List volumes) { + this.volumes = volumes; + return this; + } + + public Server addVolumesItem(UUID volumesItem) { + if (this.volumes == null) { + this.volumes = new ArrayList<>(); + } + this.volumes.add(volumesItem); + return this; + } + + /** + * The list of volumes attached to the server. + * + * @return volumes + */ + @javax.annotation.Nullable public List getVolumes() { + return volumes; + } + + public void setVolumes(@javax.annotation.Nullable List volumes) { + this.volumes = volumes; + } + + /** + * 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 Server instance itself + */ + public Server 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; + } + Server server = (Server) o; + return Objects.equals(this.affinityGroup, server.affinityGroup) + && Objects.equals(this.agent, server.agent) + && Objects.equals(this.availabilityZone, server.availabilityZone) + && Objects.equals(this.bootVolume, server.bootVolume) + && Objects.equals(this.configDrive, server.configDrive) + && Objects.equals(this.createdAt, server.createdAt) + && Objects.equals(this.errorMessage, server.errorMessage) + && Objects.equals(this.id, server.id) + && Objects.equals(this.imageId, server.imageId) + && Objects.equals(this.keypairName, server.keypairName) + && Objects.equals(this.labels, server.labels) + && Objects.equals(this.launchedAt, server.launchedAt) + && Objects.equals(this.machineType, server.machineType) + && Objects.equals(this.maintenanceWindow, server.maintenanceWindow) + && Objects.equals(this.metadata, server.metadata) + && Objects.equals(this.name, server.name) + && Objects.equals(this.networking, server.networking) + && Objects.equals(this.nics, server.nics) + && Objects.equals(this.powerStatus, server.powerStatus) + && Objects.equals(this.securityGroups, server.securityGroups) + && Objects.equals(this.serviceAccountMails, server.serviceAccountMails) + && Objects.equals(this.status, server.status) + && Objects.equals(this.updatedAt, server.updatedAt) + && Arrays.equals(this.userData, server.userData) + && Objects.equals(this.volumes, server.volumes) + && Objects.equals(this.additionalProperties, server.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + affinityGroup, + agent, + availabilityZone, + bootVolume, + configDrive, + createdAt, + errorMessage, + id, + imageId, + keypairName, + labels, + launchedAt, + machineType, + maintenanceWindow, + metadata, + name, + networking, + nics, + powerStatus, + securityGroups, + serviceAccountMails, + status, + updatedAt, + Arrays.hashCode(userData), + volumes, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Server {\n"); + sb.append(" affinityGroup: ").append(toIndentedString(affinityGroup)).append("\n"); + sb.append(" agent: ").append(toIndentedString(agent)).append("\n"); + sb.append(" availabilityZone: ").append(toIndentedString(availabilityZone)).append("\n"); + sb.append(" bootVolume: ").append(toIndentedString(bootVolume)).append("\n"); + sb.append(" configDrive: ").append(toIndentedString(configDrive)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" errorMessage: ").append(toIndentedString(errorMessage)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" imageId: ").append(toIndentedString(imageId)).append("\n"); + sb.append(" keypairName: ").append(toIndentedString(keypairName)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" launchedAt: ").append(toIndentedString(launchedAt)).append("\n"); + sb.append(" machineType: ").append(toIndentedString(machineType)).append("\n"); + sb.append(" maintenanceWindow: ") + .append(toIndentedString(maintenanceWindow)) + .append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" networking: ").append(toIndentedString(networking)).append("\n"); + sb.append(" nics: ").append(toIndentedString(nics)).append("\n"); + sb.append(" powerStatus: ").append(toIndentedString(powerStatus)).append("\n"); + sb.append(" securityGroups: ").append(toIndentedString(securityGroups)).append("\n"); + sb.append(" serviceAccountMails: ") + .append(toIndentedString(serviceAccountMails)) + .append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" userData: ").append(toIndentedString(userData)).append("\n"); + sb.append(" volumes: ").append(toIndentedString(volumes)).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( + "affinityGroup", + "agent", + "availabilityZone", + "bootVolume", + "configDrive", + "createdAt", + "errorMessage", + "id", + "imageId", + "keypairName", + "labels", + "launchedAt", + "machineType", + "maintenanceWindow", + "metadata", + "name", + "networking", + "nics", + "powerStatus", + "securityGroups", + "serviceAccountMails", + "status", + "updatedAt", + "userData", + "volumes")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("machineType", "name")); + } + + /** + * 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 Server + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Server.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 Server is not found in the empty JSON string", + Server.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Server.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("affinityGroup") != null && !jsonObj.get("affinityGroup").isJsonNull()) + && !jsonObj.get("affinityGroup").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `affinityGroup` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("affinityGroup").toString())); + } + // validate the optional field `agent` + if (jsonObj.get("agent") != null && !jsonObj.get("agent").isJsonNull()) { + ServerAgent.validateJsonElement(jsonObj.get("agent")); + } + if ((jsonObj.get("availabilityZone") != null + && !jsonObj.get("availabilityZone").isJsonNull()) + && !jsonObj.get("availabilityZone").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `availabilityZone` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("availabilityZone").toString())); + } + // validate the optional field `bootVolume` + if (jsonObj.get("bootVolume") != null && !jsonObj.get("bootVolume").isJsonNull()) { + BootVolume.validateJsonElement(jsonObj.get("bootVolume")); + } + if ((jsonObj.get("errorMessage") != null && !jsonObj.get("errorMessage").isJsonNull()) + && !jsonObj.get("errorMessage").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `errorMessage` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("errorMessage").toString())); + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if ((jsonObj.get("imageId") != null && !jsonObj.get("imageId").isJsonNull()) + && !jsonObj.get("imageId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `imageId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("imageId").toString())); + } + if ((jsonObj.get("keypairName") != null && !jsonObj.get("keypairName").isJsonNull()) + && !jsonObj.get("keypairName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `keypairName` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("keypairName").toString())); + } + if (!jsonObj.get("machineType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `machineType` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("machineType").toString())); + } + // validate the optional field `maintenanceWindow` + if (jsonObj.get("maintenanceWindow") != null + && !jsonObj.get("maintenanceWindow").isJsonNull()) { + ServerMaintenance.validateJsonElement(jsonObj.get("maintenanceWindow")); + } + 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())); + } + // validate the optional field `networking` + if (jsonObj.get("networking") != null && !jsonObj.get("networking").isJsonNull()) { + ServerNetworking.validateJsonElement(jsonObj.get("networking")); + } + if (jsonObj.get("nics") != null && !jsonObj.get("nics").isJsonNull()) { + JsonArray jsonArraynics = jsonObj.getAsJsonArray("nics"); + if (jsonArraynics != null) { + // ensure the json data is an array + if (!jsonObj.get("nics").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `nics` to be an array in the JSON string but got `%s`", + jsonObj.get("nics").toString())); + } + + // validate the optional field `nics` (array) + for (int i = 0; i < jsonArraynics.size(); i++) { + ServerNetwork.validateJsonElement(jsonArraynics.get(i)); + } + ; + } + } + if ((jsonObj.get("powerStatus") != null && !jsonObj.get("powerStatus").isJsonNull()) + && !jsonObj.get("powerStatus").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `powerStatus` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("powerStatus").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("securityGroups") != null + && !jsonObj.get("securityGroups").isJsonNull() + && !jsonObj.get("securityGroups").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `securityGroups` to be an array in the JSON string but got `%s`", + jsonObj.get("securityGroups").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("serviceAccountMails") != null + && !jsonObj.get("serviceAccountMails").isJsonNull() + && !jsonObj.get("serviceAccountMails").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `serviceAccountMails` to be an array in the JSON string but got `%s`", + jsonObj.get("serviceAccountMails").toString())); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) + && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `status` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("status").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("volumes") != null + && !jsonObj.get("volumes").isJsonNull() + && !jsonObj.get("volumes").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `volumes` to be an array in the JSON string but got `%s`", + jsonObj.get("volumes").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Server.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Server' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(Server.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, Server 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 Server read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Server 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 Server given an JSON string + * + * @param jsonString JSON string + * @return An instance of Server + * @throws IOException if the JSON string is invalid with respect to Server + */ + public static Server fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Server.class); + } + + /** + * Convert an instance of Server to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ServerAgent.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ServerAgent.java new file mode 100644 index 00000000..86f4b3bd --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ServerAgent.java @@ -0,0 +1,288 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** STACKIT server agent options for a server. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class ServerAgent { + public static final String SERIALIZED_NAME_PROVISIONED = "provisioned"; + + @SerializedName(SERIALIZED_NAME_PROVISIONED) + @javax.annotation.Nullable private Boolean provisioned; + + public ServerAgent() {} + + public ServerAgent provisioned(@javax.annotation.Nullable Boolean provisioned) { + this.provisioned = provisioned; + return this; + } + + /** + * Configure the STACKIT server agent provisioning during the first boot of the server. Only + * works when booting from an images that supports the STACKIT server agent. When + * `false` the agent IS NOT installed. When `true` the agent IS installed. + * When its not set the result depend on the used image and its default provisioning setting. + * + * @return provisioned + */ + @javax.annotation.Nullable public Boolean getProvisioned() { + return provisioned; + } + + public void setProvisioned(@javax.annotation.Nullable Boolean provisioned) { + this.provisioned = provisioned; + } + + /** + * 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 ServerAgent instance itself + */ + public ServerAgent 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; + } + ServerAgent serverAgent = (ServerAgent) o; + return Objects.equals(this.provisioned, serverAgent.provisioned) + && Objects.equals(this.additionalProperties, serverAgent.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(provisioned, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ServerAgent {\n"); + sb.append(" provisioned: ").append(toIndentedString(provisioned)).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("provisioned")); + + // 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 ServerAgent + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ServerAgent.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 ServerAgent is not found in the empty JSON string", + ServerAgent.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ServerAgent.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ServerAgent' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ServerAgent.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ServerAgent 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 ServerAgent read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ServerAgent 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 ServerAgent given an JSON string + * + * @param jsonString JSON string + * @return An instance of ServerAgent + * @throws IOException if the JSON string is invalid with respect to ServerAgent + */ + public static ServerAgent fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ServerAgent.class); + } + + /** + * Convert an instance of ServerAgent to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ServerConsoleUrl.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ServerConsoleUrl.java new file mode 100644 index 00000000..e2c9f510 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ServerConsoleUrl.java @@ -0,0 +1,307 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** Object that represents a server console URL. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class ServerConsoleUrl { + public static final String SERIALIZED_NAME_URL = "url"; + + @SerializedName(SERIALIZED_NAME_URL) + @javax.annotation.Nonnull + private String url; + + public ServerConsoleUrl() {} + + public ServerConsoleUrl url(@javax.annotation.Nonnull String url) { + this.url = url; + return this; + } + + /** + * Get url + * + * @return url + */ + @javax.annotation.Nonnull + public String getUrl() { + return url; + } + + public void setUrl(@javax.annotation.Nonnull String url) { + this.url = url; + } + + /** + * 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 ServerConsoleUrl instance itself + */ + public ServerConsoleUrl 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; + } + ServerConsoleUrl serverConsoleUrl = (ServerConsoleUrl) o; + return Objects.equals(this.url, serverConsoleUrl.url) + && Objects.equals(this.additionalProperties, serverConsoleUrl.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(url, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ServerConsoleUrl {\n"); + sb.append(" url: ").append(toIndentedString(url)).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("url")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("url")); + } + + /** + * 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 ServerConsoleUrl + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ServerConsoleUrl.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 ServerConsoleUrl is not found in the empty JSON string", + ServerConsoleUrl.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ServerConsoleUrl.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("url").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `url` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("url").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ServerConsoleUrl.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ServerConsoleUrl' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ServerConsoleUrl.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ServerConsoleUrl 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 ServerConsoleUrl read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ServerConsoleUrl 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 ServerConsoleUrl given an JSON string + * + * @param jsonString JSON string + * @return An instance of ServerConsoleUrl + * @throws IOException if the JSON string is invalid with respect to ServerConsoleUrl + */ + public static ServerConsoleUrl fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ServerConsoleUrl.class); + } + + /** + * Convert an instance of ServerConsoleUrl to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ServerListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ServerListResponse.java new file mode 100644 index 00000000..25006394 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ServerListResponse.java @@ -0,0 +1,326 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** Response object for server list request. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class ServerListResponse { + public static final String SERIALIZED_NAME_ITEMS = "items"; + + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public ServerListResponse() {} + + public ServerListResponse items(@javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public ServerListResponse addItemsItem(Server itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list of servers. + * + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ServerListResponse instance itself + */ + public ServerListResponse 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; + } + ServerListResponse serverListResponse = (ServerListResponse) o; + return Objects.equals(this.items, serverListResponse.items) + && Objects.equals( + this.additionalProperties, serverListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ServerListResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("items")); + } + + /** + * 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 ServerListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ServerListResponse.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 ServerListResponse is not found in the empty JSON string", + ServerListResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ServerListResponse.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("items").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `items` to be an array in the JSON string but got `%s`", + jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + Server.validateJsonElement(jsonArrayitems.get(i)); + } + ; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ServerListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ServerListResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ServerListResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ServerListResponse 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 ServerListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ServerListResponse 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 ServerListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ServerListResponse + * @throws IOException if the JSON string is invalid with respect to ServerListResponse + */ + public static ServerListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ServerListResponse.class); + } + + /** + * Convert an instance of ServerListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ServerMaintenance.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ServerMaintenance.java new file mode 100644 index 00000000..8bba7179 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ServerMaintenance.java @@ -0,0 +1,397 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** Object that represents the information about the next planned server maintenance window. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class ServerMaintenance { + public static final String SERIALIZED_NAME_DETAILS = "details"; + + @SerializedName(SERIALIZED_NAME_DETAILS) + @javax.annotation.Nullable private String details; + + public static final String SERIALIZED_NAME_ENDS_AT = "endsAt"; + + @SerializedName(SERIALIZED_NAME_ENDS_AT) + @javax.annotation.Nonnull + private OffsetDateTime endsAt; + + public static final String SERIALIZED_NAME_STARTS_AT = "startsAt"; + + @SerializedName(SERIALIZED_NAME_STARTS_AT) + @javax.annotation.Nonnull + private OffsetDateTime startsAt; + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nonnull + private String status; + + public ServerMaintenance() {} + + public ServerMaintenance details(@javax.annotation.Nullable String details) { + this.details = details; + return this; + } + + /** + * Get details + * + * @return details + */ + @javax.annotation.Nullable public String getDetails() { + return details; + } + + public void setDetails(@javax.annotation.Nullable String details) { + this.details = details; + } + + public ServerMaintenance endsAt(@javax.annotation.Nonnull OffsetDateTime endsAt) { + this.endsAt = endsAt; + return this; + } + + /** + * End of the maintenance window. + * + * @return endsAt + */ + @javax.annotation.Nonnull + public OffsetDateTime getEndsAt() { + return endsAt; + } + + public void setEndsAt(@javax.annotation.Nonnull OffsetDateTime endsAt) { + this.endsAt = endsAt; + } + + public ServerMaintenance startsAt(@javax.annotation.Nonnull OffsetDateTime startsAt) { + this.startsAt = startsAt; + return this; + } + + /** + * Start of the maintenance window. + * + * @return startsAt + */ + @javax.annotation.Nonnull + public OffsetDateTime getStartsAt() { + return startsAt; + } + + public void setStartsAt(@javax.annotation.Nonnull OffsetDateTime startsAt) { + this.startsAt = startsAt; + } + + public ServerMaintenance status(@javax.annotation.Nonnull String status) { + this.status = status; + return this; + } + + /** + * Possible values: `PLANNED`, `ONGOING`. + * + * @return status + */ + @javax.annotation.Nonnull + public String getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nonnull String status) { + this.status = status; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ServerMaintenance instance itself + */ + public ServerMaintenance 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; + } + ServerMaintenance serverMaintenance = (ServerMaintenance) o; + return Objects.equals(this.details, serverMaintenance.details) + && Objects.equals(this.endsAt, serverMaintenance.endsAt) + && Objects.equals(this.startsAt, serverMaintenance.startsAt) + && Objects.equals(this.status, serverMaintenance.status) + && Objects.equals( + this.additionalProperties, serverMaintenance.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(details, endsAt, startsAt, status, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ServerMaintenance {\n"); + sb.append(" details: ").append(toIndentedString(details)).append("\n"); + sb.append(" endsAt: ").append(toIndentedString(endsAt)).append("\n"); + sb.append(" startsAt: ").append(toIndentedString(startsAt)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = + new HashSet(Arrays.asList("details", "endsAt", "startsAt", "status")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("endsAt", "startsAt", "status")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ServerMaintenance + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ServerMaintenance.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 ServerMaintenance is not found in the empty JSON string", + ServerMaintenance.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ServerMaintenance.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("details") != null && !jsonObj.get("details").isJsonNull()) + && !jsonObj.get("details").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `details` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("details").toString())); + } + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `status` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("status").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ServerMaintenance.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ServerMaintenance' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ServerMaintenance.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ServerMaintenance 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 ServerMaintenance read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ServerMaintenance 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 ServerMaintenance given an JSON string + * + * @param jsonString JSON string + * @return An instance of ServerMaintenance + * @throws IOException if the JSON string is invalid with respect to ServerMaintenance + */ + public static ServerMaintenance fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ServerMaintenance.class); + } + + /** + * Convert an instance of ServerMaintenance to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ServerNetwork.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ServerNetwork.java new file mode 100644 index 00000000..fb0567da --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ServerNetwork.java @@ -0,0 +1,660 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; +import java.util.UUID; + +/** Describes the object that matches servers to its networks. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class ServerNetwork { + public static final String SERIALIZED_NAME_ALLOWED_ADDRESSES = "allowedAddresses"; + + @SerializedName(SERIALIZED_NAME_ALLOWED_ADDRESSES) + @javax.annotation.Nullable private List allowedAddresses = new ArrayList<>(); + + public static final String SERIALIZED_NAME_IPV4 = "ipv4"; + + @SerializedName(SERIALIZED_NAME_IPV4) + @javax.annotation.Nullable private String ipv4; + + public static final String SERIALIZED_NAME_IPV6 = "ipv6"; + + @SerializedName(SERIALIZED_NAME_IPV6) + @javax.annotation.Nullable private String ipv6; + + public static final String SERIALIZED_NAME_MAC = "mac"; + + @SerializedName(SERIALIZED_NAME_MAC) + @javax.annotation.Nonnull + private String mac; + + public static final String SERIALIZED_NAME_NETWORK_ID = "networkId"; + + @SerializedName(SERIALIZED_NAME_NETWORK_ID) + @javax.annotation.Nonnull + private UUID networkId; + + public static final String SERIALIZED_NAME_NETWORK_NAME = "networkName"; + + @SerializedName(SERIALIZED_NAME_NETWORK_NAME) + @javax.annotation.Nonnull + private String networkName; + + public static final String SERIALIZED_NAME_NIC_ID = "nicId"; + + @SerializedName(SERIALIZED_NAME_NIC_ID) + @javax.annotation.Nonnull + private UUID nicId; + + public static final String SERIALIZED_NAME_NIC_SECURITY = "nicSecurity"; + + @SerializedName(SERIALIZED_NAME_NIC_SECURITY) + @javax.annotation.Nonnull + private Boolean nicSecurity; + + public static final String SERIALIZED_NAME_PUBLIC_IP = "publicIp"; + + @SerializedName(SERIALIZED_NAME_PUBLIC_IP) + @javax.annotation.Nullable private String publicIp; + + public static final String SERIALIZED_NAME_SECURITY_GROUPS = "securityGroups"; + + @SerializedName(SERIALIZED_NAME_SECURITY_GROUPS) + @javax.annotation.Nullable private List securityGroups = new ArrayList<>(); + + public ServerNetwork() {} + + public ServerNetwork allowedAddresses( + @javax.annotation.Nullable List allowedAddresses) { + this.allowedAddresses = allowedAddresses; + return this; + } + + public ServerNetwork addAllowedAddressesItem(AllowedAddressesInner allowedAddressesItem) { + if (this.allowedAddresses == null) { + this.allowedAddresses = new ArrayList<>(); + } + this.allowedAddresses.add(allowedAddressesItem); + return this; + } + + /** + * A list of IPs or CIDR notations. + * + * @return allowedAddresses + */ + @javax.annotation.Nullable public List getAllowedAddresses() { + return allowedAddresses; + } + + public void setAllowedAddresses( + @javax.annotation.Nullable List allowedAddresses) { + this.allowedAddresses = allowedAddresses; + } + + public ServerNetwork ipv4(@javax.annotation.Nullable String ipv4) { + this.ipv4 = ipv4; + return this; + } + + /** + * Object that represents an IP address. + * + * @return ipv4 + */ + @javax.annotation.Nullable public String getIpv4() { + return ipv4; + } + + public void setIpv4(@javax.annotation.Nullable String ipv4) { + this.ipv4 = ipv4; + } + + public ServerNetwork ipv6(@javax.annotation.Nullable String ipv6) { + this.ipv6 = ipv6; + return this; + } + + /** + * String that represents an IPv6 address. + * + * @return ipv6 + */ + @javax.annotation.Nullable public String getIpv6() { + return ipv6; + } + + public void setIpv6(@javax.annotation.Nullable String ipv6) { + this.ipv6 = ipv6; + } + + public ServerNetwork mac(@javax.annotation.Nonnull String mac) { + this.mac = mac; + return this; + } + + /** + * Object that represents an MAC address. + * + * @return mac + */ + @javax.annotation.Nonnull + public String getMac() { + return mac; + } + + public void setMac(@javax.annotation.Nonnull String mac) { + this.mac = mac; + } + + public ServerNetwork networkId(@javax.annotation.Nonnull UUID networkId) { + this.networkId = networkId; + return this; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return networkId + */ + @javax.annotation.Nonnull + public UUID getNetworkId() { + return networkId; + } + + public void setNetworkId(@javax.annotation.Nonnull UUID networkId) { + this.networkId = networkId; + } + + public ServerNetwork networkName(@javax.annotation.Nonnull String networkName) { + this.networkName = networkName; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return networkName + */ + @javax.annotation.Nonnull + public String getNetworkName() { + return networkName; + } + + public void setNetworkName(@javax.annotation.Nonnull String networkName) { + this.networkName = networkName; + } + + public ServerNetwork nicId(@javax.annotation.Nonnull UUID nicId) { + this.nicId = nicId; + return this; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return nicId + */ + @javax.annotation.Nonnull + public UUID getNicId() { + return nicId; + } + + public void setNicId(@javax.annotation.Nonnull UUID nicId) { + this.nicId = nicId; + } + + public ServerNetwork nicSecurity(@javax.annotation.Nonnull Boolean nicSecurity) { + this.nicSecurity = nicSecurity; + return this; + } + + /** + * If this is set to false, then no security groups will apply to this server network interface. + * + * @return nicSecurity + */ + @javax.annotation.Nonnull + public Boolean getNicSecurity() { + return nicSecurity; + } + + public void setNicSecurity(@javax.annotation.Nonnull Boolean nicSecurity) { + this.nicSecurity = nicSecurity; + } + + public ServerNetwork publicIp(@javax.annotation.Nullable String publicIp) { + this.publicIp = publicIp; + return this; + } + + /** + * Object that represents an IP address. + * + * @return publicIp + */ + @javax.annotation.Nullable public String getPublicIp() { + return publicIp; + } + + public void setPublicIp(@javax.annotation.Nullable String publicIp) { + this.publicIp = publicIp; + } + + public ServerNetwork securityGroups(@javax.annotation.Nullable List securityGroups) { + this.securityGroups = securityGroups; + return this; + } + + public ServerNetwork addSecurityGroupsItem(UUID securityGroupsItem) { + if (this.securityGroups == null) { + this.securityGroups = new ArrayList<>(); + } + this.securityGroups.add(securityGroupsItem); + return this; + } + + /** + * A list of UUIDs. + * + * @return securityGroups + */ + @javax.annotation.Nullable public List getSecurityGroups() { + return securityGroups; + } + + public void setSecurityGroups(@javax.annotation.Nullable List securityGroups) { + this.securityGroups = securityGroups; + } + + /** + * 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 ServerNetwork instance itself + */ + public ServerNetwork 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; + } + ServerNetwork serverNetwork = (ServerNetwork) o; + return Objects.equals(this.allowedAddresses, serverNetwork.allowedAddresses) + && Objects.equals(this.ipv4, serverNetwork.ipv4) + && Objects.equals(this.ipv6, serverNetwork.ipv6) + && Objects.equals(this.mac, serverNetwork.mac) + && Objects.equals(this.networkId, serverNetwork.networkId) + && Objects.equals(this.networkName, serverNetwork.networkName) + && Objects.equals(this.nicId, serverNetwork.nicId) + && Objects.equals(this.nicSecurity, serverNetwork.nicSecurity) + && Objects.equals(this.publicIp, serverNetwork.publicIp) + && Objects.equals(this.securityGroups, serverNetwork.securityGroups) + && Objects.equals(this.additionalProperties, serverNetwork.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + allowedAddresses, + ipv4, + ipv6, + mac, + networkId, + networkName, + nicId, + nicSecurity, + publicIp, + securityGroups, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ServerNetwork {\n"); + sb.append(" allowedAddresses: ").append(toIndentedString(allowedAddresses)).append("\n"); + sb.append(" ipv4: ").append(toIndentedString(ipv4)).append("\n"); + sb.append(" ipv6: ").append(toIndentedString(ipv6)).append("\n"); + sb.append(" mac: ").append(toIndentedString(mac)).append("\n"); + sb.append(" networkId: ").append(toIndentedString(networkId)).append("\n"); + sb.append(" networkName: ").append(toIndentedString(networkName)).append("\n"); + sb.append(" nicId: ").append(toIndentedString(nicId)).append("\n"); + sb.append(" nicSecurity: ").append(toIndentedString(nicSecurity)).append("\n"); + sb.append(" publicIp: ").append(toIndentedString(publicIp)).append("\n"); + sb.append(" securityGroups: ").append(toIndentedString(securityGroups)).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( + "allowedAddresses", + "ipv4", + "ipv6", + "mac", + "networkId", + "networkName", + "nicId", + "nicSecurity", + "publicIp", + "securityGroups")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = + new HashSet( + Arrays.asList("mac", "networkId", "networkName", "nicId", "nicSecurity")); + } + + /** + * 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 ServerNetwork + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ServerNetwork.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 ServerNetwork is not found in the empty JSON string", + ServerNetwork.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ServerNetwork.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("allowedAddresses") != null + && !jsonObj.get("allowedAddresses").isJsonNull()) { + JsonArray jsonArrayallowedAddresses = jsonObj.getAsJsonArray("allowedAddresses"); + if (jsonArrayallowedAddresses != null) { + // ensure the json data is an array + if (!jsonObj.get("allowedAddresses").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `allowedAddresses` to be an array in the JSON string but got `%s`", + jsonObj.get("allowedAddresses").toString())); + } + + // validate the optional field `allowedAddresses` (array) + for (int i = 0; i < jsonArrayallowedAddresses.size(); i++) { + AllowedAddressesInner.validateJsonElement(jsonArrayallowedAddresses.get(i)); + } + ; + } + } + if ((jsonObj.get("ipv4") != null && !jsonObj.get("ipv4").isJsonNull()) + && !jsonObj.get("ipv4").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `ipv4` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("ipv4").toString())); + } + if ((jsonObj.get("ipv6") != null && !jsonObj.get("ipv6").isJsonNull()) + && !jsonObj.get("ipv6").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `ipv6` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("ipv6").toString())); + } + if (!jsonObj.get("mac").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `mac` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("mac").toString())); + } + if (!jsonObj.get("networkId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `networkId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("networkId").toString())); + } + if (!jsonObj.get("networkName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `networkName` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("networkName").toString())); + } + if (!jsonObj.get("nicId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `nicId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("nicId").toString())); + } + if ((jsonObj.get("publicIp") != null && !jsonObj.get("publicIp").isJsonNull()) + && !jsonObj.get("publicIp").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `publicIp` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("publicIp").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("securityGroups") != null + && !jsonObj.get("securityGroups").isJsonNull() + && !jsonObj.get("securityGroups").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `securityGroups` to be an array in the JSON string but got `%s`", + jsonObj.get("securityGroups").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ServerNetwork.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ServerNetwork' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ServerNetwork.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ServerNetwork 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 ServerNetwork read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ServerNetwork 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 ServerNetwork given an JSON string + * + * @param jsonString JSON string + * @return An instance of ServerNetwork + * @throws IOException if the JSON string is invalid with respect to ServerNetwork + */ + public static ServerNetwork fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ServerNetwork.class); + } + + /** + * Convert an instance of ServerNetwork to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ServerNetworking.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ServerNetworking.java new file mode 100644 index 00000000..b7cc938a --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ServerNetworking.java @@ -0,0 +1,297 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.v1api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +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 ServerNetworking extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(ServerNetworking.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ServerNetworking.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ServerNetworking' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterCreateServerNetworking = + gson.getDelegateAdapter(this, TypeToken.get(CreateServerNetworking.class)); + final TypeAdapter + adapterCreateServerNetworkingWithNics = + gson.getDelegateAdapter( + this, TypeToken.get(CreateServerNetworkingWithNics.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ServerNetworking value) + throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `CreateServerNetworking` + if (value.getActualInstance() instanceof CreateServerNetworking) { + JsonElement element = + adapterCreateServerNetworking.toJsonTree( + (CreateServerNetworking) value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type + // `CreateServerNetworkingWithNics` + if (value.getActualInstance() + instanceof CreateServerNetworkingWithNics) { + JsonElement element = + adapterCreateServerNetworkingWithNics.toJsonTree( + (CreateServerNetworkingWithNics) + value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException( + "Failed to serialize as the type doesn't match oneOf schemas: CreateServerNetworking, CreateServerNetworkingWithNics"); + } + + @Override + public ServerNetworking read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize CreateServerNetworking + try { + // validate the JSON object to see if any exception is thrown + CreateServerNetworking.validateJsonElement(jsonElement); + actualAdapter = adapterCreateServerNetworking; + match++; + log.log( + Level.FINER, + "Input data matches schema 'CreateServerNetworking'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for CreateServerNetworking failed with `%s`.", + e.getMessage())); + log.log( + Level.FINER, + "Input data does not match schema 'CreateServerNetworking'", + e); + } + // deserialize CreateServerNetworkingWithNics + try { + // validate the JSON object to see if any exception is thrown + CreateServerNetworkingWithNics.validateJsonElement(jsonElement); + actualAdapter = adapterCreateServerNetworkingWithNics; + match++; + log.log( + Level.FINER, + "Input data matches schema 'CreateServerNetworkingWithNics'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for CreateServerNetworkingWithNics failed with `%s`.", + e.getMessage())); + log.log( + Level.FINER, + "Input data does not match schema 'CreateServerNetworkingWithNics'", + e); + } + + if (match == 1) { + ServerNetworking ret = new ServerNetworking(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException( + String.format( + java.util.Locale.ROOT, + "Failed deserialization for ServerNetworking: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", + match, + errorMessages, + jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public ServerNetworking() { + super("oneOf", Boolean.FALSE); + } + + public ServerNetworking(Object o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("CreateServerNetworking", CreateServerNetworking.class); + schemas.put("CreateServerNetworkingWithNics", CreateServerNetworkingWithNics.class); + } + + @Override + public Map> getSchemas() { + return ServerNetworking.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: CreateServerNetworking, CreateServerNetworkingWithNics + * + *

It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof CreateServerNetworking) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof CreateServerNetworkingWithNics) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException( + "Invalid instance type. Must be CreateServerNetworking, CreateServerNetworkingWithNics"); + } + + /** + * Get the actual instance, which can be the following: CreateServerNetworking, + * CreateServerNetworkingWithNics + * + * @return The actual instance (CreateServerNetworking, CreateServerNetworkingWithNics) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `CreateServerNetworking`. If the actual instance is not + * `CreateServerNetworking`, the ClassCastException will be thrown. + * + * @return The actual instance of `CreateServerNetworking` + * @throws ClassCastException if the instance is not `CreateServerNetworking` + */ + public CreateServerNetworking getCreateServerNetworking() throws ClassCastException { + return (CreateServerNetworking) super.getActualInstance(); + } + + /** + * Get the actual instance of `CreateServerNetworkingWithNics`. If the actual instance is not + * `CreateServerNetworkingWithNics`, the ClassCastException will be thrown. + * + * @return The actual instance of `CreateServerNetworkingWithNics` + * @throws ClassCastException if the instance is not `CreateServerNetworkingWithNics` + */ + public CreateServerNetworkingWithNics getCreateServerNetworkingWithNics() + throws ClassCastException { + return (CreateServerNetworkingWithNics) 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 ServerNetworking + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with CreateServerNetworking + try { + CreateServerNetworking.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for CreateServerNetworking failed with `%s`.", + e.getMessage())); + // continue to the next one + } + // validate the json string with CreateServerNetworkingWithNics + try { + CreateServerNetworkingWithNics.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for CreateServerNetworkingWithNics failed with `%s`.", + e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException( + String.format( + java.util.Locale.ROOT, + "The JSON string is invalid for ServerNetworking with oneOf schemas: CreateServerNetworking, CreateServerNetworkingWithNics. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", + validCount, + errorMessages, + jsonElement.toString())); + } + } + + /** + * Create an instance of ServerNetworking given an JSON string + * + * @param jsonString JSON string + * @return An instance of ServerNetworking + * @throws IOException if the JSON string is invalid with respect to ServerNetworking + */ + public static ServerNetworking fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ServerNetworking.class); + } + + /** + * Convert an instance of ServerNetworking to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ServiceAccountMailListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ServiceAccountMailListResponse.java new file mode 100644 index 00000000..5c24d901 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/ServiceAccountMailListResponse.java @@ -0,0 +1,329 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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.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; + +/** Service account mail list response. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class ServiceAccountMailListResponse { + public static final String SERIALIZED_NAME_ITEMS = "items"; + + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public ServiceAccountMailListResponse() {} + + public ServiceAccountMailListResponse items(@javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public ServiceAccountMailListResponse addItemsItem(String itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list of service account mails. + * + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ServiceAccountMailListResponse instance itself + */ + public ServiceAccountMailListResponse 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; + } + ServiceAccountMailListResponse serviceAccountMailListResponse = + (ServiceAccountMailListResponse) o; + return Objects.equals(this.items, serviceAccountMailListResponse.items) + && Objects.equals( + this.additionalProperties, + serviceAccountMailListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ServiceAccountMailListResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("items")); + } + + /** + * 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 + * ServiceAccountMailListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ServiceAccountMailListResponse.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 ServiceAccountMailListResponse is not found in the empty JSON string", + ServiceAccountMailListResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ServiceAccountMailListResponse.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 required json array is present + if (jsonObj.get("items") == null) { + throw new IllegalArgumentException( + "Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("items").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `items` to be an array in the JSON string but got `%s`", + jsonObj.get("items").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ServiceAccountMailListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ServiceAccountMailListResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(ServiceAccountMailListResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ServiceAccountMailListResponse 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 ServiceAccountMailListResponse read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ServiceAccountMailListResponse 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 ServiceAccountMailListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ServiceAccountMailListResponse + * @throws IOException if the JSON string is invalid with respect to + * ServiceAccountMailListResponse + */ + public static ServiceAccountMailListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ServiceAccountMailListResponse.class); + } + + /** + * Convert an instance of ServiceAccountMailListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/SetImageSharePayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/SetImageSharePayload.java new file mode 100644 index 00000000..4cc385df --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/SetImageSharePayload.java @@ -0,0 +1,337 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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.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; +import java.util.UUID; + +/** + * Share details of an Image. For requests ParentOrganization and Projects are mutually exclusive. + */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class SetImageSharePayload { + public static final String SERIALIZED_NAME_PARENT_ORGANIZATION = "parentOrganization"; + + @SerializedName(SERIALIZED_NAME_PARENT_ORGANIZATION) + @javax.annotation.Nullable private Boolean parentOrganization; + + public static final String SERIALIZED_NAME_PROJECTS = "projects"; + + @SerializedName(SERIALIZED_NAME_PROJECTS) + @javax.annotation.Nullable private List projects = new ArrayList<>(); + + public SetImageSharePayload() {} + + public SetImageSharePayload parentOrganization( + @javax.annotation.Nullable Boolean parentOrganization) { + this.parentOrganization = parentOrganization; + return this; + } + + /** + * Image is shared with all projects inside the image owners organization. + * + * @return parentOrganization + */ + @javax.annotation.Nullable public Boolean getParentOrganization() { + return parentOrganization; + } + + public void setParentOrganization(@javax.annotation.Nullable Boolean parentOrganization) { + this.parentOrganization = parentOrganization; + } + + public SetImageSharePayload projects(@javax.annotation.Nullable List projects) { + this.projects = projects; + return this; + } + + public SetImageSharePayload addProjectsItem(UUID projectsItem) { + if (this.projects == null) { + this.projects = new ArrayList<>(); + } + this.projects.add(projectsItem); + return this; + } + + /** + * List of all projects the Image is shared with. + * + * @return projects + */ + @javax.annotation.Nullable public List getProjects() { + return projects; + } + + public void setProjects(@javax.annotation.Nullable List projects) { + this.projects = projects; + } + + /** + * 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 SetImageSharePayload instance itself + */ + public SetImageSharePayload 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; + } + SetImageSharePayload setImageSharePayload = (SetImageSharePayload) o; + return Objects.equals(this.parentOrganization, setImageSharePayload.parentOrganization) + && Objects.equals(this.projects, setImageSharePayload.projects) + && Objects.equals( + this.additionalProperties, setImageSharePayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(parentOrganization, projects, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SetImageSharePayload {\n"); + sb.append(" parentOrganization: ") + .append(toIndentedString(parentOrganization)) + .append("\n"); + sb.append(" projects: ").append(toIndentedString(projects)).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("parentOrganization", "projects")); + + // 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 SetImageSharePayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SetImageSharePayload.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 SetImageSharePayload is not found in the empty JSON string", + SetImageSharePayload.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("projects") != null + && !jsonObj.get("projects").isJsonNull() + && !jsonObj.get("projects").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `projects` to be an array in the JSON string but got `%s`", + jsonObj.get("projects").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SetImageSharePayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SetImageSharePayload' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(SetImageSharePayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, SetImageSharePayload 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 SetImageSharePayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SetImageSharePayload 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 SetImageSharePayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of SetImageSharePayload + * @throws IOException if the JSON string is invalid with respect to SetImageSharePayload + */ + public static SetImageSharePayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SetImageSharePayload.class); + } + + /** + * Convert an instance of SetImageSharePayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/Snapshot.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/Snapshot.java new file mode 100644 index 00000000..fe70f530 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/Snapshot.java @@ -0,0 +1,532 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; +import java.util.UUID; + +/** Object that represents a snapshot. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class Snapshot { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable private String description; + + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; + + public static final String SERIALIZED_NAME_SIZE = "size"; + + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nullable private Long size; + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable private String status; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable private OffsetDateTime updatedAt; + + public static final String SERIALIZED_NAME_VOLUME_ID = "volumeId"; + + @SerializedName(SERIALIZED_NAME_VOLUME_ID) + @javax.annotation.Nonnull + private UUID volumeId; + + public Snapshot() {} + + public Snapshot( + OffsetDateTime createdAt, UUID id, Long size, String status, OffsetDateTime updatedAt) { + this(); + this.createdAt = createdAt; + this.id = id; + this.size = size; + this.status = status; + this.updatedAt = updatedAt; + } + + /** + * Date-time when resource was created. + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public Snapshot description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Description Object. Allows string up to 255 Characters. + * + * @return description + */ + @javax.annotation.Nullable public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + public Snapshot labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public Snapshot name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nullable public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * Size in Gigabyte. + * + * @return size + */ + @javax.annotation.Nullable public Long getSize() { + return size; + } + + /** + * The status of a snapshot object. Possible values: `AVAILABLE`, + * `BACKING-UP`, `CREATING`, `DELETED`, `DELETING`, + * `ERROR`, `RESTORING`, `UNMANAGING`, `UPDATING`. + * + * @return status + */ + @javax.annotation.Nullable public String getStatus() { + return status; + } + + /** + * Date-time when resource was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nullable public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public Snapshot volumeId(@javax.annotation.Nonnull UUID volumeId) { + this.volumeId = volumeId; + return this; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return volumeId + */ + @javax.annotation.Nonnull + public UUID getVolumeId() { + return volumeId; + } + + public void setVolumeId(@javax.annotation.Nonnull UUID volumeId) { + this.volumeId = volumeId; + } + + /** + * 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 Snapshot instance itself + */ + public Snapshot 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; + } + Snapshot snapshot = (Snapshot) o; + return Objects.equals(this.createdAt, snapshot.createdAt) + && Objects.equals(this.description, snapshot.description) + && Objects.equals(this.id, snapshot.id) + && Objects.equals(this.labels, snapshot.labels) + && Objects.equals(this.name, snapshot.name) + && Objects.equals(this.size, snapshot.size) + && Objects.equals(this.status, snapshot.status) + && Objects.equals(this.updatedAt, snapshot.updatedAt) + && Objects.equals(this.volumeId, snapshot.volumeId) + && Objects.equals(this.additionalProperties, snapshot.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + createdAt, + description, + id, + labels, + name, + size, + status, + updatedAt, + volumeId, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Snapshot {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" volumeId: ").append(toIndentedString(volumeId)).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( + "createdAt", + "description", + "id", + "labels", + "name", + "size", + "status", + "updatedAt", + "volumeId")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("volumeId")); + } + + /** + * 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 Snapshot + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Snapshot.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 Snapshot is not found in the empty JSON string", + Snapshot.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Snapshot.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("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `description` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("description").toString())); + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `name` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("name").toString())); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) + && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `status` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("status").toString())); + } + if (!jsonObj.get("volumeId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `volumeId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("volumeId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Snapshot.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Snapshot' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(Snapshot.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, Snapshot 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 Snapshot read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Snapshot 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 Snapshot given an JSON string + * + * @param jsonString JSON string + * @return An instance of Snapshot + * @throws IOException if the JSON string is invalid with respect to Snapshot + */ + public static Snapshot fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Snapshot.class); + } + + /** + * Convert an instance of Snapshot to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/SnapshotListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/SnapshotListResponse.java new file mode 100644 index 00000000..8ef348eb --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/SnapshotListResponse.java @@ -0,0 +1,326 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** Snapshot list response. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class SnapshotListResponse { + public static final String SERIALIZED_NAME_ITEMS = "items"; + + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public SnapshotListResponse() {} + + public SnapshotListResponse items(@javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public SnapshotListResponse addItemsItem(Snapshot itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list containing snapshot objects. + * + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SnapshotListResponse instance itself + */ + public SnapshotListResponse 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; + } + SnapshotListResponse snapshotListResponse = (SnapshotListResponse) o; + return Objects.equals(this.items, snapshotListResponse.items) + && Objects.equals( + this.additionalProperties, snapshotListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SnapshotListResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("items")); + } + + /** + * 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 SnapshotListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SnapshotListResponse.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 SnapshotListResponse is not found in the empty JSON string", + SnapshotListResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SnapshotListResponse.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("items").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `items` to be an array in the JSON string but got `%s`", + jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + Snapshot.validateJsonElement(jsonArrayitems.get(i)); + } + ; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SnapshotListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SnapshotListResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(SnapshotListResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, SnapshotListResponse 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 SnapshotListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SnapshotListResponse 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 SnapshotListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of SnapshotListResponse + * @throws IOException if the JSON string is invalid with respect to SnapshotListResponse + */ + public static SnapshotListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SnapshotListResponse.class); + } + + /** + * Convert an instance of SnapshotListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/StaticAreaID.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/StaticAreaID.java new file mode 100644 index 00000000..4a0bd912 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/StaticAreaID.java @@ -0,0 +1,73 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.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 identifier (ID) of a static area. */ +@JsonAdapter(StaticAreaID.Adapter.class) +public enum StaticAreaID { + PUBLIC("PUBLIC"), + + SCHWARZ("SCHWARZ"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + StaticAreaID(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StaticAreaID fromValue(String value) { + for (StaticAreaID b : StaticAreaID.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 StaticAreaID enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StaticAreaID read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StaticAreaID.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StaticAreaID.fromValue(value); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/UpdateAreaAddressFamily.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/UpdateAreaAddressFamily.java new file mode 100644 index 00000000..bcda8c25 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/UpdateAreaAddressFamily.java @@ -0,0 +1,292 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** The addressFamily object for a area update request. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class UpdateAreaAddressFamily { + public static final String SERIALIZED_NAME_IPV4 = "ipv4"; + + @SerializedName(SERIALIZED_NAME_IPV4) + @javax.annotation.Nullable private UpdateAreaIPv4 ipv4; + + public UpdateAreaAddressFamily() {} + + public UpdateAreaAddressFamily ipv4(@javax.annotation.Nullable UpdateAreaIPv4 ipv4) { + this.ipv4 = ipv4; + return this; + } + + /** + * Get ipv4 + * + * @return ipv4 + */ + @javax.annotation.Nullable public UpdateAreaIPv4 getIpv4() { + return ipv4; + } + + public void setIpv4(@javax.annotation.Nullable UpdateAreaIPv4 ipv4) { + this.ipv4 = ipv4; + } + + /** + * 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 UpdateAreaAddressFamily instance itself + */ + public UpdateAreaAddressFamily 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; + } + UpdateAreaAddressFamily updateAreaAddressFamily = (UpdateAreaAddressFamily) o; + return Objects.equals(this.ipv4, updateAreaAddressFamily.ipv4) + && Objects.equals( + this.additionalProperties, updateAreaAddressFamily.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(ipv4, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateAreaAddressFamily {\n"); + sb.append(" ipv4: ").append(toIndentedString(ipv4)).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("ipv4")); + + // 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 UpdateAreaAddressFamily + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateAreaAddressFamily.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 UpdateAreaAddressFamily is not found in the empty JSON string", + UpdateAreaAddressFamily.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `ipv4` + if (jsonObj.get("ipv4") != null && !jsonObj.get("ipv4").isJsonNull()) { + UpdateAreaIPv4.validateJsonElement(jsonObj.get("ipv4")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateAreaAddressFamily.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateAreaAddressFamily' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateAreaAddressFamily.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateAreaAddressFamily 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 UpdateAreaAddressFamily read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateAreaAddressFamily 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 UpdateAreaAddressFamily given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateAreaAddressFamily + * @throws IOException if the JSON string is invalid with respect to UpdateAreaAddressFamily + */ + public static UpdateAreaAddressFamily fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateAreaAddressFamily.class); + } + + /** + * Convert an instance of UpdateAreaAddressFamily to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/UpdateAreaIPv4.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/UpdateAreaIPv4.java new file mode 100644 index 00000000..29e25269 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/UpdateAreaIPv4.java @@ -0,0 +1,393 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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.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; + +/** The update object for a IPv4 network area. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class UpdateAreaIPv4 { + public static final String SERIALIZED_NAME_DEFAULT_NAMESERVERS = "defaultNameservers"; + + @SerializedName(SERIALIZED_NAME_DEFAULT_NAMESERVERS) + @javax.annotation.Nullable private List defaultNameservers = new ArrayList<>(); + + public static final String SERIALIZED_NAME_DEFAULT_PREFIX_LEN = "defaultPrefixLen"; + + @SerializedName(SERIALIZED_NAME_DEFAULT_PREFIX_LEN) + @javax.annotation.Nullable private Integer defaultPrefixLen; + + public static final String SERIALIZED_NAME_MAX_PREFIX_LEN = "maxPrefixLen"; + + @SerializedName(SERIALIZED_NAME_MAX_PREFIX_LEN) + @javax.annotation.Nullable private Integer maxPrefixLen; + + public static final String SERIALIZED_NAME_MIN_PREFIX_LEN = "minPrefixLen"; + + @SerializedName(SERIALIZED_NAME_MIN_PREFIX_LEN) + @javax.annotation.Nullable private Integer minPrefixLen; + + public UpdateAreaIPv4() {} + + public UpdateAreaIPv4 defaultNameservers( + @javax.annotation.Nullable List defaultNameservers) { + this.defaultNameservers = defaultNameservers; + return this; + } + + public UpdateAreaIPv4 addDefaultNameserversItem(String defaultNameserversItem) { + if (this.defaultNameservers == null) { + this.defaultNameservers = new ArrayList<>(); + } + this.defaultNameservers.add(defaultNameserversItem); + return this; + } + + /** + * Get defaultNameservers + * + * @return defaultNameservers + */ + @javax.annotation.Nullable public List getDefaultNameservers() { + return defaultNameservers; + } + + public void setDefaultNameservers(@javax.annotation.Nullable List defaultNameservers) { + this.defaultNameservers = defaultNameservers; + } + + public UpdateAreaIPv4 defaultPrefixLen(@javax.annotation.Nullable Integer defaultPrefixLen) { + this.defaultPrefixLen = defaultPrefixLen; + return this; + } + + /** + * The default prefix length for networks in the network area. minimum: 24 maximum: 29 + * + * @return defaultPrefixLen + */ + @javax.annotation.Nullable public Integer getDefaultPrefixLen() { + return defaultPrefixLen; + } + + public void setDefaultPrefixLen(@javax.annotation.Nullable Integer defaultPrefixLen) { + this.defaultPrefixLen = defaultPrefixLen; + } + + public UpdateAreaIPv4 maxPrefixLen(@javax.annotation.Nullable Integer maxPrefixLen) { + this.maxPrefixLen = maxPrefixLen; + return this; + } + + /** + * The maximal prefix length for networks in the network area. minimum: 24 maximum: 29 + * + * @return maxPrefixLen + */ + @javax.annotation.Nullable public Integer getMaxPrefixLen() { + return maxPrefixLen; + } + + public void setMaxPrefixLen(@javax.annotation.Nullable Integer maxPrefixLen) { + this.maxPrefixLen = maxPrefixLen; + } + + public UpdateAreaIPv4 minPrefixLen(@javax.annotation.Nullable Integer minPrefixLen) { + this.minPrefixLen = minPrefixLen; + return this; + } + + /** + * The minimal prefix length for networks in the network area. minimum: 8 maximum: 29 + * + * @return minPrefixLen + */ + @javax.annotation.Nullable public Integer getMinPrefixLen() { + return minPrefixLen; + } + + public void setMinPrefixLen(@javax.annotation.Nullable Integer minPrefixLen) { + this.minPrefixLen = minPrefixLen; + } + + /** + * 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 UpdateAreaIPv4 instance itself + */ + public UpdateAreaIPv4 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; + } + UpdateAreaIPv4 updateAreaIPv4 = (UpdateAreaIPv4) o; + return Objects.equals(this.defaultNameservers, updateAreaIPv4.defaultNameservers) + && Objects.equals(this.defaultPrefixLen, updateAreaIPv4.defaultPrefixLen) + && Objects.equals(this.maxPrefixLen, updateAreaIPv4.maxPrefixLen) + && Objects.equals(this.minPrefixLen, updateAreaIPv4.minPrefixLen) + && Objects.equals(this.additionalProperties, updateAreaIPv4.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + defaultNameservers, + defaultPrefixLen, + maxPrefixLen, + minPrefixLen, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateAreaIPv4 {\n"); + sb.append(" defaultNameservers: ") + .append(toIndentedString(defaultNameservers)) + .append("\n"); + sb.append(" defaultPrefixLen: ").append(toIndentedString(defaultPrefixLen)).append("\n"); + sb.append(" maxPrefixLen: ").append(toIndentedString(maxPrefixLen)).append("\n"); + sb.append(" minPrefixLen: ").append(toIndentedString(minPrefixLen)).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( + "defaultNameservers", + "defaultPrefixLen", + "maxPrefixLen", + "minPrefixLen")); + + // 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 UpdateAreaIPv4 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateAreaIPv4.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 UpdateAreaIPv4 is not found in the empty JSON string", + UpdateAreaIPv4.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("defaultNameservers") != null + && !jsonObj.get("defaultNameservers").isJsonNull() + && !jsonObj.get("defaultNameservers").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `defaultNameservers` to be an array in the JSON string but got `%s`", + jsonObj.get("defaultNameservers").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateAreaIPv4.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateAreaIPv4' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateAreaIPv4.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateAreaIPv4 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 UpdateAreaIPv4 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateAreaIPv4 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 UpdateAreaIPv4 given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateAreaIPv4 + * @throws IOException if the JSON string is invalid with respect to UpdateAreaIPv4 + */ + public static UpdateAreaIPv4 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateAreaIPv4.class); + } + + /** + * Convert an instance of UpdateAreaIPv4 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/UpdateAttachedVolumePayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/UpdateAttachedVolumePayload.java new file mode 100644 index 00000000..941b0b98 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/UpdateAttachedVolumePayload.java @@ -0,0 +1,351 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.v1api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +/** Object that represents a Volume attachment to a server. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class UpdateAttachedVolumePayload { + public static final String SERIALIZED_NAME_DELETE_ON_TERMINATION = "deleteOnTermination"; + + @SerializedName(SERIALIZED_NAME_DELETE_ON_TERMINATION) + @javax.annotation.Nullable private Boolean deleteOnTermination; + + public static final String SERIALIZED_NAME_SERVER_ID = "serverId"; + + @SerializedName(SERIALIZED_NAME_SERVER_ID) + @javax.annotation.Nullable private UUID serverId; + + public static final String SERIALIZED_NAME_VOLUME_ID = "volumeId"; + + @SerializedName(SERIALIZED_NAME_VOLUME_ID) + @javax.annotation.Nullable private UUID volumeId; + + public UpdateAttachedVolumePayload() {} + + public UpdateAttachedVolumePayload(UUID serverId, UUID volumeId) { + this(); + this.serverId = serverId; + this.volumeId = volumeId; + } + + public UpdateAttachedVolumePayload deleteOnTermination( + @javax.annotation.Nullable Boolean deleteOnTermination) { + this.deleteOnTermination = deleteOnTermination; + return this; + } + + /** + * Delete the volume during the termination of the server. Defaults to false. + * + * @return deleteOnTermination + */ + @javax.annotation.Nullable public Boolean getDeleteOnTermination() { + return deleteOnTermination; + } + + public void setDeleteOnTermination(@javax.annotation.Nullable Boolean deleteOnTermination) { + this.deleteOnTermination = deleteOnTermination; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return serverId + */ + @javax.annotation.Nullable public UUID getServerId() { + return serverId; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return volumeId + */ + @javax.annotation.Nullable public UUID getVolumeId() { + return volumeId; + } + + /** + * 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 UpdateAttachedVolumePayload instance itself + */ + public UpdateAttachedVolumePayload 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; + } + UpdateAttachedVolumePayload updateAttachedVolumePayload = (UpdateAttachedVolumePayload) o; + return Objects.equals( + this.deleteOnTermination, updateAttachedVolumePayload.deleteOnTermination) + && Objects.equals(this.serverId, updateAttachedVolumePayload.serverId) + && Objects.equals(this.volumeId, updateAttachedVolumePayload.volumeId) + && Objects.equals( + this.additionalProperties, + updateAttachedVolumePayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(deleteOnTermination, serverId, volumeId, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateAttachedVolumePayload {\n"); + sb.append(" deleteOnTermination: ") + .append(toIndentedString(deleteOnTermination)) + .append("\n"); + sb.append(" serverId: ").append(toIndentedString(serverId)).append("\n"); + sb.append(" volumeId: ").append(toIndentedString(volumeId)).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("deleteOnTermination", "serverId", "volumeId")); + + // 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 + * UpdateAttachedVolumePayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateAttachedVolumePayload.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 UpdateAttachedVolumePayload is not found in the empty JSON string", + UpdateAttachedVolumePayload.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("serverId") != null && !jsonObj.get("serverId").isJsonNull()) + && !jsonObj.get("serverId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `serverId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("serverId").toString())); + } + if ((jsonObj.get("volumeId") != null && !jsonObj.get("volumeId").isJsonNull()) + && !jsonObj.get("volumeId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `volumeId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("volumeId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateAttachedVolumePayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateAttachedVolumePayload' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateAttachedVolumePayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateAttachedVolumePayload 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 UpdateAttachedVolumePayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateAttachedVolumePayload 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 UpdateAttachedVolumePayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateAttachedVolumePayload + * @throws IOException if the JSON string is invalid with respect to UpdateAttachedVolumePayload + */ + public static UpdateAttachedVolumePayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateAttachedVolumePayload.class); + } + + /** + * Convert an instance of UpdateAttachedVolumePayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/UpdateBackupPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/UpdateBackupPayload.java new file mode 100644 index 00000000..888a4f3c --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/UpdateBackupPayload.java @@ -0,0 +1,594 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; +import java.util.UUID; + +/** Object that represents a backup. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class UpdateBackupPayload { + public static final String SERIALIZED_NAME_AVAILABILITY_ZONE = "availabilityZone"; + + @SerializedName(SERIALIZED_NAME_AVAILABILITY_ZONE) + @javax.annotation.Nullable private String availabilityZone; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable private String description; + + public static final String SERIALIZED_NAME_ENCRYPTED = "encrypted"; + + @SerializedName(SERIALIZED_NAME_ENCRYPTED) + @javax.annotation.Nullable private Boolean encrypted; + + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; + + public static final String SERIALIZED_NAME_SIZE = "size"; + + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nullable private Long size; + + public static final String SERIALIZED_NAME_SNAPSHOT_ID = "snapshotId"; + + @SerializedName(SERIALIZED_NAME_SNAPSHOT_ID) + @javax.annotation.Nullable private UUID snapshotId; + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable private String status; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable private OffsetDateTime updatedAt; + + public static final String SERIALIZED_NAME_VOLUME_ID = "volumeId"; + + @SerializedName(SERIALIZED_NAME_VOLUME_ID) + @javax.annotation.Nullable private UUID volumeId; + + public UpdateBackupPayload() {} + + public UpdateBackupPayload( + String availabilityZone, + OffsetDateTime createdAt, + Boolean encrypted, + UUID id, + Long size, + UUID snapshotId, + String status, + OffsetDateTime updatedAt, + UUID volumeId) { + this(); + this.availabilityZone = availabilityZone; + this.createdAt = createdAt; + this.encrypted = encrypted; + this.id = id; + this.size = size; + this.snapshotId = snapshotId; + this.status = status; + this.updatedAt = updatedAt; + this.volumeId = volumeId; + } + + /** + * Object that represents an availability zone. + * + * @return availabilityZone + */ + @javax.annotation.Nullable public String getAvailabilityZone() { + return availabilityZone; + } + + /** + * Date-time when resource was created. + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public UpdateBackupPayload description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Description Object. Allows string up to 255 Characters. + * + * @return description + */ + @javax.annotation.Nullable public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + /** + * Indicates if a volume is encrypted. + * + * @return encrypted + */ + @javax.annotation.Nullable public Boolean getEncrypted() { + return encrypted; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + public UpdateBackupPayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public UpdateBackupPayload name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nullable public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * Size in Gigabyte. + * + * @return size + */ + @javax.annotation.Nullable public Long getSize() { + return size; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return snapshotId + */ + @javax.annotation.Nullable public UUID getSnapshotId() { + return snapshotId; + } + + /** + * The status of a backup object. Possible values: `AVAILABLE`, `CREATING`, + * `DELETED`, `DELETING`, `ERROR`, `RESTORING`. + * + * @return status + */ + @javax.annotation.Nullable public String getStatus() { + return status; + } + + /** + * Date-time when resource was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nullable public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return volumeId + */ + @javax.annotation.Nullable public UUID getVolumeId() { + return volumeId; + } + + /** + * 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 UpdateBackupPayload instance itself + */ + public UpdateBackupPayload 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; + } + UpdateBackupPayload updateBackupPayload = (UpdateBackupPayload) o; + return Objects.equals(this.availabilityZone, updateBackupPayload.availabilityZone) + && Objects.equals(this.createdAt, updateBackupPayload.createdAt) + && Objects.equals(this.description, updateBackupPayload.description) + && Objects.equals(this.encrypted, updateBackupPayload.encrypted) + && Objects.equals(this.id, updateBackupPayload.id) + && Objects.equals(this.labels, updateBackupPayload.labels) + && Objects.equals(this.name, updateBackupPayload.name) + && Objects.equals(this.size, updateBackupPayload.size) + && Objects.equals(this.snapshotId, updateBackupPayload.snapshotId) + && Objects.equals(this.status, updateBackupPayload.status) + && Objects.equals(this.updatedAt, updateBackupPayload.updatedAt) + && Objects.equals(this.volumeId, updateBackupPayload.volumeId) + && Objects.equals( + this.additionalProperties, updateBackupPayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + availabilityZone, + createdAt, + description, + encrypted, + id, + labels, + name, + size, + snapshotId, + status, + updatedAt, + volumeId, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateBackupPayload {\n"); + sb.append(" availabilityZone: ").append(toIndentedString(availabilityZone)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" encrypted: ").append(toIndentedString(encrypted)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" snapshotId: ").append(toIndentedString(snapshotId)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" volumeId: ").append(toIndentedString(volumeId)).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( + "availabilityZone", + "createdAt", + "description", + "encrypted", + "id", + "labels", + "name", + "size", + "snapshotId", + "status", + "updatedAt", + "volumeId")); + + // 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 UpdateBackupPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateBackupPayload.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 UpdateBackupPayload is not found in the empty JSON string", + UpdateBackupPayload.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("availabilityZone") != null + && !jsonObj.get("availabilityZone").isJsonNull()) + && !jsonObj.get("availabilityZone").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `availabilityZone` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("availabilityZone").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `description` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("description").toString())); + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `name` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("name").toString())); + } + if ((jsonObj.get("snapshotId") != null && !jsonObj.get("snapshotId").isJsonNull()) + && !jsonObj.get("snapshotId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `snapshotId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("snapshotId").toString())); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) + && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `status` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("status").toString())); + } + if ((jsonObj.get("volumeId") != null && !jsonObj.get("volumeId").isJsonNull()) + && !jsonObj.get("volumeId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `volumeId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("volumeId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateBackupPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateBackupPayload' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateBackupPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateBackupPayload 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 UpdateBackupPayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateBackupPayload 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 UpdateBackupPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateBackupPayload + * @throws IOException if the JSON string is invalid with respect to UpdateBackupPayload + */ + public static UpdateBackupPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateBackupPayload.class); + } + + /** + * Convert an instance of UpdateBackupPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/UpdateImagePayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/UpdateImagePayload.java new file mode 100644 index 00000000..cb34f44a --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/UpdateImagePayload.java @@ -0,0 +1,510 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** Object that represents an update request body of an Image. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class UpdateImagePayload { + public static final String SERIALIZED_NAME_AGENT = "agent"; + + @SerializedName(SERIALIZED_NAME_AGENT) + @javax.annotation.Nullable private ImageAgent agent; + + public static final String SERIALIZED_NAME_CONFIG = "config"; + + @SerializedName(SERIALIZED_NAME_CONFIG) + @javax.annotation.Nullable private ImageConfig config; + + public static final String SERIALIZED_NAME_DISK_FORMAT = "diskFormat"; + + @SerializedName(SERIALIZED_NAME_DISK_FORMAT) + @javax.annotation.Nullable private String diskFormat; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_MIN_DISK_SIZE = "minDiskSize"; + + @SerializedName(SERIALIZED_NAME_MIN_DISK_SIZE) + @javax.annotation.Nullable private Long minDiskSize; + + public static final String SERIALIZED_NAME_MIN_RAM = "minRam"; + + @SerializedName(SERIALIZED_NAME_MIN_RAM) + @javax.annotation.Nullable private Long minRam; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; + + public static final String SERIALIZED_NAME_PROTECTED = "protected"; + + @SerializedName(SERIALIZED_NAME_PROTECTED) + @javax.annotation.Nullable private Boolean _protected; + + public UpdateImagePayload() {} + + public UpdateImagePayload agent(@javax.annotation.Nullable ImageAgent agent) { + this.agent = agent; + return this; + } + + /** + * Get agent + * + * @return agent + */ + @javax.annotation.Nullable public ImageAgent getAgent() { + return agent; + } + + public void setAgent(@javax.annotation.Nullable ImageAgent agent) { + this.agent = agent; + } + + public UpdateImagePayload config(@javax.annotation.Nullable ImageConfig config) { + this.config = config; + return this; + } + + /** + * Get config + * + * @return config + */ + @javax.annotation.Nullable public ImageConfig getConfig() { + return config; + } + + public void setConfig(@javax.annotation.Nullable ImageConfig config) { + this.config = config; + } + + public UpdateImagePayload diskFormat(@javax.annotation.Nullable String diskFormat) { + this.diskFormat = diskFormat; + return this; + } + + /** + * Object that represents a disk format. Possible values: `raw`, `qcow2`, + * `iso`. + * + * @return diskFormat + */ + @javax.annotation.Nullable public String getDiskFormat() { + return diskFormat; + } + + public void setDiskFormat(@javax.annotation.Nullable String diskFormat) { + this.diskFormat = diskFormat; + } + + public UpdateImagePayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public UpdateImagePayload minDiskSize(@javax.annotation.Nullable Long minDiskSize) { + this.minDiskSize = minDiskSize; + return this; + } + + /** + * Size in Gigabyte. + * + * @return minDiskSize + */ + @javax.annotation.Nullable public Long getMinDiskSize() { + return minDiskSize; + } + + public void setMinDiskSize(@javax.annotation.Nullable Long minDiskSize) { + this.minDiskSize = minDiskSize; + } + + public UpdateImagePayload minRam(@javax.annotation.Nullable Long minRam) { + this.minRam = minRam; + return this; + } + + /** + * Size in Megabyte. + * + * @return minRam + */ + @javax.annotation.Nullable public Long getMinRam() { + return minRam; + } + + public void setMinRam(@javax.annotation.Nullable Long minRam) { + this.minRam = minRam; + } + + public UpdateImagePayload name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nullable public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + public UpdateImagePayload _protected(@javax.annotation.Nullable Boolean _protected) { + this._protected = _protected; + return this; + } + + /** + * When true the image is prevented from being deleted. + * + * @return _protected + */ + @javax.annotation.Nullable public Boolean getProtected() { + return _protected; + } + + public void setProtected(@javax.annotation.Nullable Boolean _protected) { + this._protected = _protected; + } + + /** + * 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 UpdateImagePayload instance itself + */ + public UpdateImagePayload 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; + } + UpdateImagePayload updateImagePayload = (UpdateImagePayload) o; + return Objects.equals(this.agent, updateImagePayload.agent) + && Objects.equals(this.config, updateImagePayload.config) + && Objects.equals(this.diskFormat, updateImagePayload.diskFormat) + && Objects.equals(this.labels, updateImagePayload.labels) + && Objects.equals(this.minDiskSize, updateImagePayload.minDiskSize) + && Objects.equals(this.minRam, updateImagePayload.minRam) + && Objects.equals(this.name, updateImagePayload.name) + && Objects.equals(this._protected, updateImagePayload._protected) + && Objects.equals( + this.additionalProperties, updateImagePayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + agent, + config, + diskFormat, + labels, + minDiskSize, + minRam, + name, + _protected, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateImagePayload {\n"); + sb.append(" agent: ").append(toIndentedString(agent)).append("\n"); + sb.append(" config: ").append(toIndentedString(config)).append("\n"); + sb.append(" diskFormat: ").append(toIndentedString(diskFormat)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" minDiskSize: ").append(toIndentedString(minDiskSize)).append("\n"); + sb.append(" minRam: ").append(toIndentedString(minRam)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" _protected: ").append(toIndentedString(_protected)).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( + "agent", + "config", + "diskFormat", + "labels", + "minDiskSize", + "minRam", + "name", + "protected")); + + // 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 UpdateImagePayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateImagePayload.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 UpdateImagePayload is not found in the empty JSON string", + UpdateImagePayload.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `agent` + if (jsonObj.get("agent") != null && !jsonObj.get("agent").isJsonNull()) { + ImageAgent.validateJsonElement(jsonObj.get("agent")); + } + // validate the optional field `config` + if (jsonObj.get("config") != null && !jsonObj.get("config").isJsonNull()) { + ImageConfig.validateJsonElement(jsonObj.get("config")); + } + if ((jsonObj.get("diskFormat") != null && !jsonObj.get("diskFormat").isJsonNull()) + && !jsonObj.get("diskFormat").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `diskFormat` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("diskFormat").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `name` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateImagePayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateImagePayload' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateImagePayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateImagePayload 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 UpdateImagePayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateImagePayload 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 UpdateImagePayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateImagePayload + * @throws IOException if the JSON string is invalid with respect to UpdateImagePayload + */ + public static UpdateImagePayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateImagePayload.class); + } + + /** + * Convert an instance of UpdateImagePayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/UpdateImageSharePayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/UpdateImageSharePayload.java new file mode 100644 index 00000000..628dfd91 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/UpdateImageSharePayload.java @@ -0,0 +1,338 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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.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; +import java.util.UUID; + +/** + * Share details of an Image. For requests ParentOrganization and Projects are mutually exclusive. + */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class UpdateImageSharePayload { + public static final String SERIALIZED_NAME_PARENT_ORGANIZATION = "parentOrganization"; + + @SerializedName(SERIALIZED_NAME_PARENT_ORGANIZATION) + @javax.annotation.Nullable private Boolean parentOrganization; + + public static final String SERIALIZED_NAME_PROJECTS = "projects"; + + @SerializedName(SERIALIZED_NAME_PROJECTS) + @javax.annotation.Nullable private List projects = new ArrayList<>(); + + public UpdateImageSharePayload() {} + + public UpdateImageSharePayload parentOrganization( + @javax.annotation.Nullable Boolean parentOrganization) { + this.parentOrganization = parentOrganization; + return this; + } + + /** + * Image is shared with all projects inside the image owners organization. + * + * @return parentOrganization + */ + @javax.annotation.Nullable public Boolean getParentOrganization() { + return parentOrganization; + } + + public void setParentOrganization(@javax.annotation.Nullable Boolean parentOrganization) { + this.parentOrganization = parentOrganization; + } + + public UpdateImageSharePayload projects(@javax.annotation.Nullable List projects) { + this.projects = projects; + return this; + } + + public UpdateImageSharePayload addProjectsItem(UUID projectsItem) { + if (this.projects == null) { + this.projects = new ArrayList<>(); + } + this.projects.add(projectsItem); + return this; + } + + /** + * List of all projects the Image is shared with. + * + * @return projects + */ + @javax.annotation.Nullable public List getProjects() { + return projects; + } + + public void setProjects(@javax.annotation.Nullable List projects) { + this.projects = projects; + } + + /** + * 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 UpdateImageSharePayload instance itself + */ + public UpdateImageSharePayload 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; + } + UpdateImageSharePayload updateImageSharePayload = (UpdateImageSharePayload) o; + return Objects.equals(this.parentOrganization, updateImageSharePayload.parentOrganization) + && Objects.equals(this.projects, updateImageSharePayload.projects) + && Objects.equals( + this.additionalProperties, updateImageSharePayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(parentOrganization, projects, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateImageSharePayload {\n"); + sb.append(" parentOrganization: ") + .append(toIndentedString(parentOrganization)) + .append("\n"); + sb.append(" projects: ").append(toIndentedString(projects)).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("parentOrganization", "projects")); + + // 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 UpdateImageSharePayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateImageSharePayload.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 UpdateImageSharePayload is not found in the empty JSON string", + UpdateImageSharePayload.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("projects") != null + && !jsonObj.get("projects").isJsonNull() + && !jsonObj.get("projects").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `projects` to be an array in the JSON string but got `%s`", + jsonObj.get("projects").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateImageSharePayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateImageSharePayload' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateImageSharePayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateImageSharePayload 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 UpdateImageSharePayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateImageSharePayload 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 UpdateImageSharePayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateImageSharePayload + * @throws IOException if the JSON string is invalid with respect to UpdateImageSharePayload + */ + public static UpdateImageSharePayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateImageSharePayload.class); + } + + /** + * Convert an instance of UpdateImageSharePayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/UpdateKeyPairPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/UpdateKeyPairPayload.java new file mode 100644 index 00000000..2a9e06f1 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/UpdateKeyPairPayload.java @@ -0,0 +1,291 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** Object that represents an update request body of a public key of an SSH keypair. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class UpdateKeyPairPayload { + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public UpdateKeyPairPayload() {} + + public UpdateKeyPairPayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UpdateKeyPairPayload instance itself + */ + public UpdateKeyPairPayload 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; + } + UpdateKeyPairPayload updateKeyPairPayload = (UpdateKeyPairPayload) o; + return Objects.equals(this.labels, updateKeyPairPayload.labels) + && Objects.equals( + this.additionalProperties, updateKeyPairPayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(labels, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateKeyPairPayload {\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("labels")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(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 UpdateKeyPairPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateKeyPairPayload.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 UpdateKeyPairPayload is not found in the empty JSON string", + UpdateKeyPairPayload.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateKeyPairPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateKeyPairPayload' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateKeyPairPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateKeyPairPayload 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 UpdateKeyPairPayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateKeyPairPayload 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 UpdateKeyPairPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateKeyPairPayload + * @throws IOException if the JSON string is invalid with respect to UpdateKeyPairPayload + */ + public static UpdateKeyPairPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateKeyPairPayload.class); + } + + /** + * Convert an instance of UpdateKeyPairPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/UpdateNetworkAddressFamily.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/UpdateNetworkAddressFamily.java new file mode 100644 index 00000000..c4d10a22 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/UpdateNetworkAddressFamily.java @@ -0,0 +1,321 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** The addressFamily object for a network update request. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class UpdateNetworkAddressFamily { + public static final String SERIALIZED_NAME_IPV4 = "ipv4"; + + @SerializedName(SERIALIZED_NAME_IPV4) + @javax.annotation.Nullable private UpdateNetworkIPv4Body ipv4; + + public static final String SERIALIZED_NAME_IPV6 = "ipv6"; + + @SerializedName(SERIALIZED_NAME_IPV6) + @javax.annotation.Nullable private UpdateNetworkIPv6Body ipv6; + + public UpdateNetworkAddressFamily() {} + + public UpdateNetworkAddressFamily ipv4(@javax.annotation.Nullable UpdateNetworkIPv4Body ipv4) { + this.ipv4 = ipv4; + return this; + } + + /** + * Get ipv4 + * + * @return ipv4 + */ + @javax.annotation.Nullable public UpdateNetworkIPv4Body getIpv4() { + return ipv4; + } + + public void setIpv4(@javax.annotation.Nullable UpdateNetworkIPv4Body ipv4) { + this.ipv4 = ipv4; + } + + public UpdateNetworkAddressFamily ipv6(@javax.annotation.Nullable UpdateNetworkIPv6Body ipv6) { + this.ipv6 = ipv6; + return this; + } + + /** + * Get ipv6 + * + * @return ipv6 + */ + @javax.annotation.Nullable public UpdateNetworkIPv6Body getIpv6() { + return ipv6; + } + + public void setIpv6(@javax.annotation.Nullable UpdateNetworkIPv6Body ipv6) { + this.ipv6 = ipv6; + } + + /** + * 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 UpdateNetworkAddressFamily instance itself + */ + public UpdateNetworkAddressFamily 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; + } + UpdateNetworkAddressFamily updateNetworkAddressFamily = (UpdateNetworkAddressFamily) o; + return Objects.equals(this.ipv4, updateNetworkAddressFamily.ipv4) + && Objects.equals(this.ipv6, updateNetworkAddressFamily.ipv6) + && Objects.equals( + this.additionalProperties, updateNetworkAddressFamily.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(ipv4, ipv6, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateNetworkAddressFamily {\n"); + sb.append(" ipv4: ").append(toIndentedString(ipv4)).append("\n"); + sb.append(" ipv6: ").append(toIndentedString(ipv6)).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("ipv4", "ipv6")); + + // 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 UpdateNetworkAddressFamily + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateNetworkAddressFamily.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 UpdateNetworkAddressFamily is not found in the empty JSON string", + UpdateNetworkAddressFamily.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `ipv4` + if (jsonObj.get("ipv4") != null && !jsonObj.get("ipv4").isJsonNull()) { + UpdateNetworkIPv4Body.validateJsonElement(jsonObj.get("ipv4")); + } + // validate the optional field `ipv6` + if (jsonObj.get("ipv6") != null && !jsonObj.get("ipv6").isJsonNull()) { + UpdateNetworkIPv6Body.validateJsonElement(jsonObj.get("ipv6")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateNetworkAddressFamily.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateNetworkAddressFamily' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateNetworkAddressFamily.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateNetworkAddressFamily 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 UpdateNetworkAddressFamily read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateNetworkAddressFamily 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 UpdateNetworkAddressFamily given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateNetworkAddressFamily + * @throws IOException if the JSON string is invalid with respect to UpdateNetworkAddressFamily + */ + public static UpdateNetworkAddressFamily fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateNetworkAddressFamily.class); + } + + /** + * Convert an instance of UpdateNetworkAddressFamily to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/UpdateNetworkAreaRoutePayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/UpdateNetworkAreaRoutePayload.java new file mode 100644 index 00000000..f49326b1 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/UpdateNetworkAreaRoutePayload.java @@ -0,0 +1,299 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** Object that represents the request body for a route update. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class UpdateNetworkAreaRoutePayload { + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public UpdateNetworkAreaRoutePayload() {} + + public UpdateNetworkAreaRoutePayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UpdateNetworkAreaRoutePayload instance itself + */ + public UpdateNetworkAreaRoutePayload 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; + } + UpdateNetworkAreaRoutePayload updateNetworkAreaRoutePayload = + (UpdateNetworkAreaRoutePayload) o; + return Objects.equals(this.labels, updateNetworkAreaRoutePayload.labels) + && Objects.equals( + this.additionalProperties, + updateNetworkAreaRoutePayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(labels, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateNetworkAreaRoutePayload {\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("labels")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(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 + * UpdateNetworkAreaRoutePayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateNetworkAreaRoutePayload.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 UpdateNetworkAreaRoutePayload is not found in the empty JSON string", + UpdateNetworkAreaRoutePayload.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateNetworkAreaRoutePayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateNetworkAreaRoutePayload' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(UpdateNetworkAreaRoutePayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateNetworkAreaRoutePayload 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 UpdateNetworkAreaRoutePayload read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateNetworkAreaRoutePayload 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 UpdateNetworkAreaRoutePayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateNetworkAreaRoutePayload + * @throws IOException if the JSON string is invalid with respect to + * UpdateNetworkAreaRoutePayload + */ + public static UpdateNetworkAreaRoutePayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateNetworkAreaRoutePayload.class); + } + + /** + * Convert an instance of UpdateNetworkAreaRoutePayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/UpdateNetworkIPv4Body.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/UpdateNetworkIPv4Body.java new file mode 100644 index 00000000..4406f3e4 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/UpdateNetworkIPv4Body.java @@ -0,0 +1,357 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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.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; +import org.openapitools.jackson.nullable.JsonNullable; + +/** The config object for a IPv4 network update. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class UpdateNetworkIPv4Body { + public static final String SERIALIZED_NAME_GATEWAY = "gateway"; + + @SerializedName(SERIALIZED_NAME_GATEWAY) + @javax.annotation.Nullable private String gateway; + + public static final String SERIALIZED_NAME_NAMESERVERS = "nameservers"; + + @SerializedName(SERIALIZED_NAME_NAMESERVERS) + @javax.annotation.Nullable private List nameservers = new ArrayList<>(); + + public UpdateNetworkIPv4Body() {} + + public UpdateNetworkIPv4Body gateway(@javax.annotation.Nullable String gateway) { + this.gateway = gateway; + return this; + } + + /** + * The gateway of a network. If not specified the first IP of the network will be assigned as + * the gateway. If 'null' is sent, then the network doesn't have a gateway. + * + * @return gateway + */ + @javax.annotation.Nullable public String getGateway() { + return gateway; + } + + public void setGateway(@javax.annotation.Nullable String gateway) { + this.gateway = gateway; + } + + public UpdateNetworkIPv4Body nameservers(@javax.annotation.Nullable List nameservers) { + this.nameservers = nameservers; + return this; + } + + public UpdateNetworkIPv4Body addNameserversItem(String nameserversItem) { + if (this.nameservers == null) { + this.nameservers = new ArrayList<>(); + } + this.nameservers.add(nameserversItem); + return this; + } + + /** + * A list containing DNS Servers/Nameservers for IPv4. + * + * @return nameservers + */ + @javax.annotation.Nullable public List getNameservers() { + return nameservers; + } + + public void setNameservers(@javax.annotation.Nullable List nameservers) { + this.nameservers = nameservers; + } + + /** + * 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 UpdateNetworkIPv4Body instance itself + */ + public UpdateNetworkIPv4Body 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; + } + UpdateNetworkIPv4Body updateNetworkIPv4Body = (UpdateNetworkIPv4Body) o; + return Objects.equals(this.gateway, updateNetworkIPv4Body.gateway) + && Objects.equals(this.nameservers, updateNetworkIPv4Body.nameservers) + && Objects.equals( + this.additionalProperties, updateNetworkIPv4Body.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(gateway, nameservers, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateNetworkIPv4Body {\n"); + sb.append(" gateway: ").append(toIndentedString(gateway)).append("\n"); + sb.append(" nameservers: ").append(toIndentedString(nameservers)).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("gateway", "nameservers")); + + // 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 UpdateNetworkIPv4Body + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateNetworkIPv4Body.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 UpdateNetworkIPv4Body is not found in the empty JSON string", + UpdateNetworkIPv4Body.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("gateway") != null && !jsonObj.get("gateway").isJsonNull()) + && !jsonObj.get("gateway").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `gateway` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("gateway").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("nameservers") != null + && !jsonObj.get("nameservers").isJsonNull() + && !jsonObj.get("nameservers").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `nameservers` to be an array in the JSON string but got `%s`", + jsonObj.get("nameservers").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateNetworkIPv4Body.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateNetworkIPv4Body' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateNetworkIPv4Body.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateNetworkIPv4Body 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 UpdateNetworkIPv4Body read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateNetworkIPv4Body 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 UpdateNetworkIPv4Body given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateNetworkIPv4Body + * @throws IOException if the JSON string is invalid with respect to UpdateNetworkIPv4Body + */ + public static UpdateNetworkIPv4Body fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateNetworkIPv4Body.class); + } + + /** + * Convert an instance of UpdateNetworkIPv4Body to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/UpdateNetworkIPv6Body.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/UpdateNetworkIPv6Body.java new file mode 100644 index 00000000..b81dbf4e --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/UpdateNetworkIPv6Body.java @@ -0,0 +1,357 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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.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; +import org.openapitools.jackson.nullable.JsonNullable; + +/** The config object for a IPv6 network update. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class UpdateNetworkIPv6Body { + public static final String SERIALIZED_NAME_GATEWAY = "gateway"; + + @SerializedName(SERIALIZED_NAME_GATEWAY) + @javax.annotation.Nullable private String gateway; + + public static final String SERIALIZED_NAME_NAMESERVERS = "nameservers"; + + @SerializedName(SERIALIZED_NAME_NAMESERVERS) + @javax.annotation.Nullable private List nameservers = new ArrayList<>(); + + public UpdateNetworkIPv6Body() {} + + public UpdateNetworkIPv6Body gateway(@javax.annotation.Nullable String gateway) { + this.gateway = gateway; + return this; + } + + /** + * The gateway of a network. If not specified the first IP of the network will be assigned as + * the gateway. If 'null' is sent, then the network doesn't have a gateway. + * + * @return gateway + */ + @javax.annotation.Nullable public String getGateway() { + return gateway; + } + + public void setGateway(@javax.annotation.Nullable String gateway) { + this.gateway = gateway; + } + + public UpdateNetworkIPv6Body nameservers(@javax.annotation.Nullable List nameservers) { + this.nameservers = nameservers; + return this; + } + + public UpdateNetworkIPv6Body addNameserversItem(String nameserversItem) { + if (this.nameservers == null) { + this.nameservers = new ArrayList<>(); + } + this.nameservers.add(nameserversItem); + return this; + } + + /** + * A list containing DNS Servers/Nameservers for IPv6. + * + * @return nameservers + */ + @javax.annotation.Nullable public List getNameservers() { + return nameservers; + } + + public void setNameservers(@javax.annotation.Nullable List nameservers) { + this.nameservers = nameservers; + } + + /** + * 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 UpdateNetworkIPv6Body instance itself + */ + public UpdateNetworkIPv6Body 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; + } + UpdateNetworkIPv6Body updateNetworkIPv6Body = (UpdateNetworkIPv6Body) o; + return Objects.equals(this.gateway, updateNetworkIPv6Body.gateway) + && Objects.equals(this.nameservers, updateNetworkIPv6Body.nameservers) + && Objects.equals( + this.additionalProperties, updateNetworkIPv6Body.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(gateway, nameservers, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateNetworkIPv6Body {\n"); + sb.append(" gateway: ").append(toIndentedString(gateway)).append("\n"); + sb.append(" nameservers: ").append(toIndentedString(nameservers)).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("gateway", "nameservers")); + + // 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 UpdateNetworkIPv6Body + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateNetworkIPv6Body.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 UpdateNetworkIPv6Body is not found in the empty JSON string", + UpdateNetworkIPv6Body.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("gateway") != null && !jsonObj.get("gateway").isJsonNull()) + && !jsonObj.get("gateway").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `gateway` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("gateway").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("nameservers") != null + && !jsonObj.get("nameservers").isJsonNull() + && !jsonObj.get("nameservers").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `nameservers` to be an array in the JSON string but got `%s`", + jsonObj.get("nameservers").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateNetworkIPv6Body.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateNetworkIPv6Body' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateNetworkIPv6Body.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateNetworkIPv6Body 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 UpdateNetworkIPv6Body read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateNetworkIPv6Body 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 UpdateNetworkIPv6Body given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateNetworkIPv6Body + * @throws IOException if the JSON string is invalid with respect to UpdateNetworkIPv6Body + */ + public static UpdateNetworkIPv6Body fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateNetworkIPv6Body.class); + } + + /** + * Convert an instance of UpdateNetworkIPv6Body to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/UpdateNicPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/UpdateNicPayload.java new file mode 100644 index 00000000..8b1f7575 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/UpdateNicPayload.java @@ -0,0 +1,497 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; +import java.util.UUID; + +/** Object that represents a network interface update. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class UpdateNicPayload { + public static final String SERIALIZED_NAME_ALLOWED_ADDRESSES = "allowedAddresses"; + + @SerializedName(SERIALIZED_NAME_ALLOWED_ADDRESSES) + @javax.annotation.Nullable private List allowedAddresses = new ArrayList<>(); + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable private String description; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; + + public static final String SERIALIZED_NAME_NIC_SECURITY = "nicSecurity"; + + @SerializedName(SERIALIZED_NAME_NIC_SECURITY) + @javax.annotation.Nullable private Boolean nicSecurity; + + public static final String SERIALIZED_NAME_SECURITY_GROUPS = "securityGroups"; + + @SerializedName(SERIALIZED_NAME_SECURITY_GROUPS) + @javax.annotation.Nullable private List securityGroups = new ArrayList<>(); + + public UpdateNicPayload() {} + + public UpdateNicPayload allowedAddresses( + @javax.annotation.Nullable List allowedAddresses) { + this.allowedAddresses = allowedAddresses; + return this; + } + + public UpdateNicPayload addAllowedAddressesItem(AllowedAddressesInner allowedAddressesItem) { + if (this.allowedAddresses == null) { + this.allowedAddresses = new ArrayList<>(); + } + this.allowedAddresses.add(allowedAddressesItem); + return this; + } + + /** + * A list of IPs or CIDR notations. + * + * @return allowedAddresses + */ + @javax.annotation.Nullable public List getAllowedAddresses() { + return allowedAddresses; + } + + public void setAllowedAddresses( + @javax.annotation.Nullable List allowedAddresses) { + this.allowedAddresses = allowedAddresses; + } + + public UpdateNicPayload description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Description Object. Allows string up to 255 Characters. + * + * @return description + */ + @javax.annotation.Nullable public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + public UpdateNicPayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public UpdateNicPayload name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nullable public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + public UpdateNicPayload nicSecurity(@javax.annotation.Nullable Boolean nicSecurity) { + this.nicSecurity = nicSecurity; + return this; + } + + /** + * If this is set to false, then no security groups will apply to this network interface. + * + * @return nicSecurity + */ + @javax.annotation.Nullable public Boolean getNicSecurity() { + return nicSecurity; + } + + public void setNicSecurity(@javax.annotation.Nullable Boolean nicSecurity) { + this.nicSecurity = nicSecurity; + } + + public UpdateNicPayload securityGroups(@javax.annotation.Nullable List securityGroups) { + this.securityGroups = securityGroups; + return this; + } + + public UpdateNicPayload addSecurityGroupsItem(UUID securityGroupsItem) { + if (this.securityGroups == null) { + this.securityGroups = new ArrayList<>(); + } + this.securityGroups.add(securityGroupsItem); + return this; + } + + /** + * A list of UUIDs. + * + * @return securityGroups + */ + @javax.annotation.Nullable public List getSecurityGroups() { + return securityGroups; + } + + public void setSecurityGroups(@javax.annotation.Nullable List securityGroups) { + this.securityGroups = securityGroups; + } + + /** + * 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 UpdateNicPayload instance itself + */ + public UpdateNicPayload 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; + } + UpdateNicPayload updateNicPayload = (UpdateNicPayload) o; + return Objects.equals(this.allowedAddresses, updateNicPayload.allowedAddresses) + && Objects.equals(this.description, updateNicPayload.description) + && Objects.equals(this.labels, updateNicPayload.labels) + && Objects.equals(this.name, updateNicPayload.name) + && Objects.equals(this.nicSecurity, updateNicPayload.nicSecurity) + && Objects.equals(this.securityGroups, updateNicPayload.securityGroups) + && Objects.equals(this.additionalProperties, updateNicPayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + allowedAddresses, + description, + labels, + name, + nicSecurity, + securityGroups, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateNicPayload {\n"); + sb.append(" allowedAddresses: ").append(toIndentedString(allowedAddresses)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" nicSecurity: ").append(toIndentedString(nicSecurity)).append("\n"); + sb.append(" securityGroups: ").append(toIndentedString(securityGroups)).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( + "allowedAddresses", + "description", + "labels", + "name", + "nicSecurity", + "securityGroups")); + + // 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 UpdateNicPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateNicPayload.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 UpdateNicPayload is not found in the empty JSON string", + UpdateNicPayload.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("allowedAddresses") != null + && !jsonObj.get("allowedAddresses").isJsonNull()) { + JsonArray jsonArrayallowedAddresses = jsonObj.getAsJsonArray("allowedAddresses"); + if (jsonArrayallowedAddresses != null) { + // ensure the json data is an array + if (!jsonObj.get("allowedAddresses").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `allowedAddresses` to be an array in the JSON string but got `%s`", + jsonObj.get("allowedAddresses").toString())); + } + + // validate the optional field `allowedAddresses` (array) + for (int i = 0; i < jsonArrayallowedAddresses.size(); i++) { + AllowedAddressesInner.validateJsonElement(jsonArrayallowedAddresses.get(i)); + } + ; + } + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `description` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("description").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `name` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("name").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("securityGroups") != null + && !jsonObj.get("securityGroups").isJsonNull() + && !jsonObj.get("securityGroups").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `securityGroups` to be an array in the JSON string but got `%s`", + jsonObj.get("securityGroups").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateNicPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateNicPayload' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateNicPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateNicPayload 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 UpdateNicPayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateNicPayload 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 UpdateNicPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateNicPayload + * @throws IOException if the JSON string is invalid with respect to UpdateNicPayload + */ + public static UpdateNicPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateNicPayload.class); + } + + /** + * Convert an instance of UpdateNicPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/UpdatePublicIPPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/UpdatePublicIPPayload.java new file mode 100644 index 00000000..c07a28f9 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/UpdatePublicIPPayload.java @@ -0,0 +1,399 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.v1api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Object that represents a public IP. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class UpdatePublicIPPayload { + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_IP = "ip"; + + @SerializedName(SERIALIZED_NAME_IP) + @javax.annotation.Nullable private String ip; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NETWORK_INTERFACE = "networkInterface"; + + @SerializedName(SERIALIZED_NAME_NETWORK_INTERFACE) + @javax.annotation.Nullable private UUID networkInterface; + + public UpdatePublicIPPayload() {} + + public UpdatePublicIPPayload(UUID id, String ip) { + this(); + this.id = id; + this.ip = ip; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + /** + * Object that represents an IP address. + * + * @return ip + */ + @javax.annotation.Nullable public String getIp() { + return ip; + } + + public UpdatePublicIPPayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public UpdatePublicIPPayload networkInterface( + @javax.annotation.Nullable UUID networkInterface) { + this.networkInterface = networkInterface; + return this; + } + + /** + * Associate the public IP with a network interface (ID). + * + * @return networkInterface + */ + @javax.annotation.Nullable public UUID getNetworkInterface() { + return networkInterface; + } + + public void setNetworkInterface(@javax.annotation.Nullable UUID networkInterface) { + this.networkInterface = networkInterface; + } + + /** + * 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 UpdatePublicIPPayload instance itself + */ + public UpdatePublicIPPayload 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; + } + UpdatePublicIPPayload updatePublicIPPayload = (UpdatePublicIPPayload) o; + return Objects.equals(this.id, updatePublicIPPayload.id) + && Objects.equals(this.ip, updatePublicIPPayload.ip) + && Objects.equals(this.labels, updatePublicIPPayload.labels) + && Objects.equals(this.networkInterface, updatePublicIPPayload.networkInterface) + && Objects.equals( + this.additionalProperties, updatePublicIPPayload.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(id, ip, labels, networkInterface, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdatePublicIPPayload {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" ip: ").append(toIndentedString(ip)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" networkInterface: ").append(toIndentedString(networkInterface)).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("id", "ip", "labels", "networkInterface")); + + // 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 UpdatePublicIPPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdatePublicIPPayload.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 UpdatePublicIPPayload is not found in the empty JSON string", + UpdatePublicIPPayload.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if ((jsonObj.get("ip") != null && !jsonObj.get("ip").isJsonNull()) + && !jsonObj.get("ip").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `ip` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("ip").toString())); + } + if ((jsonObj.get("networkInterface") != null + && !jsonObj.get("networkInterface").isJsonNull()) + && !jsonObj.get("networkInterface").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `networkInterface` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("networkInterface").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdatePublicIPPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdatePublicIPPayload' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdatePublicIPPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdatePublicIPPayload 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 UpdatePublicIPPayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdatePublicIPPayload 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 UpdatePublicIPPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdatePublicIPPayload + * @throws IOException if the JSON string is invalid with respect to UpdatePublicIPPayload + */ + public static UpdatePublicIPPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdatePublicIPPayload.class); + } + + /** + * Convert an instance of UpdatePublicIPPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/UpdateSecurityGroupPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/UpdateSecurityGroupPayload.java new file mode 100644 index 00000000..185696f1 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/UpdateSecurityGroupPayload.java @@ -0,0 +1,358 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** Object that represents an update request body of a security group. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class UpdateSecurityGroupPayload { + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable private String description; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; + + public UpdateSecurityGroupPayload() {} + + public UpdateSecurityGroupPayload description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Description Object. Allows string up to 255 Characters. + * + * @return description + */ + @javax.annotation.Nullable public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + public UpdateSecurityGroupPayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public UpdateSecurityGroupPayload name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nullable public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * 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 UpdateSecurityGroupPayload instance itself + */ + public UpdateSecurityGroupPayload 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; + } + UpdateSecurityGroupPayload updateSecurityGroupPayload = (UpdateSecurityGroupPayload) o; + return Objects.equals(this.description, updateSecurityGroupPayload.description) + && Objects.equals(this.labels, updateSecurityGroupPayload.labels) + && Objects.equals(this.name, updateSecurityGroupPayload.name) + && Objects.equals( + this.additionalProperties, updateSecurityGroupPayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(description, labels, name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateSecurityGroupPayload {\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).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("description", "labels", "name")); + + // 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 UpdateSecurityGroupPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateSecurityGroupPayload.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 UpdateSecurityGroupPayload is not found in the empty JSON string", + UpdateSecurityGroupPayload.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `description` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("description").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `name` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateSecurityGroupPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateSecurityGroupPayload' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateSecurityGroupPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateSecurityGroupPayload 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 UpdateSecurityGroupPayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateSecurityGroupPayload 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 UpdateSecurityGroupPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateSecurityGroupPayload + * @throws IOException if the JSON string is invalid with respect to UpdateSecurityGroupPayload + */ + public static UpdateSecurityGroupPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateSecurityGroupPayload.class); + } + + /** + * Convert an instance of UpdateSecurityGroupPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/UpdateServerPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/UpdateServerPayload.java new file mode 100644 index 00000000..b6dea0ce --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/UpdateServerPayload.java @@ -0,0 +1,351 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** Object that represents an update request body of a server. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class UpdateServerPayload { + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_METADATA = "metadata"; + + @SerializedName(SERIALIZED_NAME_METADATA) + @javax.annotation.Nullable private Object metadata; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; + + public UpdateServerPayload() {} + + public UpdateServerPayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public UpdateServerPayload metadata(@javax.annotation.Nullable Object metadata) { + this.metadata = metadata; + return this; + } + + /** + * Object that represents the metadata of an object. Regex for keys: `^[a-zA-Z0-9-_:. + * ]{1,255}$`. Regex for values: `^.{0,255}$`. Providing a `null` value + * for a key will remove that key. + * + * @return metadata + */ + @javax.annotation.Nullable public Object getMetadata() { + return metadata; + } + + public void setMetadata(@javax.annotation.Nullable Object metadata) { + this.metadata = metadata; + } + + public UpdateServerPayload name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The name for a Server. + * + * @return name + */ + @javax.annotation.Nullable public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * 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 UpdateServerPayload instance itself + */ + public UpdateServerPayload 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; + } + UpdateServerPayload updateServerPayload = (UpdateServerPayload) o; + return Objects.equals(this.labels, updateServerPayload.labels) + && Objects.equals(this.metadata, updateServerPayload.metadata) + && Objects.equals(this.name, updateServerPayload.name) + && Objects.equals( + this.additionalProperties, updateServerPayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(labels, metadata, name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateServerPayload {\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("labels", "metadata", "name")); + + // 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 UpdateServerPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateServerPayload.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 UpdateServerPayload is not found in the empty JSON string", + UpdateServerPayload.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `name` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateServerPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateServerPayload' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateServerPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateServerPayload 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 UpdateServerPayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateServerPayload 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 UpdateServerPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateServerPayload + * @throws IOException if the JSON string is invalid with respect to UpdateServerPayload + */ + public static UpdateServerPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateServerPayload.class); + } + + /** + * Convert an instance of UpdateServerPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/UpdateSnapshotPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/UpdateSnapshotPayload.java new file mode 100644 index 00000000..52773beb --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/UpdateSnapshotPayload.java @@ -0,0 +1,357 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** Object that represents an update request body of a snapshot. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class UpdateSnapshotPayload { + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable private String description; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; + + public UpdateSnapshotPayload() {} + + public UpdateSnapshotPayload description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Description Object. Allows string up to 255 Characters. + * + * @return description + */ + @javax.annotation.Nullable public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + public UpdateSnapshotPayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public UpdateSnapshotPayload name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nullable public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * 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 UpdateSnapshotPayload instance itself + */ + public UpdateSnapshotPayload 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; + } + UpdateSnapshotPayload updateSnapshotPayload = (UpdateSnapshotPayload) o; + return Objects.equals(this.description, updateSnapshotPayload.description) + && Objects.equals(this.labels, updateSnapshotPayload.labels) + && Objects.equals(this.name, updateSnapshotPayload.name) + && Objects.equals( + this.additionalProperties, updateSnapshotPayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(description, labels, name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateSnapshotPayload {\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).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("description", "labels", "name")); + + // 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 UpdateSnapshotPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateSnapshotPayload.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 UpdateSnapshotPayload is not found in the empty JSON string", + UpdateSnapshotPayload.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `description` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("description").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `name` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateSnapshotPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateSnapshotPayload' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateSnapshotPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateSnapshotPayload 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 UpdateSnapshotPayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateSnapshotPayload 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 UpdateSnapshotPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateSnapshotPayload + * @throws IOException if the JSON string is invalid with respect to UpdateSnapshotPayload + */ + public static UpdateSnapshotPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateSnapshotPayload.class); + } + + /** + * Convert an instance of UpdateSnapshotPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/UpdateVolumePayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/UpdateVolumePayload.java new file mode 100644 index 00000000..fb1b65ea --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/UpdateVolumePayload.java @@ -0,0 +1,413 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** Object that represents an update request body of a volume. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class UpdateVolumePayload { + public static final String SERIALIZED_NAME_BOOTABLE = "bootable"; + + @SerializedName(SERIALIZED_NAME_BOOTABLE) + @javax.annotation.Nullable private Boolean bootable; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable private String description; + + public static final String SERIALIZED_NAME_IMAGE_CONFIG = "imageConfig"; + + @SerializedName(SERIALIZED_NAME_IMAGE_CONFIG) + @javax.annotation.Nullable private ImageConfig imageConfig; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; + + public UpdateVolumePayload() {} + + public UpdateVolumePayload bootable(@javax.annotation.Nullable Boolean bootable) { + this.bootable = bootable; + return this; + } + + /** + * Indicates if a volume is bootable. + * + * @return bootable + */ + @javax.annotation.Nullable public Boolean getBootable() { + return bootable; + } + + public void setBootable(@javax.annotation.Nullable Boolean bootable) { + this.bootable = bootable; + } + + public UpdateVolumePayload description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Description Object. Allows string up to 255 Characters. + * + * @return description + */ + @javax.annotation.Nullable public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + public UpdateVolumePayload imageConfig(@javax.annotation.Nullable ImageConfig imageConfig) { + this.imageConfig = imageConfig; + return this; + } + + /** + * Get imageConfig + * + * @return imageConfig + */ + @javax.annotation.Nullable public ImageConfig getImageConfig() { + return imageConfig; + } + + public void setImageConfig(@javax.annotation.Nullable ImageConfig imageConfig) { + this.imageConfig = imageConfig; + } + + public UpdateVolumePayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public UpdateVolumePayload name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nullable public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * 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 UpdateVolumePayload instance itself + */ + public UpdateVolumePayload 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; + } + UpdateVolumePayload updateVolumePayload = (UpdateVolumePayload) o; + return Objects.equals(this.bootable, updateVolumePayload.bootable) + && Objects.equals(this.description, updateVolumePayload.description) + && Objects.equals(this.imageConfig, updateVolumePayload.imageConfig) + && Objects.equals(this.labels, updateVolumePayload.labels) + && Objects.equals(this.name, updateVolumePayload.name) + && Objects.equals( + this.additionalProperties, updateVolumePayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(bootable, description, imageConfig, labels, name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateVolumePayload {\n"); + sb.append(" bootable: ").append(toIndentedString(bootable)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" imageConfig: ").append(toIndentedString(imageConfig)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).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("bootable", "description", "imageConfig", "labels", "name")); + + // 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 UpdateVolumePayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateVolumePayload.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 UpdateVolumePayload is not found in the empty JSON string", + UpdateVolumePayload.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `description` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("description").toString())); + } + // validate the optional field `imageConfig` + if (jsonObj.get("imageConfig") != null && !jsonObj.get("imageConfig").isJsonNull()) { + ImageConfig.validateJsonElement(jsonObj.get("imageConfig")); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `name` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateVolumePayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateVolumePayload' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateVolumePayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateVolumePayload 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 UpdateVolumePayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateVolumePayload 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 UpdateVolumePayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateVolumePayload + * @throws IOException if the JSON string is invalid with respect to UpdateVolumePayload + */ + public static UpdateVolumePayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateVolumePayload.class); + } + + /** + * Convert an instance of UpdateVolumePayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/Volume.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/Volume.java new file mode 100644 index 00000000..274469e4 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/Volume.java @@ -0,0 +1,751 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; +import java.util.UUID; + +/** + * Object that represents a volume and its parameters. Volumes sized up to 16000GB are supported. + */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class Volume { + public static final String SERIALIZED_NAME_AVAILABILITY_ZONE = "availabilityZone"; + + @SerializedName(SERIALIZED_NAME_AVAILABILITY_ZONE) + @javax.annotation.Nonnull + private String availabilityZone; + + public static final String SERIALIZED_NAME_BOOTABLE = "bootable"; + + @SerializedName(SERIALIZED_NAME_BOOTABLE) + @javax.annotation.Nullable private Boolean bootable; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable private String description; + + public static final String SERIALIZED_NAME_ENCRYPTED = "encrypted"; + + @SerializedName(SERIALIZED_NAME_ENCRYPTED) + @javax.annotation.Nullable private Boolean encrypted; + + public static final String SERIALIZED_NAME_ENCRYPTION_PARAMETERS = "encryptionParameters"; + + @SerializedName(SERIALIZED_NAME_ENCRYPTION_PARAMETERS) + @javax.annotation.Nullable private VolumeEncryptionParameter encryptionParameters; + + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_IMAGE_CONFIG = "imageConfig"; + + @SerializedName(SERIALIZED_NAME_IMAGE_CONFIG) + @javax.annotation.Nullable private ImageConfig imageConfig; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; + + public static final String SERIALIZED_NAME_PERFORMANCE_CLASS = "performanceClass"; + + @SerializedName(SERIALIZED_NAME_PERFORMANCE_CLASS) + @javax.annotation.Nullable private String performanceClass; + + public static final String SERIALIZED_NAME_SERVER_ID = "serverId"; + + @SerializedName(SERIALIZED_NAME_SERVER_ID) + @javax.annotation.Nullable private UUID serverId; + + public static final String SERIALIZED_NAME_SIZE = "size"; + + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nullable private Long size; + + public static final String SERIALIZED_NAME_SOURCE = "source"; + + @SerializedName(SERIALIZED_NAME_SOURCE) + @javax.annotation.Nullable private VolumeSource source; + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable private String status; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable private OffsetDateTime updatedAt; + + public Volume() {} + + public Volume( + OffsetDateTime createdAt, + Boolean encrypted, + UUID id, + ImageConfig imageConfig, + UUID serverId, + String status, + OffsetDateTime updatedAt) { + this(); + this.createdAt = createdAt; + this.encrypted = encrypted; + this.id = id; + this.imageConfig = imageConfig; + this.serverId = serverId; + this.status = status; + this.updatedAt = updatedAt; + } + + public Volume availabilityZone(@javax.annotation.Nonnull String availabilityZone) { + this.availabilityZone = availabilityZone; + return this; + } + + /** + * Object that represents an availability zone. + * + * @return availabilityZone + */ + @javax.annotation.Nonnull + public String getAvailabilityZone() { + return availabilityZone; + } + + public void setAvailabilityZone(@javax.annotation.Nonnull String availabilityZone) { + this.availabilityZone = availabilityZone; + } + + public Volume bootable(@javax.annotation.Nullable Boolean bootable) { + this.bootable = bootable; + return this; + } + + /** + * Indicates if a volume is bootable. + * + * @return bootable + */ + @javax.annotation.Nullable public Boolean getBootable() { + return bootable; + } + + public void setBootable(@javax.annotation.Nullable Boolean bootable) { + this.bootable = bootable; + } + + /** + * Date-time when resource was created. + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public Volume description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Description Object. Allows string up to 255 Characters. + * + * @return description + */ + @javax.annotation.Nullable public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + /** + * Indicates if a volume is encrypted. + * + * @return encrypted + */ + @javax.annotation.Nullable public Boolean getEncrypted() { + return encrypted; + } + + public Volume encryptionParameters( + @javax.annotation.Nullable VolumeEncryptionParameter encryptionParameters) { + this.encryptionParameters = encryptionParameters; + return this; + } + + /** + * Get encryptionParameters + * + * @return encryptionParameters + */ + @javax.annotation.Nullable public VolumeEncryptionParameter getEncryptionParameters() { + return encryptionParameters; + } + + public void setEncryptionParameters( + @javax.annotation.Nullable VolumeEncryptionParameter encryptionParameters) { + this.encryptionParameters = encryptionParameters; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + /** + * Get imageConfig + * + * @return imageConfig + */ + @javax.annotation.Nullable public ImageConfig getImageConfig() { + return imageConfig; + } + + public Volume labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public Volume name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nullable public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + public Volume performanceClass(@javax.annotation.Nullable String performanceClass) { + this.performanceClass = performanceClass; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return performanceClass + */ + @javax.annotation.Nullable public String getPerformanceClass() { + return performanceClass; + } + + public void setPerformanceClass(@javax.annotation.Nullable String performanceClass) { + this.performanceClass = performanceClass; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return serverId + */ + @javax.annotation.Nullable public UUID getServerId() { + return serverId; + } + + public Volume size(@javax.annotation.Nullable Long size) { + this.size = size; + return this; + } + + /** + * Size in Gigabyte. + * + * @return size + */ + @javax.annotation.Nullable public Long getSize() { + return size; + } + + public void setSize(@javax.annotation.Nullable Long size) { + this.size = size; + } + + public Volume source(@javax.annotation.Nullable VolumeSource source) { + this.source = source; + return this; + } + + /** + * Get source + * + * @return source + */ + @javax.annotation.Nullable public VolumeSource getSource() { + return source; + } + + public void setSource(@javax.annotation.Nullable VolumeSource source) { + this.source = source; + } + + /** + * The status of a volume object. Possible values: `ATTACHED`, `ATTACHING`, + * `AVAILABLE`, `AWAITING-TRANSFER`, `BACKING-UP`, + * `CREATING`, `DELETED`, `DELETING`, `DETACHING`, + * `DOWNLOADING`, `ERROR`, `ERROR_BACKING-UP`, + * `ERROR_DELETING`, `ERROR_RESIZING`, `ERROR_RESTORING-BACKUP`, + * `MAINTENANCE`, `RESERVED`, `RESIZING`, + * `RESTORING-BACKUP`, `RETYPING`, `UPLOADING`. + * + * @return status + */ + @javax.annotation.Nullable public String getStatus() { + return status; + } + + /** + * Date-time when resource was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nullable public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * 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 Volume instance itself + */ + public Volume 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; + } + Volume volume = (Volume) o; + return Objects.equals(this.availabilityZone, volume.availabilityZone) + && Objects.equals(this.bootable, volume.bootable) + && Objects.equals(this.createdAt, volume.createdAt) + && Objects.equals(this.description, volume.description) + && Objects.equals(this.encrypted, volume.encrypted) + && Objects.equals(this.encryptionParameters, volume.encryptionParameters) + && Objects.equals(this.id, volume.id) + && Objects.equals(this.imageConfig, volume.imageConfig) + && Objects.equals(this.labels, volume.labels) + && Objects.equals(this.name, volume.name) + && Objects.equals(this.performanceClass, volume.performanceClass) + && Objects.equals(this.serverId, volume.serverId) + && Objects.equals(this.size, volume.size) + && Objects.equals(this.source, volume.source) + && Objects.equals(this.status, volume.status) + && Objects.equals(this.updatedAt, volume.updatedAt) + && Objects.equals(this.additionalProperties, volume.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + availabilityZone, + bootable, + createdAt, + description, + encrypted, + encryptionParameters, + id, + imageConfig, + labels, + name, + performanceClass, + serverId, + size, + source, + status, + updatedAt, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Volume {\n"); + sb.append(" availabilityZone: ").append(toIndentedString(availabilityZone)).append("\n"); + sb.append(" bootable: ").append(toIndentedString(bootable)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" encrypted: ").append(toIndentedString(encrypted)).append("\n"); + sb.append(" encryptionParameters: ") + .append(toIndentedString(encryptionParameters)) + .append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" imageConfig: ").append(toIndentedString(imageConfig)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" performanceClass: ").append(toIndentedString(performanceClass)).append("\n"); + sb.append(" serverId: ").append(toIndentedString(serverId)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" source: ").append(toIndentedString(source)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).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( + "availabilityZone", + "bootable", + "createdAt", + "description", + "encrypted", + "encryptionParameters", + "id", + "imageConfig", + "labels", + "name", + "performanceClass", + "serverId", + "size", + "source", + "status", + "updatedAt")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("availabilityZone")); + } + + /** + * 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 Volume + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Volume.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 Volume is not found in the empty JSON string", + Volume.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Volume.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("availabilityZone").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `availabilityZone` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("availabilityZone").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `description` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("description").toString())); + } + // validate the optional field `encryptionParameters` + if (jsonObj.get("encryptionParameters") != null + && !jsonObj.get("encryptionParameters").isJsonNull()) { + VolumeEncryptionParameter.validateJsonElement(jsonObj.get("encryptionParameters")); + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + // validate the optional field `imageConfig` + if (jsonObj.get("imageConfig") != null && !jsonObj.get("imageConfig").isJsonNull()) { + ImageConfig.validateJsonElement(jsonObj.get("imageConfig")); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `name` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("name").toString())); + } + if ((jsonObj.get("performanceClass") != null + && !jsonObj.get("performanceClass").isJsonNull()) + && !jsonObj.get("performanceClass").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `performanceClass` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("performanceClass").toString())); + } + if ((jsonObj.get("serverId") != null && !jsonObj.get("serverId").isJsonNull()) + && !jsonObj.get("serverId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `serverId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("serverId").toString())); + } + // validate the optional field `source` + if (jsonObj.get("source") != null && !jsonObj.get("source").isJsonNull()) { + VolumeSource.validateJsonElement(jsonObj.get("source")); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) + && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `status` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("status").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Volume.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Volume' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(Volume.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, Volume 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 Volume read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Volume 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 Volume given an JSON string + * + * @param jsonString JSON string + * @return An instance of Volume + * @throws IOException if the JSON string is invalid with respect to Volume + */ + public static Volume fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Volume.class); + } + + /** + * Convert an instance of Volume to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/VolumeAttachment.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/VolumeAttachment.java new file mode 100644 index 00000000..2ac2206d --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/VolumeAttachment.java @@ -0,0 +1,345 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.v1api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +/** Object that represents a Volume attachment to a server. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class VolumeAttachment { + public static final String SERIALIZED_NAME_DELETE_ON_TERMINATION = "deleteOnTermination"; + + @SerializedName(SERIALIZED_NAME_DELETE_ON_TERMINATION) + @javax.annotation.Nullable private Boolean deleteOnTermination; + + public static final String SERIALIZED_NAME_SERVER_ID = "serverId"; + + @SerializedName(SERIALIZED_NAME_SERVER_ID) + @javax.annotation.Nullable private UUID serverId; + + public static final String SERIALIZED_NAME_VOLUME_ID = "volumeId"; + + @SerializedName(SERIALIZED_NAME_VOLUME_ID) + @javax.annotation.Nullable private UUID volumeId; + + public VolumeAttachment() {} + + public VolumeAttachment(UUID serverId, UUID volumeId) { + this(); + this.serverId = serverId; + this.volumeId = volumeId; + } + + public VolumeAttachment deleteOnTermination( + @javax.annotation.Nullable Boolean deleteOnTermination) { + this.deleteOnTermination = deleteOnTermination; + return this; + } + + /** + * Delete the volume during the termination of the server. Defaults to false. + * + * @return deleteOnTermination + */ + @javax.annotation.Nullable public Boolean getDeleteOnTermination() { + return deleteOnTermination; + } + + public void setDeleteOnTermination(@javax.annotation.Nullable Boolean deleteOnTermination) { + this.deleteOnTermination = deleteOnTermination; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return serverId + */ + @javax.annotation.Nullable public UUID getServerId() { + return serverId; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return volumeId + */ + @javax.annotation.Nullable public UUID getVolumeId() { + return volumeId; + } + + /** + * 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 VolumeAttachment instance itself + */ + public VolumeAttachment 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; + } + VolumeAttachment volumeAttachment = (VolumeAttachment) o; + return Objects.equals(this.deleteOnTermination, volumeAttachment.deleteOnTermination) + && Objects.equals(this.serverId, volumeAttachment.serverId) + && Objects.equals(this.volumeId, volumeAttachment.volumeId) + && Objects.equals(this.additionalProperties, volumeAttachment.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(deleteOnTermination, serverId, volumeId, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VolumeAttachment {\n"); + sb.append(" deleteOnTermination: ") + .append(toIndentedString(deleteOnTermination)) + .append("\n"); + sb.append(" serverId: ").append(toIndentedString(serverId)).append("\n"); + sb.append(" volumeId: ").append(toIndentedString(volumeId)).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("deleteOnTermination", "serverId", "volumeId")); + + // 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 VolumeAttachment + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VolumeAttachment.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 VolumeAttachment is not found in the empty JSON string", + VolumeAttachment.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("serverId") != null && !jsonObj.get("serverId").isJsonNull()) + && !jsonObj.get("serverId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `serverId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("serverId").toString())); + } + if ((jsonObj.get("volumeId") != null && !jsonObj.get("volumeId").isJsonNull()) + && !jsonObj.get("volumeId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `volumeId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("volumeId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VolumeAttachment.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'VolumeAttachment' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(VolumeAttachment.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, VolumeAttachment 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 VolumeAttachment read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + VolumeAttachment 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 VolumeAttachment given an JSON string + * + * @param jsonString JSON string + * @return An instance of VolumeAttachment + * @throws IOException if the JSON string is invalid with respect to VolumeAttachment + */ + public static VolumeAttachment fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, VolumeAttachment.class); + } + + /** + * Convert an instance of VolumeAttachment to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/VolumeAttachmentListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/VolumeAttachmentListResponse.java new file mode 100644 index 00000000..fb749784 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/VolumeAttachmentListResponse.java @@ -0,0 +1,334 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** Volume attachment list response. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class VolumeAttachmentListResponse { + public static final String SERIALIZED_NAME_ITEMS = "items"; + + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public VolumeAttachmentListResponse() {} + + public VolumeAttachmentListResponse items( + @javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public VolumeAttachmentListResponse addItemsItem(VolumeAttachment itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list containing Volume attachments of a server. + * + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the VolumeAttachmentListResponse instance itself + */ + public VolumeAttachmentListResponse 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; + } + VolumeAttachmentListResponse volumeAttachmentListResponse = + (VolumeAttachmentListResponse) o; + return Objects.equals(this.items, volumeAttachmentListResponse.items) + && Objects.equals( + this.additionalProperties, + volumeAttachmentListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VolumeAttachmentListResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("items")); + } + + /** + * 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 + * VolumeAttachmentListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VolumeAttachmentListResponse.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 VolumeAttachmentListResponse is not found in the empty JSON string", + VolumeAttachmentListResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : VolumeAttachmentListResponse.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("items").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `items` to be an array in the JSON string but got `%s`", + jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + VolumeAttachment.validateJsonElement(jsonArrayitems.get(i)); + } + ; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VolumeAttachmentListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'VolumeAttachmentListResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(VolumeAttachmentListResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, VolumeAttachmentListResponse 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 VolumeAttachmentListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + VolumeAttachmentListResponse 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 VolumeAttachmentListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of VolumeAttachmentListResponse + * @throws IOException if the JSON string is invalid with respect to + * VolumeAttachmentListResponse + */ + public static VolumeAttachmentListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, VolumeAttachmentListResponse.class); + } + + /** + * Convert an instance of VolumeAttachmentListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/VolumeEncryptionParameter.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/VolumeEncryptionParameter.java new file mode 100644 index 00000000..38419791 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/VolumeEncryptionParameter.java @@ -0,0 +1,491 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.v1api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +/** + * Parameter to connect to a key-encryption-key within the STACKIT-KMS to create encrypted volumes. + * If no key_payload is set, a random passphrase is generated, which will be encrypted against the + * STACKIT-KMS. These parameter never leave the backend again. So these parameters are not in the + * responses. + */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class VolumeEncryptionParameter { + public static final String SERIALIZED_NAME_KEK_KEY_ID = "kekKeyId"; + + @SerializedName(SERIALIZED_NAME_KEK_KEY_ID) + @javax.annotation.Nonnull + private UUID kekKeyId; + + public static final String SERIALIZED_NAME_KEK_KEY_VERSION = "kekKeyVersion"; + + @SerializedName(SERIALIZED_NAME_KEK_KEY_VERSION) + @javax.annotation.Nonnull + private Long kekKeyVersion; + + public static final String SERIALIZED_NAME_KEK_KEYRING_ID = "kekKeyringId"; + + @SerializedName(SERIALIZED_NAME_KEK_KEYRING_ID) + @javax.annotation.Nonnull + private UUID kekKeyringId; + + public static final String SERIALIZED_NAME_KEK_PROJECT_ID = "kekProjectId"; + + @SerializedName(SERIALIZED_NAME_KEK_PROJECT_ID) + @javax.annotation.Nullable private UUID kekProjectId; + + public static final String SERIALIZED_NAME_KEY_PAYLOAD = "keyPayload"; + + @SerializedName(SERIALIZED_NAME_KEY_PAYLOAD) + @javax.annotation.Nullable private byte[] keyPayload; + + public static final String SERIALIZED_NAME_SERVICE_ACCOUNT = "serviceAccount"; + + @SerializedName(SERIALIZED_NAME_SERVICE_ACCOUNT) + @javax.annotation.Nonnull + private String serviceAccount; + + public VolumeEncryptionParameter() {} + + public VolumeEncryptionParameter kekKeyId(@javax.annotation.Nonnull UUID kekKeyId) { + this.kekKeyId = kekKeyId; + return this; + } + + /** + * UUID of the Key within the STACKIT-KMS to use for the encryption. + * + * @return kekKeyId + */ + @javax.annotation.Nonnull + public UUID getKekKeyId() { + return kekKeyId; + } + + public void setKekKeyId(@javax.annotation.Nonnull UUID kekKeyId) { + this.kekKeyId = kekKeyId; + } + + public VolumeEncryptionParameter kekKeyVersion(@javax.annotation.Nonnull Long kekKeyVersion) { + this.kekKeyVersion = kekKeyVersion; + return this; + } + + /** + * Version of the key within the STACKIT-KMS to use for the encryption. + * + * @return kekKeyVersion + */ + @javax.annotation.Nonnull + public Long getKekKeyVersion() { + return kekKeyVersion; + } + + public void setKekKeyVersion(@javax.annotation.Nonnull Long kekKeyVersion) { + this.kekKeyVersion = kekKeyVersion; + } + + public VolumeEncryptionParameter kekKeyringId(@javax.annotation.Nonnull UUID kekKeyringId) { + this.kekKeyringId = kekKeyringId; + return this; + } + + /** + * UUID of the keyring where the key is located within the STACKTI-KMS. + * + * @return kekKeyringId + */ + @javax.annotation.Nonnull + public UUID getKekKeyringId() { + return kekKeyringId; + } + + public void setKekKeyringId(@javax.annotation.Nonnull UUID kekKeyringId) { + this.kekKeyringId = kekKeyringId; + } + + public VolumeEncryptionParameter kekProjectId(@javax.annotation.Nullable UUID kekProjectId) { + this.kekProjectId = kekProjectId; + return this; + } + + /** + * Id of the project, where the key in the STACKIT-KMS belongs to, in case the key is located in + * a different project. By default the same project ID is used, like for the volume itself. + * Defining a key in a different project is only allowed for privileged internal projects. + * + * @return kekProjectId + */ + @javax.annotation.Nullable public UUID getKekProjectId() { + return kekProjectId; + } + + public void setKekProjectId(@javax.annotation.Nullable UUID kekProjectId) { + this.kekProjectId = kekProjectId; + } + + public VolumeEncryptionParameter keyPayload(@javax.annotation.Nullable byte[] keyPayload) { + this.keyPayload = keyPayload; + return this; + } + + /** + * Optional predefined secret, which will be encrypted against the key-encryption-key within the + * STACKIT-KMS. If not defined, a random secret will be generated by the API and encrypted + * against the STACKIT-KMS. If a key-payload is provided here, it must be base64 encoded. + * + * @return keyPayload + */ + @javax.annotation.Nullable public byte[] getKeyPayload() { + return keyPayload; + } + + public void setKeyPayload(@javax.annotation.Nullable byte[] keyPayload) { + this.keyPayload = keyPayload; + } + + public VolumeEncryptionParameter serviceAccount( + @javax.annotation.Nonnull String serviceAccount) { + this.serviceAccount = serviceAccount; + return this; + } + + /** + * Service-Account linked to the Key within the STACKIT-KMS. + * + * @return serviceAccount + */ + @javax.annotation.Nonnull + public String getServiceAccount() { + return serviceAccount; + } + + public void setServiceAccount(@javax.annotation.Nonnull String serviceAccount) { + this.serviceAccount = serviceAccount; + } + + /** + * 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 VolumeEncryptionParameter instance itself + */ + public VolumeEncryptionParameter 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; + } + VolumeEncryptionParameter volumeEncryptionParameter = (VolumeEncryptionParameter) o; + return Objects.equals(this.kekKeyId, volumeEncryptionParameter.kekKeyId) + && Objects.equals(this.kekKeyVersion, volumeEncryptionParameter.kekKeyVersion) + && Objects.equals(this.kekKeyringId, volumeEncryptionParameter.kekKeyringId) + && Objects.equals(this.kekProjectId, volumeEncryptionParameter.kekProjectId) + && Arrays.equals(this.keyPayload, volumeEncryptionParameter.keyPayload) + && Objects.equals(this.serviceAccount, volumeEncryptionParameter.serviceAccount) + && Objects.equals( + this.additionalProperties, volumeEncryptionParameter.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + kekKeyId, + kekKeyVersion, + kekKeyringId, + kekProjectId, + Arrays.hashCode(keyPayload), + serviceAccount, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VolumeEncryptionParameter {\n"); + sb.append(" kekKeyId: ").append(toIndentedString(kekKeyId)).append("\n"); + sb.append(" kekKeyVersion: ").append(toIndentedString(kekKeyVersion)).append("\n"); + sb.append(" kekKeyringId: ").append(toIndentedString(kekKeyringId)).append("\n"); + sb.append(" kekProjectId: ").append(toIndentedString(kekProjectId)).append("\n"); + sb.append(" keyPayload: ").append(toIndentedString(keyPayload)).append("\n"); + sb.append(" serviceAccount: ").append(toIndentedString(serviceAccount)).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( + "kekKeyId", + "kekKeyVersion", + "kekKeyringId", + "kekProjectId", + "keyPayload", + "serviceAccount")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = + new HashSet( + Arrays.asList( + "kekKeyId", "kekKeyVersion", "kekKeyringId", "serviceAccount")); + } + + /** + * 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 VolumeEncryptionParameter + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VolumeEncryptionParameter.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 VolumeEncryptionParameter is not found in the empty JSON string", + VolumeEncryptionParameter.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : VolumeEncryptionParameter.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("kekKeyId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `kekKeyId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("kekKeyId").toString())); + } + if (!jsonObj.get("kekKeyringId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `kekKeyringId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("kekKeyringId").toString())); + } + if ((jsonObj.get("kekProjectId") != null && !jsonObj.get("kekProjectId").isJsonNull()) + && !jsonObj.get("kekProjectId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `kekProjectId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("kekProjectId").toString())); + } + if (!jsonObj.get("serviceAccount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `serviceAccount` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("serviceAccount").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VolumeEncryptionParameter.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'VolumeEncryptionParameter' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(VolumeEncryptionParameter.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, VolumeEncryptionParameter 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 VolumeEncryptionParameter read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + VolumeEncryptionParameter 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 VolumeEncryptionParameter given an JSON string + * + * @param jsonString JSON string + * @return An instance of VolumeEncryptionParameter + * @throws IOException if the JSON string is invalid with respect to VolumeEncryptionParameter + */ + public static VolumeEncryptionParameter fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, VolumeEncryptionParameter.class); + } + + /** + * Convert an instance of VolumeEncryptionParameter to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/VolumeListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/VolumeListResponse.java new file mode 100644 index 00000000..3a604548 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/VolumeListResponse.java @@ -0,0 +1,326 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** Volume list response. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class VolumeListResponse { + public static final String SERIALIZED_NAME_ITEMS = "items"; + + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public VolumeListResponse() {} + + public VolumeListResponse items(@javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public VolumeListResponse addItemsItem(Volume itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list containing volume objects. + * + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the VolumeListResponse instance itself + */ + public VolumeListResponse 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; + } + VolumeListResponse volumeListResponse = (VolumeListResponse) o; + return Objects.equals(this.items, volumeListResponse.items) + && Objects.equals( + this.additionalProperties, volumeListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VolumeListResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("items")); + } + + /** + * 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 VolumeListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VolumeListResponse.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 VolumeListResponse is not found in the empty JSON string", + VolumeListResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : VolumeListResponse.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("items").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `items` to be an array in the JSON string but got `%s`", + jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + Volume.validateJsonElement(jsonArrayitems.get(i)); + } + ; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VolumeListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'VolumeListResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(VolumeListResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, VolumeListResponse 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 VolumeListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + VolumeListResponse 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 VolumeListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of VolumeListResponse + * @throws IOException if the JSON string is invalid with respect to VolumeListResponse + */ + public static VolumeListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, VolumeListResponse.class); + } + + /** + * Convert an instance of VolumeListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/VolumePerformanceClass.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/VolumePerformanceClass.java new file mode 100644 index 00000000..476870bf --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/VolumePerformanceClass.java @@ -0,0 +1,422 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** Object that represents a Volume performance class. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class VolumePerformanceClass { + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable private String description; + + public static final String SERIALIZED_NAME_IOPS = "iops"; + + @SerializedName(SERIALIZED_NAME_IOPS) + @javax.annotation.Nullable private Long iops; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_THROUGHPUT = "throughput"; + + @SerializedName(SERIALIZED_NAME_THROUGHPUT) + @javax.annotation.Nullable private Long throughput; + + public VolumePerformanceClass() {} + + public VolumePerformanceClass description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Description Object. Allows string up to 255 Characters. + * + * @return description + */ + @javax.annotation.Nullable public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + public VolumePerformanceClass iops(@javax.annotation.Nullable Long iops) { + this.iops = iops; + return this; + } + + /** + * Input/Output Operations per second. + * + * @return iops + */ + @javax.annotation.Nullable public Long getIops() { + return iops; + } + + public void setIops(@javax.annotation.Nullable Long iops) { + this.iops = iops; + } + + public VolumePerformanceClass labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public VolumePerformanceClass name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + public VolumePerformanceClass throughput(@javax.annotation.Nullable Long throughput) { + this.throughput = throughput; + return this; + } + + /** + * Throughput in Megabyte per second. + * + * @return throughput + */ + @javax.annotation.Nullable public Long getThroughput() { + return throughput; + } + + public void setThroughput(@javax.annotation.Nullable Long throughput) { + this.throughput = throughput; + } + + /** + * 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 VolumePerformanceClass instance itself + */ + public VolumePerformanceClass 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; + } + VolumePerformanceClass volumePerformanceClass = (VolumePerformanceClass) o; + return Objects.equals(this.description, volumePerformanceClass.description) + && Objects.equals(this.iops, volumePerformanceClass.iops) + && Objects.equals(this.labels, volumePerformanceClass.labels) + && Objects.equals(this.name, volumePerformanceClass.name) + && Objects.equals(this.throughput, volumePerformanceClass.throughput) + && Objects.equals( + this.additionalProperties, volumePerformanceClass.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(description, iops, labels, name, throughput, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VolumePerformanceClass {\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" iops: ").append(toIndentedString(iops)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" throughput: ").append(toIndentedString(throughput)).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("description", "iops", "labels", "name", "throughput")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name")); + } + + /** + * 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 VolumePerformanceClass + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VolumePerformanceClass.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 VolumePerformanceClass is not found in the empty JSON string", + VolumePerformanceClass.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : VolumePerformanceClass.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("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `description` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("description").toString())); + } + if (!jsonObj.get("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())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VolumePerformanceClass.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'VolumePerformanceClass' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(VolumePerformanceClass.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, VolumePerformanceClass 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 VolumePerformanceClass read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + VolumePerformanceClass 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 VolumePerformanceClass given an JSON string + * + * @param jsonString JSON string + * @return An instance of VolumePerformanceClass + * @throws IOException if the JSON string is invalid with respect to VolumePerformanceClass + */ + public static VolumePerformanceClass fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, VolumePerformanceClass.class); + } + + /** + * Convert an instance of VolumePerformanceClass to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/VolumePerformanceClassListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/VolumePerformanceClassListResponse.java new file mode 100644 index 00000000..8c394f2c --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/VolumePerformanceClassListResponse.java @@ -0,0 +1,337 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.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; + +/** Volume performance class list response. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class VolumePerformanceClassListResponse { + public static final String SERIALIZED_NAME_ITEMS = "items"; + + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public VolumePerformanceClassListResponse() {} + + public VolumePerformanceClassListResponse items( + @javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public VolumePerformanceClassListResponse addItemsItem(VolumePerformanceClass itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list containing Volume performance classes. + * + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the VolumePerformanceClassListResponse instance itself + */ + public VolumePerformanceClassListResponse 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; + } + VolumePerformanceClassListResponse volumePerformanceClassListResponse = + (VolumePerformanceClassListResponse) o; + return Objects.equals(this.items, volumePerformanceClassListResponse.items) + && Objects.equals( + this.additionalProperties, + volumePerformanceClassListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VolumePerformanceClassListResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("items")); + } + + /** + * 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 + * VolumePerformanceClassListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VolumePerformanceClassListResponse.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 VolumePerformanceClassListResponse is not found in the empty JSON string", + VolumePerformanceClassListResponse.openapiRequiredFields + .toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : VolumePerformanceClassListResponse.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("items").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `items` to be an array in the JSON string but got `%s`", + jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + VolumePerformanceClass.validateJsonElement(jsonArrayitems.get(i)); + } + ; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VolumePerformanceClassListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'VolumePerformanceClassListResponse' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(VolumePerformanceClassListResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, VolumePerformanceClassListResponse 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 VolumePerformanceClassListResponse read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + VolumePerformanceClassListResponse 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 VolumePerformanceClassListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of VolumePerformanceClassListResponse + * @throws IOException if the JSON string is invalid with respect to + * VolumePerformanceClassListResponse + */ + public static VolumePerformanceClassListResponse fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, VolumePerformanceClassListResponse.class); + } + + /** + * Convert an instance of VolumePerformanceClassListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/VolumeSource.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/VolumeSource.java new file mode 100644 index 00000000..d91cbd65 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v1api/model/VolumeSource.java @@ -0,0 +1,342 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v1api.model; + +import cloud.stackit.sdk.iaas.v1api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +/** The source object of a volume. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class VolumeSource { + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private UUID id; + + public static final String SERIALIZED_NAME_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private String type; + + public VolumeSource() {} + + public VolumeSource id(@javax.annotation.Nonnull UUID id) { + this.id = id; + return this; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nonnull + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull UUID id) { + this.id = id; + } + + public VolumeSource type(@javax.annotation.Nonnull String type) { + this.type = type; + return this; + } + + /** + * The source types of a volume. Possible values: `image`, `volume`, + * `snapshot`, `backup`. + * + * @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 VolumeSource instance itself + */ + public VolumeSource 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; + } + VolumeSource volumeSource = (VolumeSource) o; + return Objects.equals(this.id, volumeSource.id) + && Objects.equals(this.type, volumeSource.type) + && Objects.equals(this.additionalProperties, volumeSource.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VolumeSource {\n"); + sb.append(" id: ").append(toIndentedString(id)).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("id", "type")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("id", "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 VolumeSource + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VolumeSource.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 VolumeSource is not found in the empty JSON string", + VolumeSource.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : VolumeSource.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("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if (!jsonObj.get("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 (!VolumeSource.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'VolumeSource' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(VolumeSource.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, VolumeSource 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 VolumeSource read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + VolumeSource 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 VolumeSource given an JSON string + * + * @param jsonString JSON string + * @return An instance of VolumeSource + * @throws IOException if the JSON string is invalid with respect to VolumeSource + */ + public static VolumeSource fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, VolumeSource.class); + } + + /** + * Convert an instance of VolumeSource to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/ApiCallback.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/ApiCallback.java new file mode 100644 index 00000000..a39eba1d --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/ApiCallback.java @@ -0,0 +1,60 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2alpha1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2alpha1api; + +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/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/ApiClient.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/ApiClient.java new file mode 100644 index 00000000..4c7c7955 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/ApiClient.java @@ -0,0 +1,1600 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2alpha1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2alpha1api; + +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://iaas.api.stackit.cloud"; + protected List servers = + new ArrayList( + Arrays.asList( + new ServerConfiguration( + "https://iaas.api.stackit.cloud", + "No description provided", + new HashMap() { + { + put( + "region", + new ServerVariable( + "No description provided", + "global", + new HashSet())); + } + }))); + 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/iaas"); + } + + /** + * Get base path + * + * @return Base path + */ + public String getBasePath() { + return basePath; + } + + /** + * Set base path + * + * @param basePath Base path of the URL (e.g https://iaas.api.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.iaas.v2alpha1api.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.iaas.v2alpha1api.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.iaas.v2alpha1api.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.iaas.v2alpha1api.ApiClient} object + */ + public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { + JSON.setLocalDateFormat(dateFormat); + return this; + } + + /** + * Set LenientOnJson. + * + * @param lenientOnJson a boolean + * @return a {@link cloud.stackit.sdk.iaas.v2alpha1api.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/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/ApiResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/ApiResponse.java new file mode 100644 index 00000000..b05ee68f --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/ApiResponse.java @@ -0,0 +1,73 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2alpha1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2alpha1api; + +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/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/GzipRequestInterceptor.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/GzipRequestInterceptor.java new file mode 100644 index 00000000..d5e0fd5a --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/GzipRequestInterceptor.java @@ -0,0 +1,87 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2alpha1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2alpha1api; + +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/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/JSON.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/JSON.java new file mode 100644 index 00000000..cf8b027e --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/JSON.java @@ -0,0 +1,581 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2alpha1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2alpha1api; + +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 io.gsonfire.TypeSelector; +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.HashMap; +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() + .registerTypeSelector( + cloud.stackit.sdk.iaas.v2alpha1api.model.RouteDestination.class, + new TypeSelector< + cloud.stackit.sdk.iaas.v2alpha1api.model + .RouteDestination>() { + @Override + public Class< + ? extends + cloud.stackit.sdk.iaas.v2alpha1api.model + .RouteDestination> + getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = + new HashMap(); + classByDiscriminatorValue.put( + "cidrv4", + cloud.stackit.sdk.iaas.v2alpha1api.model + .DestinationCIDRv4.class); + classByDiscriminatorValue.put( + "cidrv6", + cloud.stackit.sdk.iaas.v2alpha1api.model + .DestinationCIDRv6.class); + classByDiscriminatorValue.put( + "Route_destination", + cloud.stackit.sdk.iaas.v2alpha1api.model + .RouteDestination.class); + return getClassByDiscriminator( + classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector( + cloud.stackit.sdk.iaas.v2alpha1api.model.RouteNexthop.class, + new TypeSelector< + cloud.stackit.sdk.iaas.v2alpha1api.model.RouteNexthop>() { + @Override + public Class< + ? extends + cloud.stackit.sdk.iaas.v2alpha1api.model + .RouteNexthop> + getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = + new HashMap(); + classByDiscriminatorValue.put( + "blackhole", + cloud.stackit.sdk.iaas.v2alpha1api.model + .NexthopBlackhole.class); + classByDiscriminatorValue.put( + "internet", + cloud.stackit.sdk.iaas.v2alpha1api.model + .NexthopInternet.class); + classByDiscriminatorValue.put( + "ipv4", + cloud.stackit.sdk.iaas.v2alpha1api.model.NexthopIPv4 + .class); + classByDiscriminatorValue.put( + "ipv6", + cloud.stackit.sdk.iaas.v2alpha1api.model.NexthopIPv6 + .class); + classByDiscriminatorValue.put( + "Route_nexthop", + cloud.stackit.sdk.iaas.v2alpha1api.model + .RouteNexthop.class); + return getClassByDiscriminator( + classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }); + 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.iaas.v2alpha1api.model.AddRoutesToRoutingTablePayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2alpha1api.model.AddRoutingTableToAreaPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2alpha1api.model.CreateNetworkIPv4 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2alpha1api.model.CreateNetworkIPv4WithPrefix + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2alpha1api.model.CreateNetworkIPv4WithPrefixLength + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2alpha1api.model.CreateNetworkIPv6 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2alpha1api.model.CreateNetworkIPv6WithPrefix + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2alpha1api.model.CreateNetworkIPv6WithPrefixLength + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2alpha1api.model.CreateNetworkPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2alpha1api.model.DestinationCIDRv4 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2alpha1api.model.DestinationCIDRv6 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2alpha1api.model.Error.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2alpha1api.model.Network.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2alpha1api.model.NetworkIPv4 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2alpha1api.model.NetworkIPv6 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2alpha1api.model.NetworkListResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2alpha1api.model.NexthopBlackhole + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2alpha1api.model.NexthopIPv4 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2alpha1api.model.NexthopIPv6 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2alpha1api.model.NexthopInternet + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2alpha1api.model.PartialUpdateNetworkPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2alpha1api.model.Route.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2alpha1api.model.RouteDestination + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2alpha1api.model.RouteListResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2alpha1api.model.RouteNexthop + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2alpha1api.model.RoutingTable + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2alpha1api.model.RoutingTableListResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2alpha1api.model.UpdateNetworkIPv4Body + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2alpha1api.model.UpdateNetworkIPv6Body + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2alpha1api.model.UpdateRouteOfRoutingTablePayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2alpha1api.model.UpdateRoutingTableOfAreaPayload + .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/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/Pair.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/Pair.java new file mode 100644 index 00000000..79d221e5 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/Pair.java @@ -0,0 +1,38 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2alpha1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2alpha1api; + +@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/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/ProgressRequestBody.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/ProgressRequestBody.java new file mode 100644 index 00000000..78f6f49e --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/ProgressRequestBody.java @@ -0,0 +1,71 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2alpha1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2alpha1api; + +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/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/ProgressResponseBody.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/ProgressResponseBody.java new file mode 100644 index 00000000..b3db5d59 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/ProgressResponseBody.java @@ -0,0 +1,68 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2alpha1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2alpha1api; + +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/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/ServerConfiguration.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/ServerConfiguration.java new file mode 100644 index 00000000..b51d68f0 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/ServerConfiguration.java @@ -0,0 +1,79 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2alpha1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2alpha1api; + +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/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/ServerVariable.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/ServerVariable.java new file mode 100644 index 00000000..6b860684 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/ServerVariable.java @@ -0,0 +1,37 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2alpha1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2alpha1api; + +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/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/StringUtil.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/StringUtil.java new file mode 100644 index 00000000..3763ced8 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/StringUtil.java @@ -0,0 +1,83 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2alpha1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2alpha1api; + +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/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/api/DefaultApi.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/api/DefaultApi.java new file mode 100644 index 00000000..31d30b90 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/api/DefaultApi.java @@ -0,0 +1,4036 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2alpha1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2alpha1api.api; + +import cloud.stackit.sdk.core.config.CoreConfiguration; +import cloud.stackit.sdk.core.exception.ApiException; +import cloud.stackit.sdk.iaas.v2alpha1api.ApiCallback; +import cloud.stackit.sdk.iaas.v2alpha1api.ApiClient; +import cloud.stackit.sdk.iaas.v2alpha1api.ApiResponse; +import cloud.stackit.sdk.iaas.v2alpha1api.Pair; +import cloud.stackit.sdk.iaas.v2alpha1api.model.AddRoutesToRoutingTablePayload; +import cloud.stackit.sdk.iaas.v2alpha1api.model.AddRoutingTableToAreaPayload; +import cloud.stackit.sdk.iaas.v2alpha1api.model.CreateNetworkPayload; +import cloud.stackit.sdk.iaas.v2alpha1api.model.Network; +import cloud.stackit.sdk.iaas.v2alpha1api.model.NetworkListResponse; +import cloud.stackit.sdk.iaas.v2alpha1api.model.PartialUpdateNetworkPayload; +import cloud.stackit.sdk.iaas.v2alpha1api.model.Route; +import cloud.stackit.sdk.iaas.v2alpha1api.model.RouteListResponse; +import cloud.stackit.sdk.iaas.v2alpha1api.model.RoutingTable; +import cloud.stackit.sdk.iaas.v2alpha1api.model.RoutingTableListResponse; +import cloud.stackit.sdk.iaas.v2alpha1api.model.UpdateRouteOfRoutingTablePayload; +import cloud.stackit.sdk.iaas.v2alpha1api.model.UpdateRoutingTableOfAreaPayload; +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 java.util.UUID; +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 addRoutesToRoutingTable + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @param addRoutesToRoutingTablePayload Request an addition of routes to a routing table. + * (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 Adding routes to routing table was successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call addRoutesToRoutingTableCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nonnull AddRoutesToRoutingTablePayload addRoutesToRoutingTablePayload, + 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 = addRoutesToRoutingTablePayload; + + // create path and map variables + String localVarPath = + "/v2alpha1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}/routes" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "areaId" + "}", + localVarApiClient.escapeString(areaId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "routingTableId" + "}", + localVarApiClient.escapeString(routingTableId.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 addRoutesToRoutingTableValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nonnull AddRoutesToRoutingTablePayload addRoutesToRoutingTablePayload, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling addRoutesToRoutingTable(Async)"); + } + + // verify the required parameter 'areaId' is set + if (areaId == null) { + throw new ApiException( + "Missing the required parameter 'areaId' when calling addRoutesToRoutingTable(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling addRoutesToRoutingTable(Async)"); + } + + // verify the required parameter 'routingTableId' is set + if (routingTableId == null) { + throw new ApiException( + "Missing the required parameter 'routingTableId' when calling addRoutesToRoutingTable(Async)"); + } + + // verify the required parameter 'addRoutesToRoutingTablePayload' is set + if (addRoutesToRoutingTablePayload == null) { + throw new ApiException( + "Missing the required parameter 'addRoutesToRoutingTablePayload' when calling addRoutesToRoutingTable(Async)"); + } + + return addRoutesToRoutingTableCall( + organizationId, + areaId, + region, + routingTableId, + addRoutesToRoutingTablePayload, + _callback); + } + + /** + * Create new routes in a routing table. Create new routes in an existing routing table. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @param addRoutesToRoutingTablePayload Request an addition of routes to a routing table. + * (required) + * @return RouteListResponse + * @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 Adding routes to routing table was successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public RouteListResponse addRoutesToRoutingTable( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nonnull AddRoutesToRoutingTablePayload addRoutesToRoutingTablePayload) + throws ApiException { + ApiResponse localVarResp = + addRoutesToRoutingTableWithHttpInfo( + organizationId, + areaId, + region, + routingTableId, + addRoutesToRoutingTablePayload); + return localVarResp.getData(); + } + + /** + * Create new routes in a routing table. Create new routes in an existing routing table. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @param addRoutesToRoutingTablePayload Request an addition of routes to a routing table. + * (required) + * @return ApiResponse<RouteListResponse> + * @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 Adding routes to routing table was successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse addRoutesToRoutingTableWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nonnull AddRoutesToRoutingTablePayload addRoutesToRoutingTablePayload) + throws ApiException { + okhttp3.Call localVarCall = + addRoutesToRoutingTableValidateBeforeCall( + organizationId, + areaId, + region, + routingTableId, + addRoutesToRoutingTablePayload, + null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create new routes in a routing table. (asynchronously) Create new routes in an existing + * routing table. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @param addRoutesToRoutingTablePayload Request an addition of routes to a routing table. + * (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 Adding routes to routing table was successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call addRoutesToRoutingTableAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nonnull AddRoutesToRoutingTablePayload addRoutesToRoutingTablePayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + addRoutesToRoutingTableValidateBeforeCall( + organizationId, + areaId, + region, + routingTableId, + addRoutesToRoutingTablePayload, + _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for addRoutingTableToArea + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param addRoutingTableToAreaPayload Request an addition of a routing table to an area. + * (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 Adding routing table was successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call addRoutingTableToAreaCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull AddRoutingTableToAreaPayload addRoutingTableToAreaPayload, + 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 = addRoutingTableToAreaPayload; + + // create path and map variables + String localVarPath = + "/v2alpha1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "areaId" + "}", + localVarApiClient.escapeString(areaId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/json"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call addRoutingTableToAreaValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull AddRoutingTableToAreaPayload addRoutingTableToAreaPayload, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling addRoutingTableToArea(Async)"); + } + + // verify the required parameter 'areaId' is set + if (areaId == null) { + throw new ApiException( + "Missing the required parameter 'areaId' when calling addRoutingTableToArea(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling addRoutingTableToArea(Async)"); + } + + // verify the required parameter 'addRoutingTableToAreaPayload' is set + if (addRoutingTableToAreaPayload == null) { + throw new ApiException( + "Missing the required parameter 'addRoutingTableToAreaPayload' when calling addRoutingTableToArea(Async)"); + } + + return addRoutingTableToAreaCall( + organizationId, areaId, region, addRoutingTableToAreaPayload, _callback); + } + + /** + * Create new routing table in a network area. Create a new routing table in an existing network + * area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param addRoutingTableToAreaPayload Request an addition of a routing table to an area. + * (required) + * @return RoutingTable + * @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 Adding routing table was successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public RoutingTable addRoutingTableToArea( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull AddRoutingTableToAreaPayload addRoutingTableToAreaPayload) + throws ApiException { + ApiResponse localVarResp = + addRoutingTableToAreaWithHttpInfo( + organizationId, areaId, region, addRoutingTableToAreaPayload); + return localVarResp.getData(); + } + + /** + * Create new routing table in a network area. Create a new routing table in an existing network + * area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param addRoutingTableToAreaPayload Request an addition of a routing table to an area. + * (required) + * @return ApiResponse<RoutingTable> + * @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 Adding routing table was successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse addRoutingTableToAreaWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull AddRoutingTableToAreaPayload addRoutingTableToAreaPayload) + throws ApiException { + okhttp3.Call localVarCall = + addRoutingTableToAreaValidateBeforeCall( + organizationId, areaId, region, addRoutingTableToAreaPayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create new routing table in a network area. (asynchronously) Create a new routing table in an + * existing network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param addRoutingTableToAreaPayload Request an addition of a routing table to an area. + * (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 Adding routing table was successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call addRoutingTableToAreaAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull AddRoutingTableToAreaPayload addRoutingTableToAreaPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + addRoutingTableToAreaValidateBeforeCall( + organizationId, areaId, region, addRoutingTableToAreaPayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for createNetwork + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param createNetworkPayload Request a network creation. (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
202 Network create has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call createNetworkCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateNetworkPayload createNetworkPayload, + 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 = createNetworkPayload; + + // create path and map variables + String localVarPath = + "/v2alpha1/projects/{projectId}/regions/{region}/networks" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/json"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createNetworkValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateNetworkPayload createNetworkPayload, + 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 createNetwork(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling createNetwork(Async)"); + } + + // verify the required parameter 'createNetworkPayload' is set + if (createNetworkPayload == null) { + throw new ApiException( + "Missing the required parameter 'createNetworkPayload' when calling createNetwork(Async)"); + } + + return createNetworkCall(projectId, region, createNetworkPayload, _callback); + } + + /** + * Create new network. Create a new network in a project. `nameservers` will be filled + * from `defaultNameservers` of the respective area if not specified. If the project + * has `internetAccess` enabled and this is the first network in the project this + * might incur cost. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param createNetworkPayload Request a network creation. (required) + * @return Network + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Network create has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public Network createNetwork( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateNetworkPayload createNetworkPayload) + throws ApiException { + ApiResponse localVarResp = + createNetworkWithHttpInfo(projectId, region, createNetworkPayload); + return localVarResp.getData(); + } + + /** + * Create new network. Create a new network in a project. `nameservers` will be filled + * from `defaultNameservers` of the respective area if not specified. If the project + * has `internetAccess` enabled and this is the first network in the project this + * might incur cost. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param createNetworkPayload Request a network creation. (required) + * @return ApiResponse<Network> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Network create has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse createNetworkWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateNetworkPayload createNetworkPayload) + throws ApiException { + okhttp3.Call localVarCall = + createNetworkValidateBeforeCall(projectId, region, createNetworkPayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create new network. (asynchronously) Create a new network in a project. + * `nameservers` will be filled from `defaultNameservers` of the respective + * area if not specified. If the project has `internetAccess` enabled and this is the + * first network in the project this might incur cost. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param createNetworkPayload Request a network creation. (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
202 Network create has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call createNetworkAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateNetworkPayload createNetworkPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createNetworkValidateBeforeCall(projectId, region, createNetworkPayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for deleteNetwork + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (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
202 Delete request for network has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call deleteNetworkCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId, + 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 = + "/v2alpha1/projects/{projectId}/regions/{region}/networks/{networkId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "networkId" + "}", + localVarApiClient.escapeString(networkId.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 deleteNetworkValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId, + 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 deleteNetwork(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling deleteNetwork(Async)"); + } + + // verify the required parameter 'networkId' is set + if (networkId == null) { + throw new ApiException( + "Missing the required parameter 'networkId' when calling deleteNetwork(Async)"); + } + + return deleteNetworkCall(projectId, region, networkId, _callback); + } + + /** + * Delete network. Delete a network. If the network is still in use, the deletion will fail. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Delete request for network has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public void deleteNetwork( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId) + throws ApiException { + deleteNetworkWithHttpInfo(projectId, region, networkId); + } + + /** + * Delete network. Delete a network. If the network is still in use, the deletion will fail. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Delete request for network has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse deleteNetworkWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId) + throws ApiException { + okhttp3.Call localVarCall = + deleteNetworkValidateBeforeCall(projectId, region, networkId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete network. (asynchronously) Delete a network. If the network is still in use, the + * deletion will fail. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (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
202 Delete request for network has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call deleteNetworkAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + deleteNetworkValidateBeforeCall(projectId, region, networkId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for deleteRouteFromRoutingTable + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @param routeId The identifier (ID) of a STACKIT Route. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Delete request for the route has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call deleteRouteFromRoutingTableCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nonnull UUID routeId, + 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 = + "/v2alpha1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}/routes/{routeId}" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "areaId" + "}", + localVarApiClient.escapeString(areaId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "routingTableId" + "}", + localVarApiClient.escapeString(routingTableId.toString())) + .replace( + "{" + "routeId" + "}", + localVarApiClient.escapeString(routeId.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 deleteRouteFromRoutingTableValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nonnull UUID routeId, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling deleteRouteFromRoutingTable(Async)"); + } + + // verify the required parameter 'areaId' is set + if (areaId == null) { + throw new ApiException( + "Missing the required parameter 'areaId' when calling deleteRouteFromRoutingTable(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling deleteRouteFromRoutingTable(Async)"); + } + + // verify the required parameter 'routingTableId' is set + if (routingTableId == null) { + throw new ApiException( + "Missing the required parameter 'routingTableId' when calling deleteRouteFromRoutingTable(Async)"); + } + + // verify the required parameter 'routeId' is set + if (routeId == null) { + throw new ApiException( + "Missing the required parameter 'routeId' when calling deleteRouteFromRoutingTable(Async)"); + } + + return deleteRouteFromRoutingTableCall( + organizationId, areaId, region, routingTableId, routeId, _callback); + } + + /** + * Delete a route in a routing table. Delete a route in an existing routing table. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @param routeId The identifier (ID) of a STACKIT Route. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Delete request for the route has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public void deleteRouteFromRoutingTable( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nonnull UUID routeId) + throws ApiException { + deleteRouteFromRoutingTableWithHttpInfo( + organizationId, areaId, region, routingTableId, routeId); + } + + /** + * Delete a route in a routing table. Delete a route in an existing routing table. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @param routeId The identifier (ID) of a STACKIT Route. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Delete request for the route has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse deleteRouteFromRoutingTableWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nonnull UUID routeId) + throws ApiException { + okhttp3.Call localVarCall = + deleteRouteFromRoutingTableValidateBeforeCall( + organizationId, areaId, region, routingTableId, routeId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete a route in a routing table. (asynchronously) Delete a route in an existing routing + * table. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @param routeId The identifier (ID) of a STACKIT Route. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Delete request for the route has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call deleteRouteFromRoutingTableAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nonnull UUID routeId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + deleteRouteFromRoutingTableValidateBeforeCall( + organizationId, areaId, region, routingTableId, routeId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for deleteRoutingTableFromArea + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Delete request for the routing table has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call deleteRoutingTableFromAreaCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + 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 = + "/v2alpha1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "areaId" + "}", + localVarApiClient.escapeString(areaId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "routingTableId" + "}", + localVarApiClient.escapeString(routingTableId.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 deleteRoutingTableFromAreaValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling deleteRoutingTableFromArea(Async)"); + } + + // verify the required parameter 'areaId' is set + if (areaId == null) { + throw new ApiException( + "Missing the required parameter 'areaId' when calling deleteRoutingTableFromArea(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling deleteRoutingTableFromArea(Async)"); + } + + // verify the required parameter 'routingTableId' is set + if (routingTableId == null) { + throw new ApiException( + "Missing the required parameter 'routingTableId' when calling deleteRoutingTableFromArea(Async)"); + } + + return deleteRoutingTableFromAreaCall( + organizationId, areaId, region, routingTableId, _callback); + } + + /** + * Delete a routing table. Delete a routing table of a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Delete request for the routing table has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public void deleteRoutingTableFromArea( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId) + throws ApiException { + deleteRoutingTableFromAreaWithHttpInfo(organizationId, areaId, region, routingTableId); + } + + /** + * Delete a routing table. Delete a routing table of a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Delete request for the routing table has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse deleteRoutingTableFromAreaWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId) + throws ApiException { + okhttp3.Call localVarCall = + deleteRoutingTableFromAreaValidateBeforeCall( + organizationId, areaId, region, routingTableId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete a routing table. (asynchronously) Delete a routing table of a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Delete request for the routing table has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call deleteRoutingTableFromAreaAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + deleteRoutingTableFromAreaValidateBeforeCall( + organizationId, areaId, region, routingTableId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for getNetwork + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (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 Show network details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getNetworkCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId, + 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 = + "/v2alpha1/projects/{projectId}/regions/{region}/networks/{networkId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "networkId" + "}", + localVarApiClient.escapeString(networkId.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 getNetworkValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId, + 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 getNetwork(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling getNetwork(Async)"); + } + + // verify the required parameter 'networkId' is set + if (networkId == null) { + throw new ApiException( + "Missing the required parameter 'networkId' when calling getNetwork(Async)"); + } + + return getNetworkCall(projectId, region, networkId, _callback); + } + + /** + * Get network details. Get details about a network of a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @return Network + * @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 Show network details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public Network getNetwork( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId) + throws ApiException { + ApiResponse localVarResp = getNetworkWithHttpInfo(projectId, region, networkId); + return localVarResp.getData(); + } + + /** + * Get network details. Get details about a network of a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @return ApiResponse<Network> + * @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 Show network details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse getNetworkWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId) + throws ApiException { + okhttp3.Call localVarCall = + getNetworkValidateBeforeCall(projectId, region, networkId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get network details. (asynchronously) Get details about a network of a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (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 Show network details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getNetworkAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getNetworkValidateBeforeCall(projectId, region, networkId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getRouteOfRoutingTable + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @param routeId The identifier (ID) of a STACKIT Route. (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 Show the details of a route in a routing table. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getRouteOfRoutingTableCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nonnull UUID routeId, + 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 = + "/v2alpha1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}/routes/{routeId}" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "areaId" + "}", + localVarApiClient.escapeString(areaId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "routingTableId" + "}", + localVarApiClient.escapeString(routingTableId.toString())) + .replace( + "{" + "routeId" + "}", + localVarApiClient.escapeString(routeId.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 getRouteOfRoutingTableValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nonnull UUID routeId, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling getRouteOfRoutingTable(Async)"); + } + + // verify the required parameter 'areaId' is set + if (areaId == null) { + throw new ApiException( + "Missing the required parameter 'areaId' when calling getRouteOfRoutingTable(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling getRouteOfRoutingTable(Async)"); + } + + // verify the required parameter 'routingTableId' is set + if (routingTableId == null) { + throw new ApiException( + "Missing the required parameter 'routingTableId' when calling getRouteOfRoutingTable(Async)"); + } + + // verify the required parameter 'routeId' is set + if (routeId == null) { + throw new ApiException( + "Missing the required parameter 'routeId' when calling getRouteOfRoutingTable(Async)"); + } + + return getRouteOfRoutingTableCall( + organizationId, areaId, region, routingTableId, routeId, _callback); + } + + /** + * Get details about a route of a routing table. Get details about a route defined in a routing + * table. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @param routeId The identifier (ID) of a STACKIT Route. (required) + * @return Route + * @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 Show the details of a route in a routing table. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public Route getRouteOfRoutingTable( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nonnull UUID routeId) + throws ApiException { + ApiResponse localVarResp = + getRouteOfRoutingTableWithHttpInfo( + organizationId, areaId, region, routingTableId, routeId); + return localVarResp.getData(); + } + + /** + * Get details about a route of a routing table. Get details about a route defined in a routing + * table. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @param routeId The identifier (ID) of a STACKIT Route. (required) + * @return ApiResponse<Route> + * @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 Show the details of a route in a routing table. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse getRouteOfRoutingTableWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nonnull UUID routeId) + throws ApiException { + okhttp3.Call localVarCall = + getRouteOfRoutingTableValidateBeforeCall( + organizationId, areaId, region, routingTableId, routeId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get details about a route of a routing table. (asynchronously) Get details about a route + * defined in a routing table. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @param routeId The identifier (ID) of a STACKIT Route. (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 Show the details of a route in a routing table. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getRouteOfRoutingTableAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nonnull UUID routeId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getRouteOfRoutingTableValidateBeforeCall( + organizationId, areaId, region, routingTableId, routeId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getRoutingTableOfArea + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (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 Show routing table details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getRoutingTableOfAreaCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + 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 = + "/v2alpha1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "areaId" + "}", + localVarApiClient.escapeString(areaId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "routingTableId" + "}", + localVarApiClient.escapeString(routingTableId.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 getRoutingTableOfAreaValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling getRoutingTableOfArea(Async)"); + } + + // verify the required parameter 'areaId' is set + if (areaId == null) { + throw new ApiException( + "Missing the required parameter 'areaId' when calling getRoutingTableOfArea(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling getRoutingTableOfArea(Async)"); + } + + // verify the required parameter 'routingTableId' is set + if (routingTableId == null) { + throw new ApiException( + "Missing the required parameter 'routingTableId' when calling getRoutingTableOfArea(Async)"); + } + + return getRoutingTableOfAreaCall(organizationId, areaId, region, routingTableId, _callback); + } + + /** + * Get details about a routing table. Get details about a routing table defined in a network + * area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @return RoutingTable + * @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 Show routing table details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public RoutingTable getRoutingTableOfArea( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId) + throws ApiException { + ApiResponse localVarResp = + getRoutingTableOfAreaWithHttpInfo(organizationId, areaId, region, routingTableId); + return localVarResp.getData(); + } + + /** + * Get details about a routing table. Get details about a routing table defined in a network + * area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @return ApiResponse<RoutingTable> + * @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 Show routing table details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse getRoutingTableOfAreaWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId) + throws ApiException { + okhttp3.Call localVarCall = + getRoutingTableOfAreaValidateBeforeCall( + organizationId, areaId, region, routingTableId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get details about a routing table. (asynchronously) Get details about a routing table defined + * in a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (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 Show routing table details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getRoutingTableOfAreaAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getRoutingTableOfAreaValidateBeforeCall( + organizationId, areaId, region, routingTableId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listNetworks + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param labelSelector Filter resources by labels. (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 List all networks of a project. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listNetworksCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector, + 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 = + "/v2alpha1/projects/{projectId}/regions/{region}/networks" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (labelSelector != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("label_selector", labelSelector)); + } + + 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 listNetworksValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector, + 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 listNetworks(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling listNetworks(Async)"); + } + + return listNetworksCall(projectId, region, labelSelector, _callback); + } + + /** + * List all networks inside a project. Get a list of all networks inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return NetworkListResponse + * @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 List all networks of a project. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public NetworkListResponse listNetworks( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + ApiResponse localVarResp = + listNetworksWithHttpInfo(projectId, region, labelSelector); + return localVarResp.getData(); + } + + /** + * List all networks inside a project. Get a list of all networks inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return ApiResponse<NetworkListResponse> + * @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 List all networks of a project. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse listNetworksWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + okhttp3.Call localVarCall = + listNetworksValidateBeforeCall(projectId, region, labelSelector, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List all networks inside a project. (asynchronously) Get a list of all networks inside a + * project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param labelSelector Filter resources by labels. (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 List all networks of a project. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listNetworksAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listNetworksValidateBeforeCall(projectId, region, labelSelector, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listNetworksOfRoutingTable + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (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 List all routing table networks. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listNetworksOfRoutingTableCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + 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 = + "/v2alpha1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}/networks" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "areaId" + "}", + localVarApiClient.escapeString(areaId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "routingTableId" + "}", + localVarApiClient.escapeString(routingTableId.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 listNetworksOfRoutingTableValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling listNetworksOfRoutingTable(Async)"); + } + + // verify the required parameter 'areaId' is set + if (areaId == null) { + throw new ApiException( + "Missing the required parameter 'areaId' when calling listNetworksOfRoutingTable(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling listNetworksOfRoutingTable(Async)"); + } + + // verify the required parameter 'routingTableId' is set + if (routingTableId == null) { + throw new ApiException( + "Missing the required parameter 'routingTableId' when calling listNetworksOfRoutingTable(Async)"); + } + + return listNetworksOfRoutingTableCall( + organizationId, areaId, region, routingTableId, _callback); + } + + /** + * List all networks in a routing table. Get a list of all networks in a routing table. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @return NetworkListResponse + * @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 List all routing table networks. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public NetworkListResponse listNetworksOfRoutingTable( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId) + throws ApiException { + ApiResponse localVarResp = + listNetworksOfRoutingTableWithHttpInfo( + organizationId, areaId, region, routingTableId); + return localVarResp.getData(); + } + + /** + * List all networks in a routing table. Get a list of all networks in a routing table. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @return ApiResponse<NetworkListResponse> + * @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 List all routing table networks. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse listNetworksOfRoutingTableWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId) + throws ApiException { + okhttp3.Call localVarCall = + listNetworksOfRoutingTableValidateBeforeCall( + organizationId, areaId, region, routingTableId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List all networks in a routing table. (asynchronously) Get a list of all networks in a + * routing table. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (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 List all routing table networks. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listNetworksOfRoutingTableAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listNetworksOfRoutingTableValidateBeforeCall( + organizationId, areaId, region, routingTableId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listRoutesOfRoutingTable + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @param labelSelector Filter resources by labels. (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 List all routing table routes. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listRoutesOfRoutingTableCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nullable String labelSelector, + 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 = + "/v2alpha1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}/routes" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "areaId" + "}", + localVarApiClient.escapeString(areaId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "routingTableId" + "}", + localVarApiClient.escapeString(routingTableId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (labelSelector != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("label_selector", labelSelector)); + } + + 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 listRoutesOfRoutingTableValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nullable String labelSelector, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling listRoutesOfRoutingTable(Async)"); + } + + // verify the required parameter 'areaId' is set + if (areaId == null) { + throw new ApiException( + "Missing the required parameter 'areaId' when calling listRoutesOfRoutingTable(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling listRoutesOfRoutingTable(Async)"); + } + + // verify the required parameter 'routingTableId' is set + if (routingTableId == null) { + throw new ApiException( + "Missing the required parameter 'routingTableId' when calling listRoutesOfRoutingTable(Async)"); + } + + return listRoutesOfRoutingTableCall( + organizationId, areaId, region, routingTableId, labelSelector, _callback); + } + + /** + * List all routes in a routing table. Get a list of all routes in a routing table. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return RouteListResponse + * @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 List all routing table routes. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public RouteListResponse listRoutesOfRoutingTable( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + ApiResponse localVarResp = + listRoutesOfRoutingTableWithHttpInfo( + organizationId, areaId, region, routingTableId, labelSelector); + return localVarResp.getData(); + } + + /** + * List all routes in a routing table. Get a list of all routes in a routing table. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return ApiResponse<RouteListResponse> + * @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 List all routing table routes. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse listRoutesOfRoutingTableWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + okhttp3.Call localVarCall = + listRoutesOfRoutingTableValidateBeforeCall( + organizationId, areaId, region, routingTableId, labelSelector, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List all routes in a routing table. (asynchronously) Get a list of all routes in a routing + * table. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @param labelSelector Filter resources by labels. (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 List all routing table routes. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listRoutesOfRoutingTableAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nullable String labelSelector, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listRoutesOfRoutingTableValidateBeforeCall( + organizationId, areaId, region, routingTableId, labelSelector, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listRoutingTablesOfArea + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param labelSelector Filter resources by labels. (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 List all routing tables. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listRoutingTablesOfAreaCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector, + 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 = + "/v2alpha1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "areaId" + "}", + localVarApiClient.escapeString(areaId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (labelSelector != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("label_selector", labelSelector)); + } + + 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 listRoutingTablesOfAreaValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling listRoutingTablesOfArea(Async)"); + } + + // verify the required parameter 'areaId' is set + if (areaId == null) { + throw new ApiException( + "Missing the required parameter 'areaId' when calling listRoutingTablesOfArea(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling listRoutingTablesOfArea(Async)"); + } + + return listRoutingTablesOfAreaCall( + organizationId, areaId, region, labelSelector, _callback); + } + + /** + * List all routing tables in a network area. Get a list of all routing tables in a network + * area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return RoutingTableListResponse + * @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 List all routing tables. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public RoutingTableListResponse listRoutingTablesOfArea( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + ApiResponse localVarResp = + listRoutingTablesOfAreaWithHttpInfo(organizationId, areaId, region, labelSelector); + return localVarResp.getData(); + } + + /** + * List all routing tables in a network area. Get a list of all routing tables in a network + * area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return ApiResponse<RoutingTableListResponse> + * @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 List all routing tables. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse listRoutingTablesOfAreaWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + okhttp3.Call localVarCall = + listRoutingTablesOfAreaValidateBeforeCall( + organizationId, areaId, region, labelSelector, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List all routing tables in a network area. (asynchronously) Get a list of all routing tables + * in a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param labelSelector Filter resources by labels. (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 List all routing tables. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listRoutingTablesOfAreaAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listRoutingTablesOfAreaValidateBeforeCall( + organizationId, areaId, region, labelSelector, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for partialUpdateNetwork + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param partialUpdateNetworkPayload Request an update of a network. (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
202 An update was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call partialUpdateNetworkCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull PartialUpdateNetworkPayload partialUpdateNetworkPayload, + 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 = partialUpdateNetworkPayload; + + // create path and map variables + String localVarPath = + "/v2alpha1/projects/{projectId}/regions/{region}/networks/{networkId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "networkId" + "}", + localVarApiClient.escapeString(networkId.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, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call partialUpdateNetworkValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull PartialUpdateNetworkPayload partialUpdateNetworkPayload, + 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 partialUpdateNetwork(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling partialUpdateNetwork(Async)"); + } + + // verify the required parameter 'networkId' is set + if (networkId == null) { + throw new ApiException( + "Missing the required parameter 'networkId' when calling partialUpdateNetwork(Async)"); + } + + // verify the required parameter 'partialUpdateNetworkPayload' is set + if (partialUpdateNetworkPayload == null) { + throw new ApiException( + "Missing the required parameter 'partialUpdateNetworkPayload' when calling partialUpdateNetwork(Async)"); + } + + return partialUpdateNetworkCall( + projectId, region, networkId, partialUpdateNetworkPayload, _callback); + } + + /** + * Update network settings. Update the settings of a network inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param partialUpdateNetworkPayload Request an update of a network. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 An update was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public void partialUpdateNetwork( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull PartialUpdateNetworkPayload partialUpdateNetworkPayload) + throws ApiException { + partialUpdateNetworkWithHttpInfo(projectId, region, networkId, partialUpdateNetworkPayload); + } + + /** + * Update network settings. Update the settings of a network inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param partialUpdateNetworkPayload Request an update of a network. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 An update was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse partialUpdateNetworkWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull PartialUpdateNetworkPayload partialUpdateNetworkPayload) + throws ApiException { + okhttp3.Call localVarCall = + partialUpdateNetworkValidateBeforeCall( + projectId, region, networkId, partialUpdateNetworkPayload, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Update network settings. (asynchronously) Update the settings of a network inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param partialUpdateNetworkPayload Request an update of a network. (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
202 An update was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call partialUpdateNetworkAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull PartialUpdateNetworkPayload partialUpdateNetworkPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + partialUpdateNetworkValidateBeforeCall( + projectId, region, networkId, partialUpdateNetworkPayload, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for updateRouteOfRoutingTable + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @param routeId The identifier (ID) of a STACKIT Route. (required) + * @param updateRouteOfRoutingTablePayload Request an update of a route in a routing table. + * (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Update request for route successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call updateRouteOfRoutingTableCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nonnull UUID routeId, + @javax.annotation.Nonnull + UpdateRouteOfRoutingTablePayload updateRouteOfRoutingTablePayload, + 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 = updateRouteOfRoutingTablePayload; + + // create path and map variables + String localVarPath = + "/v2alpha1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}/routes/{routeId}" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "areaId" + "}", + localVarApiClient.escapeString(areaId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "routingTableId" + "}", + localVarApiClient.escapeString(routingTableId.toString())) + .replace( + "{" + "routeId" + "}", + localVarApiClient.escapeString(routeId.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, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateRouteOfRoutingTableValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nonnull UUID routeId, + @javax.annotation.Nonnull + UpdateRouteOfRoutingTablePayload updateRouteOfRoutingTablePayload, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling updateRouteOfRoutingTable(Async)"); + } + + // verify the required parameter 'areaId' is set + if (areaId == null) { + throw new ApiException( + "Missing the required parameter 'areaId' when calling updateRouteOfRoutingTable(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling updateRouteOfRoutingTable(Async)"); + } + + // verify the required parameter 'routingTableId' is set + if (routingTableId == null) { + throw new ApiException( + "Missing the required parameter 'routingTableId' when calling updateRouteOfRoutingTable(Async)"); + } + + // verify the required parameter 'routeId' is set + if (routeId == null) { + throw new ApiException( + "Missing the required parameter 'routeId' when calling updateRouteOfRoutingTable(Async)"); + } + + // verify the required parameter 'updateRouteOfRoutingTablePayload' is set + if (updateRouteOfRoutingTablePayload == null) { + throw new ApiException( + "Missing the required parameter 'updateRouteOfRoutingTablePayload' when calling updateRouteOfRoutingTable(Async)"); + } + + return updateRouteOfRoutingTableCall( + organizationId, + areaId, + region, + routingTableId, + routeId, + updateRouteOfRoutingTablePayload, + _callback); + } + + /** + * Update a route of a routing table. Update a route defined in a routing table. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @param routeId The identifier (ID) of a STACKIT Route. (required) + * @param updateRouteOfRoutingTablePayload Request an update of a route in a routing table. + * (required) + * @return Route + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Update request for route successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public Route updateRouteOfRoutingTable( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nonnull UUID routeId, + @javax.annotation.Nonnull + UpdateRouteOfRoutingTablePayload updateRouteOfRoutingTablePayload) + throws ApiException { + ApiResponse localVarResp = + updateRouteOfRoutingTableWithHttpInfo( + organizationId, + areaId, + region, + routingTableId, + routeId, + updateRouteOfRoutingTablePayload); + return localVarResp.getData(); + } + + /** + * Update a route of a routing table. Update a route defined in a routing table. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @param routeId The identifier (ID) of a STACKIT Route. (required) + * @param updateRouteOfRoutingTablePayload Request an update of a route in a routing table. + * (required) + * @return ApiResponse<Route> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Update request for route successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse updateRouteOfRoutingTableWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nonnull UUID routeId, + @javax.annotation.Nonnull + UpdateRouteOfRoutingTablePayload updateRouteOfRoutingTablePayload) + throws ApiException { + okhttp3.Call localVarCall = + updateRouteOfRoutingTableValidateBeforeCall( + organizationId, + areaId, + region, + routingTableId, + routeId, + updateRouteOfRoutingTablePayload, + null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update a route of a routing table. (asynchronously) Update a route defined in a routing + * table. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @param routeId The identifier (ID) of a STACKIT Route. (required) + * @param updateRouteOfRoutingTablePayload Request an update of a route in a routing table. + * (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Update request for route successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call updateRouteOfRoutingTableAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nonnull UUID routeId, + @javax.annotation.Nonnull + UpdateRouteOfRoutingTablePayload updateRouteOfRoutingTablePayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + updateRouteOfRoutingTableValidateBeforeCall( + organizationId, + areaId, + region, + routingTableId, + routeId, + updateRouteOfRoutingTablePayload, + _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for updateRoutingTableOfArea + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @param updateRoutingTableOfAreaPayload Request an update of a routing table. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Update request for routing table successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call updateRoutingTableOfAreaCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nonnull + UpdateRoutingTableOfAreaPayload updateRoutingTableOfAreaPayload, + 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 = updateRoutingTableOfAreaPayload; + + // create path and map variables + String localVarPath = + "/v2alpha1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "areaId" + "}", + localVarApiClient.escapeString(areaId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "routingTableId" + "}", + localVarApiClient.escapeString(routingTableId.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, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateRoutingTableOfAreaValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nonnull + UpdateRoutingTableOfAreaPayload updateRoutingTableOfAreaPayload, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling updateRoutingTableOfArea(Async)"); + } + + // verify the required parameter 'areaId' is set + if (areaId == null) { + throw new ApiException( + "Missing the required parameter 'areaId' when calling updateRoutingTableOfArea(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling updateRoutingTableOfArea(Async)"); + } + + // verify the required parameter 'routingTableId' is set + if (routingTableId == null) { + throw new ApiException( + "Missing the required parameter 'routingTableId' when calling updateRoutingTableOfArea(Async)"); + } + + // verify the required parameter 'updateRoutingTableOfAreaPayload' is set + if (updateRoutingTableOfAreaPayload == null) { + throw new ApiException( + "Missing the required parameter 'updateRoutingTableOfAreaPayload' when calling updateRoutingTableOfArea(Async)"); + } + + return updateRoutingTableOfAreaCall( + organizationId, + areaId, + region, + routingTableId, + updateRoutingTableOfAreaPayload, + _callback); + } + + /** + * Update a routing table. Update a routing table defined in a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @param updateRoutingTableOfAreaPayload Request an update of a routing table. (required) + * @return RoutingTable + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Update request for routing table successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public RoutingTable updateRoutingTableOfArea( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nonnull + UpdateRoutingTableOfAreaPayload updateRoutingTableOfAreaPayload) + throws ApiException { + ApiResponse localVarResp = + updateRoutingTableOfAreaWithHttpInfo( + organizationId, + areaId, + region, + routingTableId, + updateRoutingTableOfAreaPayload); + return localVarResp.getData(); + } + + /** + * Update a routing table. Update a routing table defined in a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @param updateRoutingTableOfAreaPayload Request an update of a routing table. (required) + * @return ApiResponse<RoutingTable> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Update request for routing table successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse updateRoutingTableOfAreaWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nonnull + UpdateRoutingTableOfAreaPayload updateRoutingTableOfAreaPayload) + throws ApiException { + okhttp3.Call localVarCall = + updateRoutingTableOfAreaValidateBeforeCall( + organizationId, + areaId, + region, + routingTableId, + updateRoutingTableOfAreaPayload, + null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update a routing table. (asynchronously) Update a routing table defined in a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @param updateRoutingTableOfAreaPayload Request an update of a routing table. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Update request for routing table successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call updateRoutingTableOfAreaAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nonnull + UpdateRoutingTableOfAreaPayload updateRoutingTableOfAreaPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + updateRoutingTableOfAreaValidateBeforeCall( + organizationId, + areaId, + region, + routingTableId, + updateRoutingTableOfAreaPayload, + _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/api/IaasApi.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/api/IaasApi.java new file mode 100644 index 00000000..08a84ffb --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/api/IaasApi.java @@ -0,0 +1,63 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2alpha1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2alpha1api.api; + +import cloud.stackit.sdk.core.config.CoreConfiguration; +import java.io.IOException; +import okhttp3.OkHttpClient; + +public class IaasApi extends DefaultApi { + /** + * Basic constructor for IaasApi + * + *

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

For production use consider using the constructor with the OkHttpClient parameter. + * + * @param configuration your STACKIT SDK CoreConfiguration + * @throws IOException + */ + public IaasApi(CoreConfiguration configuration) throws IOException { + super(configuration); + } + + /** + * Constructor for IaasApi + * + * @param httpClient OkHttpClient object + * @throws IOException + */ + public IaasApi(OkHttpClient httpClient) throws IOException { + super(httpClient); + } + + /** + * Constructor for IaasApi + * + * @param httpClient OkHttpClient object + * @param configuration your STACKIT SDK CoreConfiguration + * @throws IOException + */ + public IaasApi(OkHttpClient httpClient, CoreConfiguration configuration) throws IOException { + super(httpClient, configuration); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/AbstractOpenApiSchema.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/AbstractOpenApiSchema.java new file mode 100644 index 00000000..df360979 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/AbstractOpenApiSchema.java @@ -0,0 +1,145 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2alpha1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2alpha1api.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/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/AddRoutesToRoutingTablePayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/AddRoutesToRoutingTablePayload.java new file mode 100644 index 00000000..bcee2c07 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/AddRoutesToRoutingTablePayload.java @@ -0,0 +1,334 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2alpha1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2alpha1api.model; + +import cloud.stackit.sdk.iaas.v2alpha1api.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; + +/** Object represents a request to add network routes. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class AddRoutesToRoutingTablePayload { + public static final String SERIALIZED_NAME_ITEMS = "items"; + + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public AddRoutesToRoutingTablePayload() {} + + public AddRoutesToRoutingTablePayload items(@javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public AddRoutesToRoutingTablePayload addItemsItem(Route itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list of routes. + * + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AddRoutesToRoutingTablePayload instance itself + */ + public AddRoutesToRoutingTablePayload 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; + } + AddRoutesToRoutingTablePayload addRoutesToRoutingTablePayload = + (AddRoutesToRoutingTablePayload) o; + return Objects.equals(this.items, addRoutesToRoutingTablePayload.items) + && Objects.equals( + this.additionalProperties, + addRoutesToRoutingTablePayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AddRoutesToRoutingTablePayload {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("items")); + } + + /** + * 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 + * AddRoutesToRoutingTablePayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AddRoutesToRoutingTablePayload.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 AddRoutesToRoutingTablePayload is not found in the empty JSON string", + AddRoutesToRoutingTablePayload.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AddRoutesToRoutingTablePayload.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("items").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `items` to be an array in the JSON string but got `%s`", + jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + Route.validateJsonElement(jsonArrayitems.get(i)); + } + ; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AddRoutesToRoutingTablePayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AddRoutesToRoutingTablePayload' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(AddRoutesToRoutingTablePayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AddRoutesToRoutingTablePayload 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 AddRoutesToRoutingTablePayload read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AddRoutesToRoutingTablePayload 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 AddRoutesToRoutingTablePayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of AddRoutesToRoutingTablePayload + * @throws IOException if the JSON string is invalid with respect to + * AddRoutesToRoutingTablePayload + */ + public static AddRoutesToRoutingTablePayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AddRoutesToRoutingTablePayload.class); + } + + /** + * Convert an instance of AddRoutesToRoutingTablePayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/AddRoutingTableToAreaPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/AddRoutingTableToAreaPayload.java new file mode 100644 index 00000000..b3e77897 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/AddRoutingTableToAreaPayload.java @@ -0,0 +1,536 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2alpha1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2alpha1api.model; + +import cloud.stackit.sdk.iaas.v2alpha1api.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; +import java.util.UUID; + +/** An object representing a routing table. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class AddRoutingTableToAreaPayload { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_DEFAULT = "default"; + + @SerializedName(SERIALIZED_NAME_DEFAULT) + @javax.annotation.Nullable private Boolean _default = true; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable private String description; + + public static final String SERIALIZED_NAME_DYNAMIC_ROUTES = "dynamicRoutes"; + + @SerializedName(SERIALIZED_NAME_DYNAMIC_ROUTES) + @javax.annotation.Nullable private Boolean dynamicRoutes = true; + + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_SYSTEM_ROUTES = "systemRoutes"; + + @SerializedName(SERIALIZED_NAME_SYSTEM_ROUTES) + @javax.annotation.Nullable private Boolean systemRoutes = true; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable private OffsetDateTime updatedAt; + + public AddRoutingTableToAreaPayload() {} + + public AddRoutingTableToAreaPayload( + OffsetDateTime createdAt, Boolean _default, UUID id, OffsetDateTime updatedAt) { + this(); + this.createdAt = createdAt; + this._default = _default; + this.id = id; + this.updatedAt = updatedAt; + } + + /** + * Date-time when resource was created. + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * This is the default routing table. It can't be deleted and is used if the user does not + * specify it otherwise. + * + * @return _default + */ + @javax.annotation.Nullable public Boolean getDefault() { + return _default; + } + + public AddRoutingTableToAreaPayload description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Description Object. Allows string up to 255 Characters. + * + * @return description + */ + @javax.annotation.Nullable public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + public AddRoutingTableToAreaPayload dynamicRoutes( + @javax.annotation.Nullable Boolean dynamicRoutes) { + this.dynamicRoutes = dynamicRoutes; + return this; + } + + /** + * A config setting for a routing table which allows propagation of dynamic routes to this + * routing table. + * + * @return dynamicRoutes + */ + @javax.annotation.Nullable public Boolean getDynamicRoutes() { + return dynamicRoutes; + } + + public void setDynamicRoutes(@javax.annotation.Nullable Boolean dynamicRoutes) { + this.dynamicRoutes = dynamicRoutes; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + public AddRoutingTableToAreaPayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public AddRoutingTableToAreaPayload name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + public AddRoutingTableToAreaPayload systemRoutes( + @javax.annotation.Nullable Boolean systemRoutes) { + this.systemRoutes = systemRoutes; + return this; + } + + /** + * A config setting for a routing table which allows installation of automatic system routes for + * connectivity between projects in the same SNA. + * + * @return systemRoutes + */ + @javax.annotation.Nullable public Boolean getSystemRoutes() { + return systemRoutes; + } + + public void setSystemRoutes(@javax.annotation.Nullable Boolean systemRoutes) { + this.systemRoutes = systemRoutes; + } + + /** + * Date-time when resource was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nullable public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * 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 AddRoutingTableToAreaPayload instance itself + */ + public AddRoutingTableToAreaPayload 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; + } + AddRoutingTableToAreaPayload addRoutingTableToAreaPayload = + (AddRoutingTableToAreaPayload) o; + return Objects.equals(this.createdAt, addRoutingTableToAreaPayload.createdAt) + && Objects.equals(this._default, addRoutingTableToAreaPayload._default) + && Objects.equals(this.description, addRoutingTableToAreaPayload.description) + && Objects.equals(this.dynamicRoutes, addRoutingTableToAreaPayload.dynamicRoutes) + && Objects.equals(this.id, addRoutingTableToAreaPayload.id) + && Objects.equals(this.labels, addRoutingTableToAreaPayload.labels) + && Objects.equals(this.name, addRoutingTableToAreaPayload.name) + && Objects.equals(this.systemRoutes, addRoutingTableToAreaPayload.systemRoutes) + && Objects.equals(this.updatedAt, addRoutingTableToAreaPayload.updatedAt) + && Objects.equals( + this.additionalProperties, + addRoutingTableToAreaPayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + createdAt, + _default, + description, + dynamicRoutes, + id, + labels, + name, + systemRoutes, + updatedAt, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AddRoutingTableToAreaPayload {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" _default: ").append(toIndentedString(_default)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" dynamicRoutes: ").append(toIndentedString(dynamicRoutes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" systemRoutes: ").append(toIndentedString(systemRoutes)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).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( + "createdAt", + "default", + "description", + "dynamicRoutes", + "id", + "labels", + "name", + "systemRoutes", + "updatedAt")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name")); + } + + /** + * 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 + * AddRoutingTableToAreaPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AddRoutingTableToAreaPayload.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 AddRoutingTableToAreaPayload is not found in the empty JSON string", + AddRoutingTableToAreaPayload.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AddRoutingTableToAreaPayload.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("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `description` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("description").toString())); + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if (!jsonObj.get("name").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())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AddRoutingTableToAreaPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AddRoutingTableToAreaPayload' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(AddRoutingTableToAreaPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AddRoutingTableToAreaPayload 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 AddRoutingTableToAreaPayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AddRoutingTableToAreaPayload 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 AddRoutingTableToAreaPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of AddRoutingTableToAreaPayload + * @throws IOException if the JSON string is invalid with respect to + * AddRoutingTableToAreaPayload + */ + public static AddRoutingTableToAreaPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AddRoutingTableToAreaPayload.class); + } + + /** + * Convert an instance of AddRoutingTableToAreaPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/CreateNetworkIPv4.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/CreateNetworkIPv4.java new file mode 100644 index 00000000..579e9817 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/CreateNetworkIPv4.java @@ -0,0 +1,300 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2alpha1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2alpha1api.model; + +import cloud.stackit.sdk.iaas.v2alpha1api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +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 CreateNetworkIPv4 extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(CreateNetworkIPv4.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateNetworkIPv4.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateNetworkIPv4' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterCreateNetworkIPv4WithPrefix = + gson.getDelegateAdapter(this, TypeToken.get(CreateNetworkIPv4WithPrefix.class)); + final TypeAdapter + adapterCreateNetworkIPv4WithPrefixLength = + gson.getDelegateAdapter( + this, TypeToken.get(CreateNetworkIPv4WithPrefixLength.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateNetworkIPv4 value) + throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type + // `CreateNetworkIPv4WithPrefix` + if (value.getActualInstance() instanceof CreateNetworkIPv4WithPrefix) { + JsonElement element = + adapterCreateNetworkIPv4WithPrefix.toJsonTree( + (CreateNetworkIPv4WithPrefix) + value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type + // `CreateNetworkIPv4WithPrefixLength` + if (value.getActualInstance() + instanceof CreateNetworkIPv4WithPrefixLength) { + JsonElement element = + adapterCreateNetworkIPv4WithPrefixLength.toJsonTree( + (CreateNetworkIPv4WithPrefixLength) + value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException( + "Failed to serialize as the type doesn't match oneOf schemas: CreateNetworkIPv4WithPrefix, CreateNetworkIPv4WithPrefixLength"); + } + + @Override + public CreateNetworkIPv4 read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize CreateNetworkIPv4WithPrefix + try { + // validate the JSON object to see if any exception is thrown + CreateNetworkIPv4WithPrefix.validateJsonElement(jsonElement); + actualAdapter = adapterCreateNetworkIPv4WithPrefix; + match++; + log.log( + Level.FINER, + "Input data matches schema 'CreateNetworkIPv4WithPrefix'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for CreateNetworkIPv4WithPrefix failed with `%s`.", + e.getMessage())); + log.log( + Level.FINER, + "Input data does not match schema 'CreateNetworkIPv4WithPrefix'", + e); + } + // deserialize CreateNetworkIPv4WithPrefixLength + try { + // validate the JSON object to see if any exception is thrown + CreateNetworkIPv4WithPrefixLength.validateJsonElement(jsonElement); + actualAdapter = adapterCreateNetworkIPv4WithPrefixLength; + match++; + log.log( + Level.FINER, + "Input data matches schema 'CreateNetworkIPv4WithPrefixLength'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for CreateNetworkIPv4WithPrefixLength failed with `%s`.", + e.getMessage())); + log.log( + Level.FINER, + "Input data does not match schema 'CreateNetworkIPv4WithPrefixLength'", + e); + } + + if (match == 1) { + CreateNetworkIPv4 ret = new CreateNetworkIPv4(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException( + String.format( + java.util.Locale.ROOT, + "Failed deserialization for CreateNetworkIPv4: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", + match, + errorMessages, + jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public CreateNetworkIPv4() { + super("oneOf", Boolean.FALSE); + } + + public CreateNetworkIPv4(Object o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("CreateNetworkIPv4WithPrefix", CreateNetworkIPv4WithPrefix.class); + schemas.put("CreateNetworkIPv4WithPrefixLength", CreateNetworkIPv4WithPrefixLength.class); + } + + @Override + public Map> getSchemas() { + return CreateNetworkIPv4.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: CreateNetworkIPv4WithPrefix, + * CreateNetworkIPv4WithPrefixLength + * + *

It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof CreateNetworkIPv4WithPrefix) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof CreateNetworkIPv4WithPrefixLength) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException( + "Invalid instance type. Must be CreateNetworkIPv4WithPrefix, CreateNetworkIPv4WithPrefixLength"); + } + + /** + * Get the actual instance, which can be the following: CreateNetworkIPv4WithPrefix, + * CreateNetworkIPv4WithPrefixLength + * + * @return The actual instance (CreateNetworkIPv4WithPrefix, CreateNetworkIPv4WithPrefixLength) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `CreateNetworkIPv4WithPrefix`. If the actual instance is not + * `CreateNetworkIPv4WithPrefix`, the ClassCastException will be thrown. + * + * @return The actual instance of `CreateNetworkIPv4WithPrefix` + * @throws ClassCastException if the instance is not `CreateNetworkIPv4WithPrefix` + */ + public CreateNetworkIPv4WithPrefix getCreateNetworkIPv4WithPrefix() throws ClassCastException { + return (CreateNetworkIPv4WithPrefix) super.getActualInstance(); + } + + /** + * Get the actual instance of `CreateNetworkIPv4WithPrefixLength`. If the actual instance is not + * `CreateNetworkIPv4WithPrefixLength`, the ClassCastException will be thrown. + * + * @return The actual instance of `CreateNetworkIPv4WithPrefixLength` + * @throws ClassCastException if the instance is not `CreateNetworkIPv4WithPrefixLength` + */ + public CreateNetworkIPv4WithPrefixLength getCreateNetworkIPv4WithPrefixLength() + throws ClassCastException { + return (CreateNetworkIPv4WithPrefixLength) 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 CreateNetworkIPv4 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with CreateNetworkIPv4WithPrefix + try { + CreateNetworkIPv4WithPrefix.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for CreateNetworkIPv4WithPrefix failed with `%s`.", + e.getMessage())); + // continue to the next one + } + // validate the json string with CreateNetworkIPv4WithPrefixLength + try { + CreateNetworkIPv4WithPrefixLength.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for CreateNetworkIPv4WithPrefixLength failed with `%s`.", + e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException( + String.format( + java.util.Locale.ROOT, + "The JSON string is invalid for CreateNetworkIPv4 with oneOf schemas: CreateNetworkIPv4WithPrefix, CreateNetworkIPv4WithPrefixLength. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", + validCount, + errorMessages, + jsonElement.toString())); + } + } + + /** + * Create an instance of CreateNetworkIPv4 given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateNetworkIPv4 + * @throws IOException if the JSON string is invalid with respect to CreateNetworkIPv4 + */ + public static CreateNetworkIPv4 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateNetworkIPv4.class); + } + + /** + * Convert an instance of CreateNetworkIPv4 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/CreateNetworkIPv4WithPrefix.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/CreateNetworkIPv4WithPrefix.java new file mode 100644 index 00000000..74bce28b --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/CreateNetworkIPv4WithPrefix.java @@ -0,0 +1,408 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2alpha1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2alpha1api.model; + +import cloud.stackit.sdk.iaas.v2alpha1api.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.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; +import org.openapitools.jackson.nullable.JsonNullable; + +/** The create request for an IPv4 network with a specified prefix. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateNetworkIPv4WithPrefix { + public static final String SERIALIZED_NAME_GATEWAY = "gateway"; + + @SerializedName(SERIALIZED_NAME_GATEWAY) + @javax.annotation.Nullable private String gateway; + + public static final String SERIALIZED_NAME_NAMESERVERS = "nameservers"; + + @SerializedName(SERIALIZED_NAME_NAMESERVERS) + @javax.annotation.Nullable private List nameservers = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PREFIX = "prefix"; + + @SerializedName(SERIALIZED_NAME_PREFIX) + @javax.annotation.Nonnull + private String prefix; + + public CreateNetworkIPv4WithPrefix() {} + + public CreateNetworkIPv4WithPrefix gateway(@javax.annotation.Nullable String gateway) { + this.gateway = gateway; + return this; + } + + /** + * The IPv4 gateway of a network. If not specified the first IP of the network will be assigned + * as the gateway. If 'null' is sent, then the network doesn't have a gateway. + * + * @return gateway + */ + @javax.annotation.Nullable public String getGateway() { + return gateway; + } + + public void setGateway(@javax.annotation.Nullable String gateway) { + this.gateway = gateway; + } + + public CreateNetworkIPv4WithPrefix nameservers( + @javax.annotation.Nullable List nameservers) { + this.nameservers = nameservers; + return this; + } + + public CreateNetworkIPv4WithPrefix addNameserversItem(String nameserversItem) { + if (this.nameservers == null) { + this.nameservers = new ArrayList<>(); + } + this.nameservers.add(nameserversItem); + return this; + } + + /** + * A list containing DNS Servers/Nameservers for IPv4. + * + * @return nameservers + */ + @javax.annotation.Nullable public List getNameservers() { + return nameservers; + } + + public void setNameservers(@javax.annotation.Nullable List nameservers) { + this.nameservers = nameservers; + } + + public CreateNetworkIPv4WithPrefix prefix(@javax.annotation.Nonnull String prefix) { + this.prefix = prefix; + return this; + } + + /** + * IPv4 Classless Inter-Domain Routing (CIDR). + * + * @return prefix + */ + @javax.annotation.Nonnull + public String getPrefix() { + return prefix; + } + + public void setPrefix(@javax.annotation.Nonnull String prefix) { + this.prefix = prefix; + } + + /** + * 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 CreateNetworkIPv4WithPrefix instance itself + */ + public CreateNetworkIPv4WithPrefix 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; + } + CreateNetworkIPv4WithPrefix createNetworkIPv4WithPrefix = (CreateNetworkIPv4WithPrefix) o; + return Objects.equals(this.gateway, createNetworkIPv4WithPrefix.gateway) + && Objects.equals(this.nameservers, createNetworkIPv4WithPrefix.nameservers) + && Objects.equals(this.prefix, createNetworkIPv4WithPrefix.prefix) + && Objects.equals( + this.additionalProperties, + createNetworkIPv4WithPrefix.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(gateway, nameservers, prefix, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateNetworkIPv4WithPrefix {\n"); + sb.append(" gateway: ").append(toIndentedString(gateway)).append("\n"); + sb.append(" nameservers: ").append(toIndentedString(nameservers)).append("\n"); + sb.append(" prefix: ").append(toIndentedString(prefix)).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("gateway", "nameservers", "prefix")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("prefix")); + } + + /** + * 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 + * CreateNetworkIPv4WithPrefix + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateNetworkIPv4WithPrefix.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 CreateNetworkIPv4WithPrefix is not found in the empty JSON string", + CreateNetworkIPv4WithPrefix.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateNetworkIPv4WithPrefix.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("gateway") != null && !jsonObj.get("gateway").isJsonNull()) + && !jsonObj.get("gateway").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `gateway` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("gateway").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("nameservers") != null + && !jsonObj.get("nameservers").isJsonNull() + && !jsonObj.get("nameservers").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `nameservers` to be an array in the JSON string but got `%s`", + jsonObj.get("nameservers").toString())); + } + if (!jsonObj.get("prefix").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `prefix` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("prefix").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateNetworkIPv4WithPrefix.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateNetworkIPv4WithPrefix' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateNetworkIPv4WithPrefix.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateNetworkIPv4WithPrefix 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 CreateNetworkIPv4WithPrefix read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateNetworkIPv4WithPrefix 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 CreateNetworkIPv4WithPrefix given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateNetworkIPv4WithPrefix + * @throws IOException if the JSON string is invalid with respect to CreateNetworkIPv4WithPrefix + */ + public static CreateNetworkIPv4WithPrefix fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateNetworkIPv4WithPrefix.class); + } + + /** + * Convert an instance of CreateNetworkIPv4WithPrefix to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/CreateNetworkIPv4WithPrefixLength.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/CreateNetworkIPv4WithPrefixLength.java new file mode 100644 index 00000000..e96668af --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/CreateNetworkIPv4WithPrefixLength.java @@ -0,0 +1,356 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2alpha1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2alpha1api.model; + +import cloud.stackit.sdk.iaas.v2alpha1api.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.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; + +/** The create request for an IPv4 network with a wanted prefix length. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateNetworkIPv4WithPrefixLength { + public static final String SERIALIZED_NAME_NAMESERVERS = "nameservers"; + + @SerializedName(SERIALIZED_NAME_NAMESERVERS) + @javax.annotation.Nullable private List nameservers = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PREFIX_LENGTH = "prefixLength"; + + @SerializedName(SERIALIZED_NAME_PREFIX_LENGTH) + @javax.annotation.Nonnull + private Long prefixLength; + + public CreateNetworkIPv4WithPrefixLength() {} + + public CreateNetworkIPv4WithPrefixLength nameservers( + @javax.annotation.Nullable List nameservers) { + this.nameservers = nameservers; + return this; + } + + public CreateNetworkIPv4WithPrefixLength addNameserversItem(String nameserversItem) { + if (this.nameservers == null) { + this.nameservers = new ArrayList<>(); + } + this.nameservers.add(nameserversItem); + return this; + } + + /** + * A list containing DNS Servers/Nameservers for IPv4. + * + * @return nameservers + */ + @javax.annotation.Nullable public List getNameservers() { + return nameservers; + } + + public void setNameservers(@javax.annotation.Nullable List nameservers) { + this.nameservers = nameservers; + } + + public CreateNetworkIPv4WithPrefixLength prefixLength( + @javax.annotation.Nonnull Long prefixLength) { + this.prefixLength = prefixLength; + return this; + } + + /** + * Get prefixLength minimum: 8 maximum: 29 + * + * @return prefixLength + */ + @javax.annotation.Nonnull + public Long getPrefixLength() { + return prefixLength; + } + + public void setPrefixLength(@javax.annotation.Nonnull Long prefixLength) { + this.prefixLength = prefixLength; + } + + /** + * 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 CreateNetworkIPv4WithPrefixLength instance itself + */ + public CreateNetworkIPv4WithPrefixLength 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; + } + CreateNetworkIPv4WithPrefixLength createNetworkIPv4WithPrefixLength = + (CreateNetworkIPv4WithPrefixLength) o; + return Objects.equals(this.nameservers, createNetworkIPv4WithPrefixLength.nameservers) + && Objects.equals(this.prefixLength, createNetworkIPv4WithPrefixLength.prefixLength) + && Objects.equals( + this.additionalProperties, + createNetworkIPv4WithPrefixLength.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(nameservers, prefixLength, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateNetworkIPv4WithPrefixLength {\n"); + sb.append(" nameservers: ").append(toIndentedString(nameservers)).append("\n"); + sb.append(" prefixLength: ").append(toIndentedString(prefixLength)).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("nameservers", "prefixLength")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("prefixLength")); + } + + /** + * 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 + * CreateNetworkIPv4WithPrefixLength + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateNetworkIPv4WithPrefixLength.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 CreateNetworkIPv4WithPrefixLength is not found in the empty JSON string", + CreateNetworkIPv4WithPrefixLength.openapiRequiredFields + .toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateNetworkIPv4WithPrefixLength.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 optional json data is an array if present + if (jsonObj.get("nameservers") != null + && !jsonObj.get("nameservers").isJsonNull() + && !jsonObj.get("nameservers").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `nameservers` to be an array in the JSON string but got `%s`", + jsonObj.get("nameservers").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateNetworkIPv4WithPrefixLength.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateNetworkIPv4WithPrefixLength' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateNetworkIPv4WithPrefixLength.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateNetworkIPv4WithPrefixLength 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 CreateNetworkIPv4WithPrefixLength read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateNetworkIPv4WithPrefixLength 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 CreateNetworkIPv4WithPrefixLength given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateNetworkIPv4WithPrefixLength + * @throws IOException if the JSON string is invalid with respect to + * CreateNetworkIPv4WithPrefixLength + */ + public static CreateNetworkIPv4WithPrefixLength fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateNetworkIPv4WithPrefixLength.class); + } + + /** + * Convert an instance of CreateNetworkIPv4WithPrefixLength to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/CreateNetworkIPv6.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/CreateNetworkIPv6.java new file mode 100644 index 00000000..6c65ee18 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/CreateNetworkIPv6.java @@ -0,0 +1,300 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2alpha1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2alpha1api.model; + +import cloud.stackit.sdk.iaas.v2alpha1api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +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 CreateNetworkIPv6 extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(CreateNetworkIPv6.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateNetworkIPv6.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateNetworkIPv6' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterCreateNetworkIPv6WithPrefix = + gson.getDelegateAdapter(this, TypeToken.get(CreateNetworkIPv6WithPrefix.class)); + final TypeAdapter + adapterCreateNetworkIPv6WithPrefixLength = + gson.getDelegateAdapter( + this, TypeToken.get(CreateNetworkIPv6WithPrefixLength.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateNetworkIPv6 value) + throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type + // `CreateNetworkIPv6WithPrefix` + if (value.getActualInstance() instanceof CreateNetworkIPv6WithPrefix) { + JsonElement element = + adapterCreateNetworkIPv6WithPrefix.toJsonTree( + (CreateNetworkIPv6WithPrefix) + value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type + // `CreateNetworkIPv6WithPrefixLength` + if (value.getActualInstance() + instanceof CreateNetworkIPv6WithPrefixLength) { + JsonElement element = + adapterCreateNetworkIPv6WithPrefixLength.toJsonTree( + (CreateNetworkIPv6WithPrefixLength) + value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException( + "Failed to serialize as the type doesn't match oneOf schemas: CreateNetworkIPv6WithPrefix, CreateNetworkIPv6WithPrefixLength"); + } + + @Override + public CreateNetworkIPv6 read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize CreateNetworkIPv6WithPrefix + try { + // validate the JSON object to see if any exception is thrown + CreateNetworkIPv6WithPrefix.validateJsonElement(jsonElement); + actualAdapter = adapterCreateNetworkIPv6WithPrefix; + match++; + log.log( + Level.FINER, + "Input data matches schema 'CreateNetworkIPv6WithPrefix'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for CreateNetworkIPv6WithPrefix failed with `%s`.", + e.getMessage())); + log.log( + Level.FINER, + "Input data does not match schema 'CreateNetworkIPv6WithPrefix'", + e); + } + // deserialize CreateNetworkIPv6WithPrefixLength + try { + // validate the JSON object to see if any exception is thrown + CreateNetworkIPv6WithPrefixLength.validateJsonElement(jsonElement); + actualAdapter = adapterCreateNetworkIPv6WithPrefixLength; + match++; + log.log( + Level.FINER, + "Input data matches schema 'CreateNetworkIPv6WithPrefixLength'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for CreateNetworkIPv6WithPrefixLength failed with `%s`.", + e.getMessage())); + log.log( + Level.FINER, + "Input data does not match schema 'CreateNetworkIPv6WithPrefixLength'", + e); + } + + if (match == 1) { + CreateNetworkIPv6 ret = new CreateNetworkIPv6(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException( + String.format( + java.util.Locale.ROOT, + "Failed deserialization for CreateNetworkIPv6: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", + match, + errorMessages, + jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public CreateNetworkIPv6() { + super("oneOf", Boolean.FALSE); + } + + public CreateNetworkIPv6(Object o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("CreateNetworkIPv6WithPrefix", CreateNetworkIPv6WithPrefix.class); + schemas.put("CreateNetworkIPv6WithPrefixLength", CreateNetworkIPv6WithPrefixLength.class); + } + + @Override + public Map> getSchemas() { + return CreateNetworkIPv6.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: CreateNetworkIPv6WithPrefix, + * CreateNetworkIPv6WithPrefixLength + * + *

It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof CreateNetworkIPv6WithPrefix) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof CreateNetworkIPv6WithPrefixLength) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException( + "Invalid instance type. Must be CreateNetworkIPv6WithPrefix, CreateNetworkIPv6WithPrefixLength"); + } + + /** + * Get the actual instance, which can be the following: CreateNetworkIPv6WithPrefix, + * CreateNetworkIPv6WithPrefixLength + * + * @return The actual instance (CreateNetworkIPv6WithPrefix, CreateNetworkIPv6WithPrefixLength) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `CreateNetworkIPv6WithPrefix`. If the actual instance is not + * `CreateNetworkIPv6WithPrefix`, the ClassCastException will be thrown. + * + * @return The actual instance of `CreateNetworkIPv6WithPrefix` + * @throws ClassCastException if the instance is not `CreateNetworkIPv6WithPrefix` + */ + public CreateNetworkIPv6WithPrefix getCreateNetworkIPv6WithPrefix() throws ClassCastException { + return (CreateNetworkIPv6WithPrefix) super.getActualInstance(); + } + + /** + * Get the actual instance of `CreateNetworkIPv6WithPrefixLength`. If the actual instance is not + * `CreateNetworkIPv6WithPrefixLength`, the ClassCastException will be thrown. + * + * @return The actual instance of `CreateNetworkIPv6WithPrefixLength` + * @throws ClassCastException if the instance is not `CreateNetworkIPv6WithPrefixLength` + */ + public CreateNetworkIPv6WithPrefixLength getCreateNetworkIPv6WithPrefixLength() + throws ClassCastException { + return (CreateNetworkIPv6WithPrefixLength) 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 CreateNetworkIPv6 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with CreateNetworkIPv6WithPrefix + try { + CreateNetworkIPv6WithPrefix.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for CreateNetworkIPv6WithPrefix failed with `%s`.", + e.getMessage())); + // continue to the next one + } + // validate the json string with CreateNetworkIPv6WithPrefixLength + try { + CreateNetworkIPv6WithPrefixLength.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for CreateNetworkIPv6WithPrefixLength failed with `%s`.", + e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException( + String.format( + java.util.Locale.ROOT, + "The JSON string is invalid for CreateNetworkIPv6 with oneOf schemas: CreateNetworkIPv6WithPrefix, CreateNetworkIPv6WithPrefixLength. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", + validCount, + errorMessages, + jsonElement.toString())); + } + } + + /** + * Create an instance of CreateNetworkIPv6 given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateNetworkIPv6 + * @throws IOException if the JSON string is invalid with respect to CreateNetworkIPv6 + */ + public static CreateNetworkIPv6 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateNetworkIPv6.class); + } + + /** + * Convert an instance of CreateNetworkIPv6 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/CreateNetworkIPv6WithPrefix.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/CreateNetworkIPv6WithPrefix.java new file mode 100644 index 00000000..da05964f --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/CreateNetworkIPv6WithPrefix.java @@ -0,0 +1,408 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2alpha1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2alpha1api.model; + +import cloud.stackit.sdk.iaas.v2alpha1api.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.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; +import org.openapitools.jackson.nullable.JsonNullable; + +/** The create request for an IPv6 network with a specified prefix. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateNetworkIPv6WithPrefix { + public static final String SERIALIZED_NAME_GATEWAY = "gateway"; + + @SerializedName(SERIALIZED_NAME_GATEWAY) + @javax.annotation.Nullable private String gateway; + + public static final String SERIALIZED_NAME_NAMESERVERS = "nameservers"; + + @SerializedName(SERIALIZED_NAME_NAMESERVERS) + @javax.annotation.Nullable private List nameservers = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PREFIX = "prefix"; + + @SerializedName(SERIALIZED_NAME_PREFIX) + @javax.annotation.Nonnull + private String prefix; + + public CreateNetworkIPv6WithPrefix() {} + + public CreateNetworkIPv6WithPrefix gateway(@javax.annotation.Nullable String gateway) { + this.gateway = gateway; + return this; + } + + /** + * The IPv6 gateway of a network. If not specified the first IP of the network will be assigned + * as the gateway. If 'null' is sent, then the network doesn't have a gateway. + * + * @return gateway + */ + @javax.annotation.Nullable public String getGateway() { + return gateway; + } + + public void setGateway(@javax.annotation.Nullable String gateway) { + this.gateway = gateway; + } + + public CreateNetworkIPv6WithPrefix nameservers( + @javax.annotation.Nullable List nameservers) { + this.nameservers = nameservers; + return this; + } + + public CreateNetworkIPv6WithPrefix addNameserversItem(String nameserversItem) { + if (this.nameservers == null) { + this.nameservers = new ArrayList<>(); + } + this.nameservers.add(nameserversItem); + return this; + } + + /** + * A list containing DNS Servers/Nameservers for IPv6. + * + * @return nameservers + */ + @javax.annotation.Nullable public List getNameservers() { + return nameservers; + } + + public void setNameservers(@javax.annotation.Nullable List nameservers) { + this.nameservers = nameservers; + } + + public CreateNetworkIPv6WithPrefix prefix(@javax.annotation.Nonnull String prefix) { + this.prefix = prefix; + return this; + } + + /** + * Classless Inter-Domain Routing (CIDR) for IPv6. + * + * @return prefix + */ + @javax.annotation.Nonnull + public String getPrefix() { + return prefix; + } + + public void setPrefix(@javax.annotation.Nonnull String prefix) { + this.prefix = prefix; + } + + /** + * 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 CreateNetworkIPv6WithPrefix instance itself + */ + public CreateNetworkIPv6WithPrefix 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; + } + CreateNetworkIPv6WithPrefix createNetworkIPv6WithPrefix = (CreateNetworkIPv6WithPrefix) o; + return Objects.equals(this.gateway, createNetworkIPv6WithPrefix.gateway) + && Objects.equals(this.nameservers, createNetworkIPv6WithPrefix.nameservers) + && Objects.equals(this.prefix, createNetworkIPv6WithPrefix.prefix) + && Objects.equals( + this.additionalProperties, + createNetworkIPv6WithPrefix.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(gateway, nameservers, prefix, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateNetworkIPv6WithPrefix {\n"); + sb.append(" gateway: ").append(toIndentedString(gateway)).append("\n"); + sb.append(" nameservers: ").append(toIndentedString(nameservers)).append("\n"); + sb.append(" prefix: ").append(toIndentedString(prefix)).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("gateway", "nameservers", "prefix")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("prefix")); + } + + /** + * 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 + * CreateNetworkIPv6WithPrefix + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateNetworkIPv6WithPrefix.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 CreateNetworkIPv6WithPrefix is not found in the empty JSON string", + CreateNetworkIPv6WithPrefix.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateNetworkIPv6WithPrefix.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("gateway") != null && !jsonObj.get("gateway").isJsonNull()) + && !jsonObj.get("gateway").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `gateway` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("gateway").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("nameservers") != null + && !jsonObj.get("nameservers").isJsonNull() + && !jsonObj.get("nameservers").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `nameservers` to be an array in the JSON string but got `%s`", + jsonObj.get("nameservers").toString())); + } + if (!jsonObj.get("prefix").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `prefix` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("prefix").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateNetworkIPv6WithPrefix.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateNetworkIPv6WithPrefix' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateNetworkIPv6WithPrefix.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateNetworkIPv6WithPrefix 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 CreateNetworkIPv6WithPrefix read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateNetworkIPv6WithPrefix 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 CreateNetworkIPv6WithPrefix given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateNetworkIPv6WithPrefix + * @throws IOException if the JSON string is invalid with respect to CreateNetworkIPv6WithPrefix + */ + public static CreateNetworkIPv6WithPrefix fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateNetworkIPv6WithPrefix.class); + } + + /** + * Convert an instance of CreateNetworkIPv6WithPrefix to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/CreateNetworkIPv6WithPrefixLength.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/CreateNetworkIPv6WithPrefixLength.java new file mode 100644 index 00000000..8374607f --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/CreateNetworkIPv6WithPrefixLength.java @@ -0,0 +1,356 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2alpha1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2alpha1api.model; + +import cloud.stackit.sdk.iaas.v2alpha1api.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.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; + +/** The create request for an IPv6 network with a wanted prefix length. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateNetworkIPv6WithPrefixLength { + public static final String SERIALIZED_NAME_NAMESERVERS = "nameservers"; + + @SerializedName(SERIALIZED_NAME_NAMESERVERS) + @javax.annotation.Nullable private List nameservers = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PREFIX_LENGTH = "prefixLength"; + + @SerializedName(SERIALIZED_NAME_PREFIX_LENGTH) + @javax.annotation.Nonnull + private Long prefixLength; + + public CreateNetworkIPv6WithPrefixLength() {} + + public CreateNetworkIPv6WithPrefixLength nameservers( + @javax.annotation.Nullable List nameservers) { + this.nameservers = nameservers; + return this; + } + + public CreateNetworkIPv6WithPrefixLength addNameserversItem(String nameserversItem) { + if (this.nameservers == null) { + this.nameservers = new ArrayList<>(); + } + this.nameservers.add(nameserversItem); + return this; + } + + /** + * A list containing DNS Servers/Nameservers for IPv6. + * + * @return nameservers + */ + @javax.annotation.Nullable public List getNameservers() { + return nameservers; + } + + public void setNameservers(@javax.annotation.Nullable List nameservers) { + this.nameservers = nameservers; + } + + public CreateNetworkIPv6WithPrefixLength prefixLength( + @javax.annotation.Nonnull Long prefixLength) { + this.prefixLength = prefixLength; + return this; + } + + /** + * Get prefixLength minimum: 56 maximum: 128 + * + * @return prefixLength + */ + @javax.annotation.Nonnull + public Long getPrefixLength() { + return prefixLength; + } + + public void setPrefixLength(@javax.annotation.Nonnull Long prefixLength) { + this.prefixLength = prefixLength; + } + + /** + * 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 CreateNetworkIPv6WithPrefixLength instance itself + */ + public CreateNetworkIPv6WithPrefixLength 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; + } + CreateNetworkIPv6WithPrefixLength createNetworkIPv6WithPrefixLength = + (CreateNetworkIPv6WithPrefixLength) o; + return Objects.equals(this.nameservers, createNetworkIPv6WithPrefixLength.nameservers) + && Objects.equals(this.prefixLength, createNetworkIPv6WithPrefixLength.prefixLength) + && Objects.equals( + this.additionalProperties, + createNetworkIPv6WithPrefixLength.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(nameservers, prefixLength, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateNetworkIPv6WithPrefixLength {\n"); + sb.append(" nameservers: ").append(toIndentedString(nameservers)).append("\n"); + sb.append(" prefixLength: ").append(toIndentedString(prefixLength)).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("nameservers", "prefixLength")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("prefixLength")); + } + + /** + * 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 + * CreateNetworkIPv6WithPrefixLength + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateNetworkIPv6WithPrefixLength.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 CreateNetworkIPv6WithPrefixLength is not found in the empty JSON string", + CreateNetworkIPv6WithPrefixLength.openapiRequiredFields + .toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateNetworkIPv6WithPrefixLength.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 optional json data is an array if present + if (jsonObj.get("nameservers") != null + && !jsonObj.get("nameservers").isJsonNull() + && !jsonObj.get("nameservers").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `nameservers` to be an array in the JSON string but got `%s`", + jsonObj.get("nameservers").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateNetworkIPv6WithPrefixLength.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateNetworkIPv6WithPrefixLength' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateNetworkIPv6WithPrefixLength.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateNetworkIPv6WithPrefixLength 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 CreateNetworkIPv6WithPrefixLength read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateNetworkIPv6WithPrefixLength 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 CreateNetworkIPv6WithPrefixLength given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateNetworkIPv6WithPrefixLength + * @throws IOException if the JSON string is invalid with respect to + * CreateNetworkIPv6WithPrefixLength + */ + public static CreateNetworkIPv6WithPrefixLength fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateNetworkIPv6WithPrefixLength.class); + } + + /** + * Convert an instance of CreateNetworkIPv6WithPrefixLength to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/CreateNetworkPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/CreateNetworkPayload.java new file mode 100644 index 00000000..7a949ab5 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/CreateNetworkPayload.java @@ -0,0 +1,489 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2alpha1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2alpha1api.model; + +import cloud.stackit.sdk.iaas.v2alpha1api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +/** Object that represents the request body for a network create. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateNetworkPayload { + public static final String SERIALIZED_NAME_DHCP = "dhcp"; + + @SerializedName(SERIALIZED_NAME_DHCP) + @javax.annotation.Nullable private Boolean dhcp = true; + + public static final String SERIALIZED_NAME_IPV4 = "ipv4"; + + @SerializedName(SERIALIZED_NAME_IPV4) + @javax.annotation.Nullable private CreateNetworkIPv4 ipv4; + + public static final String SERIALIZED_NAME_IPV6 = "ipv6"; + + @SerializedName(SERIALIZED_NAME_IPV6) + @javax.annotation.Nullable private CreateNetworkIPv6 ipv6; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_ROUTED = "routed"; + + @SerializedName(SERIALIZED_NAME_ROUTED) + @javax.annotation.Nullable private Boolean routed; + + public static final String SERIALIZED_NAME_ROUTING_TABLE_ID = "routingTableId"; + + @SerializedName(SERIALIZED_NAME_ROUTING_TABLE_ID) + @javax.annotation.Nullable private UUID routingTableId; + + public CreateNetworkPayload() {} + + public CreateNetworkPayload dhcp(@javax.annotation.Nullable Boolean dhcp) { + this.dhcp = dhcp; + return this; + } + + /** + * Enable or disable DHCP for a network. + * + * @return dhcp + */ + @javax.annotation.Nullable public Boolean getDhcp() { + return dhcp; + } + + public void setDhcp(@javax.annotation.Nullable Boolean dhcp) { + this.dhcp = dhcp; + } + + public CreateNetworkPayload ipv4(@javax.annotation.Nullable CreateNetworkIPv4 ipv4) { + this.ipv4 = ipv4; + return this; + } + + /** + * Get ipv4 + * + * @return ipv4 + */ + @javax.annotation.Nullable public CreateNetworkIPv4 getIpv4() { + return ipv4; + } + + public void setIpv4(@javax.annotation.Nullable CreateNetworkIPv4 ipv4) { + this.ipv4 = ipv4; + } + + public CreateNetworkPayload ipv6(@javax.annotation.Nullable CreateNetworkIPv6 ipv6) { + this.ipv6 = ipv6; + return this; + } + + /** + * Get ipv6 + * + * @return ipv6 + */ + @javax.annotation.Nullable public CreateNetworkIPv6 getIpv6() { + return ipv6; + } + + public void setIpv6(@javax.annotation.Nullable CreateNetworkIPv6 ipv6) { + this.ipv6 = ipv6; + } + + public CreateNetworkPayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public CreateNetworkPayload name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + public CreateNetworkPayload routed(@javax.annotation.Nullable Boolean routed) { + this.routed = routed; + return this; + } + + /** + * Shows if the network is routed and therefore accessible from other networks. + * + * @return routed + */ + @javax.annotation.Nullable public Boolean getRouted() { + return routed; + } + + public void setRouted(@javax.annotation.Nullable Boolean routed) { + this.routed = routed; + } + + public CreateNetworkPayload routingTableId(@javax.annotation.Nullable UUID routingTableId) { + this.routingTableId = routingTableId; + return this; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return routingTableId + */ + @javax.annotation.Nullable public UUID getRoutingTableId() { + return routingTableId; + } + + public void setRoutingTableId(@javax.annotation.Nullable UUID routingTableId) { + this.routingTableId = routingTableId; + } + + /** + * 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 CreateNetworkPayload instance itself + */ + public CreateNetworkPayload 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; + } + CreateNetworkPayload createNetworkPayload = (CreateNetworkPayload) o; + return Objects.equals(this.dhcp, createNetworkPayload.dhcp) + && Objects.equals(this.ipv4, createNetworkPayload.ipv4) + && Objects.equals(this.ipv6, createNetworkPayload.ipv6) + && Objects.equals(this.labels, createNetworkPayload.labels) + && Objects.equals(this.name, createNetworkPayload.name) + && Objects.equals(this.routed, createNetworkPayload.routed) + && Objects.equals(this.routingTableId, createNetworkPayload.routingTableId) + && Objects.equals( + this.additionalProperties, createNetworkPayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + dhcp, ipv4, ipv6, labels, name, routed, routingTableId, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateNetworkPayload {\n"); + sb.append(" dhcp: ").append(toIndentedString(dhcp)).append("\n"); + sb.append(" ipv4: ").append(toIndentedString(ipv4)).append("\n"); + sb.append(" ipv6: ").append(toIndentedString(ipv6)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" routed: ").append(toIndentedString(routed)).append("\n"); + sb.append(" routingTableId: ").append(toIndentedString(routingTableId)).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( + "dhcp", + "ipv4", + "ipv6", + "labels", + "name", + "routed", + "routingTableId")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name")); + } + + /** + * 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 CreateNetworkPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateNetworkPayload.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 CreateNetworkPayload is not found in the empty JSON string", + CreateNetworkPayload.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateNetworkPayload.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 optional field `ipv4` + if (jsonObj.get("ipv4") != null && !jsonObj.get("ipv4").isJsonNull()) { + CreateNetworkIPv4.validateJsonElement(jsonObj.get("ipv4")); + } + // validate the optional field `ipv6` + if (jsonObj.get("ipv6") != null && !jsonObj.get("ipv6").isJsonNull()) { + CreateNetworkIPv6.validateJsonElement(jsonObj.get("ipv6")); + } + 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("routingTableId") != null && !jsonObj.get("routingTableId").isJsonNull()) + && !jsonObj.get("routingTableId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `routingTableId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("routingTableId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateNetworkPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateNetworkPayload' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateNetworkPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateNetworkPayload 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 CreateNetworkPayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateNetworkPayload 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 CreateNetworkPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateNetworkPayload + * @throws IOException if the JSON string is invalid with respect to CreateNetworkPayload + */ + public static CreateNetworkPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateNetworkPayload.class); + } + + /** + * Convert an instance of CreateNetworkPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/DestinationCIDRv4.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/DestinationCIDRv4.java new file mode 100644 index 00000000..8d75f9a8 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/DestinationCIDRv4.java @@ -0,0 +1,342 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2alpha1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2alpha1api.model; + +import cloud.stackit.sdk.iaas.v2alpha1api.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; + +/** IPv4 Classless Inter-Domain Routing (CIDR) Object. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class DestinationCIDRv4 { + public static final String SERIALIZED_NAME_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private String type; + + public static final String SERIALIZED_NAME_VALUE = "value"; + + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nonnull + private String value; + + public DestinationCIDRv4() {} + + public DestinationCIDRv4 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; + } + + public DestinationCIDRv4 value(@javax.annotation.Nonnull String value) { + this.value = value; + return this; + } + + /** + * An CIDRv4 string. + * + * @return value + */ + @javax.annotation.Nonnull + public String getValue() { + return value; + } + + public void setValue(@javax.annotation.Nonnull String value) { + this.value = value; + } + + /** + * 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 DestinationCIDRv4 instance itself + */ + public DestinationCIDRv4 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; + } + DestinationCIDRv4 destinationCIDRv4 = (DestinationCIDRv4) o; + return Objects.equals(this.type, destinationCIDRv4.type) + && Objects.equals(this.value, destinationCIDRv4.value) + && Objects.equals( + this.additionalProperties, destinationCIDRv4.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(type, value, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DestinationCIDRv4 {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).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("type", "value")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("type", "value")); + } + + /** + * 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 DestinationCIDRv4 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DestinationCIDRv4.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 DestinationCIDRv4 is not found in the empty JSON string", + DestinationCIDRv4.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DestinationCIDRv4.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("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())); + } + if (!jsonObj.get("value").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `value` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("value").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DestinationCIDRv4.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DestinationCIDRv4' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DestinationCIDRv4.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DestinationCIDRv4 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 DestinationCIDRv4 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + DestinationCIDRv4 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 DestinationCIDRv4 given an JSON string + * + * @param jsonString JSON string + * @return An instance of DestinationCIDRv4 + * @throws IOException if the JSON string is invalid with respect to DestinationCIDRv4 + */ + public static DestinationCIDRv4 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DestinationCIDRv4.class); + } + + /** + * Convert an instance of DestinationCIDRv4 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/DestinationCIDRv6.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/DestinationCIDRv6.java new file mode 100644 index 00000000..6d9bf0d0 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/DestinationCIDRv6.java @@ -0,0 +1,342 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2alpha1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2alpha1api.model; + +import cloud.stackit.sdk.iaas.v2alpha1api.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; + +/** IPv6 Classless Inter-Domain Routing (CIDR) Object. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class DestinationCIDRv6 { + public static final String SERIALIZED_NAME_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private String type; + + public static final String SERIALIZED_NAME_VALUE = "value"; + + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nonnull + private String value; + + public DestinationCIDRv6() {} + + public DestinationCIDRv6 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; + } + + public DestinationCIDRv6 value(@javax.annotation.Nonnull String value) { + this.value = value; + return this; + } + + /** + * An CIDRv6 string. + * + * @return value + */ + @javax.annotation.Nonnull + public String getValue() { + return value; + } + + public void setValue(@javax.annotation.Nonnull String value) { + this.value = value; + } + + /** + * 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 DestinationCIDRv6 instance itself + */ + public DestinationCIDRv6 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; + } + DestinationCIDRv6 destinationCIDRv6 = (DestinationCIDRv6) o; + return Objects.equals(this.type, destinationCIDRv6.type) + && Objects.equals(this.value, destinationCIDRv6.value) + && Objects.equals( + this.additionalProperties, destinationCIDRv6.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(type, value, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DestinationCIDRv6 {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).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("type", "value")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("type", "value")); + } + + /** + * 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 DestinationCIDRv6 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DestinationCIDRv6.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 DestinationCIDRv6 is not found in the empty JSON string", + DestinationCIDRv6.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DestinationCIDRv6.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("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())); + } + if (!jsonObj.get("value").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `value` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("value").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DestinationCIDRv6.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DestinationCIDRv6' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DestinationCIDRv6.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DestinationCIDRv6 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 DestinationCIDRv6 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + DestinationCIDRv6 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 DestinationCIDRv6 given an JSON string + * + * @param jsonString JSON string + * @return An instance of DestinationCIDRv6 + * @throws IOException if the JSON string is invalid with respect to DestinationCIDRv6 + */ + public static DestinationCIDRv6 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DestinationCIDRv6.class); + } + + /** + * Convert an instance of DestinationCIDRv6 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/Error.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/Error.java new file mode 100644 index 00000000..bcc5fabd --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/Error.java @@ -0,0 +1,333 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2alpha1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2alpha1api.model; + +import cloud.stackit.sdk.iaas.v2alpha1api.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; + +/** Error with HTTP error code and an error message. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class Error { + public static final String SERIALIZED_NAME_CODE = "code"; + + @SerializedName(SERIALIZED_NAME_CODE) + @javax.annotation.Nonnull + private Long code; + + public static final String SERIALIZED_NAME_MSG = "msg"; + + @SerializedName(SERIALIZED_NAME_MSG) + @javax.annotation.Nonnull + private String msg; + + public Error() {} + + public Error code(@javax.annotation.Nonnull Long code) { + this.code = code; + return this; + } + + /** + * Get code + * + * @return code + */ + @javax.annotation.Nonnull + public Long getCode() { + return code; + } + + public void setCode(@javax.annotation.Nonnull Long code) { + this.code = code; + } + + public Error msg(@javax.annotation.Nonnull String msg) { + this.msg = msg; + return this; + } + + /** + * An error message. + * + * @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 Error instance itself + */ + public Error 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; + } + Error error = (Error) o; + return Objects.equals(this.code, error.code) + && Objects.equals(this.msg, error.msg) + && Objects.equals(this.additionalProperties, error.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(code, msg, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Error {\n"); + sb.append(" code: ").append(toIndentedString(code)).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("code", "msg")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("code", "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 Error + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Error.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 Error is not found in the empty JSON string", + Error.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Error.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("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 (!Error.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Error' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(Error.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, Error 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 Error read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Error 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 Error given an JSON string + * + * @param jsonString JSON string + * @return An instance of Error + * @throws IOException if the JSON string is invalid with respect to Error + */ + public static Error fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Error.class); + } + + /** + * Convert an instance of Error to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/Network.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/Network.java new file mode 100644 index 00000000..506d55d6 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/Network.java @@ -0,0 +1,614 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2alpha1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2alpha1api.model; + +import cloud.stackit.sdk.iaas.v2alpha1api.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; +import java.util.UUID; + +/** + * Object that represents a network. If no routing table is specified, the default routing table is + * used. + */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class Network { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_DHCP = "dhcp"; + + @SerializedName(SERIALIZED_NAME_DHCP) + @javax.annotation.Nullable private Boolean dhcp; + + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private UUID id; + + public static final String SERIALIZED_NAME_IPV4 = "ipv4"; + + @SerializedName(SERIALIZED_NAME_IPV4) + @javax.annotation.Nullable private NetworkIPv4 ipv4; + + public static final String SERIALIZED_NAME_IPV6 = "ipv6"; + + @SerializedName(SERIALIZED_NAME_IPV6) + @javax.annotation.Nullable private NetworkIPv6 ipv6; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_ROUTED = "routed"; + + @SerializedName(SERIALIZED_NAME_ROUTED) + @javax.annotation.Nullable private Boolean routed; + + public static final String SERIALIZED_NAME_ROUTING_TABLE_ID = "routingTableId"; + + @SerializedName(SERIALIZED_NAME_ROUTING_TABLE_ID) + @javax.annotation.Nullable private UUID routingTableId; + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nonnull + private String status; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable private OffsetDateTime updatedAt; + + public Network() {} + + public Network(OffsetDateTime createdAt, OffsetDateTime updatedAt) { + this(); + this.createdAt = createdAt; + this.updatedAt = updatedAt; + } + + /** + * Date-time when resource was created. + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public Network dhcp(@javax.annotation.Nullable Boolean dhcp) { + this.dhcp = dhcp; + return this; + } + + /** + * Enable or disable DHCP for a network. + * + * @return dhcp + */ + @javax.annotation.Nullable public Boolean getDhcp() { + return dhcp; + } + + public void setDhcp(@javax.annotation.Nullable Boolean dhcp) { + this.dhcp = dhcp; + } + + public Network id(@javax.annotation.Nonnull UUID id) { + this.id = id; + return this; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nonnull + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull UUID id) { + this.id = id; + } + + public Network ipv4(@javax.annotation.Nullable NetworkIPv4 ipv4) { + this.ipv4 = ipv4; + return this; + } + + /** + * Get ipv4 + * + * @return ipv4 + */ + @javax.annotation.Nullable public NetworkIPv4 getIpv4() { + return ipv4; + } + + public void setIpv4(@javax.annotation.Nullable NetworkIPv4 ipv4) { + this.ipv4 = ipv4; + } + + public Network ipv6(@javax.annotation.Nullable NetworkIPv6 ipv6) { + this.ipv6 = ipv6; + return this; + } + + /** + * Get ipv6 + * + * @return ipv6 + */ + @javax.annotation.Nullable public NetworkIPv6 getIpv6() { + return ipv6; + } + + public void setIpv6(@javax.annotation.Nullable NetworkIPv6 ipv6) { + this.ipv6 = ipv6; + } + + public Network labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public Network 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 Network routed(@javax.annotation.Nullable Boolean routed) { + this.routed = routed; + return this; + } + + /** + * Shows if the network is routed and therefore accessible from other networks. + * + * @return routed + */ + @javax.annotation.Nullable public Boolean getRouted() { + return routed; + } + + public void setRouted(@javax.annotation.Nullable Boolean routed) { + this.routed = routed; + } + + public Network routingTableId(@javax.annotation.Nullable UUID routingTableId) { + this.routingTableId = routingTableId; + return this; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return routingTableId + */ + @javax.annotation.Nullable public UUID getRoutingTableId() { + return routingTableId; + } + + public void setRoutingTableId(@javax.annotation.Nullable UUID routingTableId) { + this.routingTableId = routingTableId; + } + + public Network status(@javax.annotation.Nonnull String status) { + this.status = status; + return this; + } + + /** + * The state of a resource object. Possible values: `CREATING`, `CREATED`, + * `DELETING`, `DELETED`, `FAILED`, `UPDATED`, + * `UPDATING`. + * + * @return status + */ + @javax.annotation.Nonnull + public String getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nonnull String status) { + this.status = status; + } + + /** + * Date-time when resource was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nullable public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * 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 Network instance itself + */ + public Network 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; + } + Network network = (Network) o; + return Objects.equals(this.createdAt, network.createdAt) + && Objects.equals(this.dhcp, network.dhcp) + && Objects.equals(this.id, network.id) + && Objects.equals(this.ipv4, network.ipv4) + && Objects.equals(this.ipv6, network.ipv6) + && Objects.equals(this.labels, network.labels) + && Objects.equals(this.name, network.name) + && Objects.equals(this.routed, network.routed) + && Objects.equals(this.routingTableId, network.routingTableId) + && Objects.equals(this.status, network.status) + && Objects.equals(this.updatedAt, network.updatedAt) + && Objects.equals(this.additionalProperties, network.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + createdAt, + dhcp, + id, + ipv4, + ipv6, + labels, + name, + routed, + routingTableId, + status, + updatedAt, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Network {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" dhcp: ").append(toIndentedString(dhcp)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" ipv4: ").append(toIndentedString(ipv4)).append("\n"); + sb.append(" ipv6: ").append(toIndentedString(ipv6)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" routed: ").append(toIndentedString(routed)).append("\n"); + sb.append(" routingTableId: ").append(toIndentedString(routingTableId)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).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( + "createdAt", + "dhcp", + "id", + "ipv4", + "ipv6", + "labels", + "name", + "routed", + "routingTableId", + "status", + "updatedAt")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("id", "name", "status")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Network + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Network.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 Network is not found in the empty JSON string", + Network.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Network.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("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + // validate the optional field `ipv4` + if (jsonObj.get("ipv4") != null && !jsonObj.get("ipv4").isJsonNull()) { + NetworkIPv4.validateJsonElement(jsonObj.get("ipv4")); + } + // validate the optional field `ipv6` + if (jsonObj.get("ipv6") != null && !jsonObj.get("ipv6").isJsonNull()) { + NetworkIPv6.validateJsonElement(jsonObj.get("ipv6")); + } + 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("routingTableId") != null && !jsonObj.get("routingTableId").isJsonNull()) + && !jsonObj.get("routingTableId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `routingTableId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("routingTableId").toString())); + } + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `status` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("status").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Network.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Network' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(Network.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, Network 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 Network read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Network 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 Network given an JSON string + * + * @param jsonString JSON string + * @return An instance of Network + * @throws IOException if the JSON string is invalid with respect to Network + */ + public static Network fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Network.class); + } + + /** + * Convert an instance of Network to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/NetworkIPv4.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/NetworkIPv4.java new file mode 100644 index 00000000..c214e2ee --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/NetworkIPv4.java @@ -0,0 +1,444 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2alpha1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2alpha1api.model; + +import cloud.stackit.sdk.iaas.v2alpha1api.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.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; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Object that represents the IPv4 part of a network. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class NetworkIPv4 { + public static final String SERIALIZED_NAME_GATEWAY = "gateway"; + + @SerializedName(SERIALIZED_NAME_GATEWAY) + @javax.annotation.Nullable private String gateway; + + public static final String SERIALIZED_NAME_NAMESERVERS = "nameservers"; + + @SerializedName(SERIALIZED_NAME_NAMESERVERS) + @javax.annotation.Nullable private List nameservers = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PREFIXES = "prefixes"; + + @SerializedName(SERIALIZED_NAME_PREFIXES) + @javax.annotation.Nonnull + private List prefixes = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PUBLIC_IP = "publicIp"; + + @SerializedName(SERIALIZED_NAME_PUBLIC_IP) + @javax.annotation.Nullable private String publicIp; + + public NetworkIPv4() {} + + public NetworkIPv4(String publicIp) { + this(); + this.publicIp = publicIp; + } + + public NetworkIPv4 gateway(@javax.annotation.Nullable String gateway) { + this.gateway = gateway; + return this; + } + + /** + * The IPv4 gateway of a network. If not specified the first IP of the network will be assigned + * as the gateway. If 'null' is sent, then the network doesn't have a gateway. + * + * @return gateway + */ + @javax.annotation.Nullable public String getGateway() { + return gateway; + } + + public void setGateway(@javax.annotation.Nullable String gateway) { + this.gateway = gateway; + } + + public NetworkIPv4 nameservers(@javax.annotation.Nullable List nameservers) { + this.nameservers = nameservers; + return this; + } + + public NetworkIPv4 addNameserversItem(String nameserversItem) { + if (this.nameservers == null) { + this.nameservers = new ArrayList<>(); + } + this.nameservers.add(nameserversItem); + return this; + } + + /** + * A list containing DNS Servers/Nameservers for IPv4. + * + * @return nameservers + */ + @javax.annotation.Nullable public List getNameservers() { + return nameservers; + } + + public void setNameservers(@javax.annotation.Nullable List nameservers) { + this.nameservers = nameservers; + } + + public NetworkIPv4 prefixes(@javax.annotation.Nonnull List prefixes) { + this.prefixes = prefixes; + return this; + } + + public NetworkIPv4 addPrefixesItem(String prefixesItem) { + if (this.prefixes == null) { + this.prefixes = new ArrayList<>(); + } + this.prefixes.add(prefixesItem); + return this; + } + + /** + * Get prefixes + * + * @return prefixes + */ + @javax.annotation.Nonnull + public List getPrefixes() { + return prefixes; + } + + public void setPrefixes(@javax.annotation.Nonnull List prefixes) { + this.prefixes = prefixes; + } + + /** + * String that represents an IPv4 address. + * + * @return publicIp + */ + @javax.annotation.Nullable public String getPublicIp() { + return publicIp; + } + + /** + * 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 NetworkIPv4 instance itself + */ + public NetworkIPv4 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; + } + NetworkIPv4 networkIPv4 = (NetworkIPv4) o; + return Objects.equals(this.gateway, networkIPv4.gateway) + && Objects.equals(this.nameservers, networkIPv4.nameservers) + && Objects.equals(this.prefixes, networkIPv4.prefixes) + && Objects.equals(this.publicIp, networkIPv4.publicIp) + && Objects.equals(this.additionalProperties, networkIPv4.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(gateway, nameservers, prefixes, publicIp, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NetworkIPv4 {\n"); + sb.append(" gateway: ").append(toIndentedString(gateway)).append("\n"); + sb.append(" nameservers: ").append(toIndentedString(nameservers)).append("\n"); + sb.append(" prefixes: ").append(toIndentedString(prefixes)).append("\n"); + sb.append(" publicIp: ").append(toIndentedString(publicIp)).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("gateway", "nameservers", "prefixes", "publicIp")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("prefixes")); + } + + /** + * 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 NetworkIPv4 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NetworkIPv4.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 NetworkIPv4 is not found in the empty JSON string", + NetworkIPv4.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : NetworkIPv4.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("gateway") != null && !jsonObj.get("gateway").isJsonNull()) + && !jsonObj.get("gateway").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `gateway` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("gateway").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("nameservers") != null + && !jsonObj.get("nameservers").isJsonNull() + && !jsonObj.get("nameservers").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `nameservers` to be an array in the JSON string but got `%s`", + jsonObj.get("nameservers").toString())); + } + // ensure the required json array is present + if (jsonObj.get("prefixes") == null) { + throw new IllegalArgumentException( + "Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("prefixes").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `prefixes` to be an array in the JSON string but got `%s`", + jsonObj.get("prefixes").toString())); + } + if ((jsonObj.get("publicIp") != null && !jsonObj.get("publicIp").isJsonNull()) + && !jsonObj.get("publicIp").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `publicIp` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("publicIp").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!NetworkIPv4.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NetworkIPv4' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(NetworkIPv4.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, NetworkIPv4 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 NetworkIPv4 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + NetworkIPv4 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 NetworkIPv4 given an JSON string + * + * @param jsonString JSON string + * @return An instance of NetworkIPv4 + * @throws IOException if the JSON string is invalid with respect to NetworkIPv4 + */ + public static NetworkIPv4 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NetworkIPv4.class); + } + + /** + * Convert an instance of NetworkIPv4 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/NetworkIPv6.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/NetworkIPv6.java new file mode 100644 index 00000000..3cb22991 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/NetworkIPv6.java @@ -0,0 +1,413 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2alpha1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2alpha1api.model; + +import cloud.stackit.sdk.iaas.v2alpha1api.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.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; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Object that represents the IPv6 part of a network. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class NetworkIPv6 { + public static final String SERIALIZED_NAME_GATEWAY = "gateway"; + + @SerializedName(SERIALIZED_NAME_GATEWAY) + @javax.annotation.Nullable private String gateway; + + public static final String SERIALIZED_NAME_NAMESERVERS = "nameservers"; + + @SerializedName(SERIALIZED_NAME_NAMESERVERS) + @javax.annotation.Nullable private List nameservers = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PREFIXES = "prefixes"; + + @SerializedName(SERIALIZED_NAME_PREFIXES) + @javax.annotation.Nonnull + private List prefixes = new ArrayList<>(); + + public NetworkIPv6() {} + + public NetworkIPv6 gateway(@javax.annotation.Nullable String gateway) { + this.gateway = gateway; + return this; + } + + /** + * The IPv6 gateway of a network. If not specified the first IP of the network will be assigned + * as the gateway. If 'null' is sent, then the network doesn't have a gateway. + * + * @return gateway + */ + @javax.annotation.Nullable public String getGateway() { + return gateway; + } + + public void setGateway(@javax.annotation.Nullable String gateway) { + this.gateway = gateway; + } + + public NetworkIPv6 nameservers(@javax.annotation.Nullable List nameservers) { + this.nameservers = nameservers; + return this; + } + + public NetworkIPv6 addNameserversItem(String nameserversItem) { + if (this.nameservers == null) { + this.nameservers = new ArrayList<>(); + } + this.nameservers.add(nameserversItem); + return this; + } + + /** + * A list containing DNS Servers/Nameservers for IPv6. + * + * @return nameservers + */ + @javax.annotation.Nullable public List getNameservers() { + return nameservers; + } + + public void setNameservers(@javax.annotation.Nullable List nameservers) { + this.nameservers = nameservers; + } + + public NetworkIPv6 prefixes(@javax.annotation.Nonnull List prefixes) { + this.prefixes = prefixes; + return this; + } + + public NetworkIPv6 addPrefixesItem(String prefixesItem) { + if (this.prefixes == null) { + this.prefixes = new ArrayList<>(); + } + this.prefixes.add(prefixesItem); + return this; + } + + /** + * Get prefixes + * + * @return prefixes + */ + @javax.annotation.Nonnull + public List getPrefixes() { + return prefixes; + } + + public void setPrefixes(@javax.annotation.Nonnull List prefixes) { + this.prefixes = prefixes; + } + + /** + * 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 NetworkIPv6 instance itself + */ + public NetworkIPv6 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; + } + NetworkIPv6 networkIPv6 = (NetworkIPv6) o; + return Objects.equals(this.gateway, networkIPv6.gateway) + && Objects.equals(this.nameservers, networkIPv6.nameservers) + && Objects.equals(this.prefixes, networkIPv6.prefixes) + && Objects.equals(this.additionalProperties, networkIPv6.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(gateway, nameservers, prefixes, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NetworkIPv6 {\n"); + sb.append(" gateway: ").append(toIndentedString(gateway)).append("\n"); + sb.append(" nameservers: ").append(toIndentedString(nameservers)).append("\n"); + sb.append(" prefixes: ").append(toIndentedString(prefixes)).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("gateway", "nameservers", "prefixes")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("prefixes")); + } + + /** + * 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 NetworkIPv6 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NetworkIPv6.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 NetworkIPv6 is not found in the empty JSON string", + NetworkIPv6.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : NetworkIPv6.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("gateway") != null && !jsonObj.get("gateway").isJsonNull()) + && !jsonObj.get("gateway").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `gateway` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("gateway").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("nameservers") != null + && !jsonObj.get("nameservers").isJsonNull() + && !jsonObj.get("nameservers").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `nameservers` to be an array in the JSON string but got `%s`", + jsonObj.get("nameservers").toString())); + } + // ensure the required json array is present + if (jsonObj.get("prefixes") == null) { + throw new IllegalArgumentException( + "Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("prefixes").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `prefixes` to be an array in the JSON string but got `%s`", + jsonObj.get("prefixes").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!NetworkIPv6.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NetworkIPv6' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(NetworkIPv6.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, NetworkIPv6 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 NetworkIPv6 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + NetworkIPv6 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 NetworkIPv6 given an JSON string + * + * @param jsonString JSON string + * @return An instance of NetworkIPv6 + * @throws IOException if the JSON string is invalid with respect to NetworkIPv6 + */ + public static NetworkIPv6 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NetworkIPv6.class); + } + + /** + * Convert an instance of NetworkIPv6 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/NetworkListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/NetworkListResponse.java new file mode 100644 index 00000000..cbdc4561 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/NetworkListResponse.java @@ -0,0 +1,326 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2alpha1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2alpha1api.model; + +import cloud.stackit.sdk.iaas.v2alpha1api.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; + +/** Network list response. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class NetworkListResponse { + public static final String SERIALIZED_NAME_ITEMS = "items"; + + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public NetworkListResponse() {} + + public NetworkListResponse items(@javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public NetworkListResponse addItemsItem(Network itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list of networks. + * + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NetworkListResponse instance itself + */ + public NetworkListResponse 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; + } + NetworkListResponse networkListResponse = (NetworkListResponse) o; + return Objects.equals(this.items, networkListResponse.items) + && Objects.equals( + this.additionalProperties, networkListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NetworkListResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("items")); + } + + /** + * 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 NetworkListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NetworkListResponse.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 NetworkListResponse is not found in the empty JSON string", + NetworkListResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : NetworkListResponse.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("items").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `items` to be an array in the JSON string but got `%s`", + jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + Network.validateJsonElement(jsonArrayitems.get(i)); + } + ; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!NetworkListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NetworkListResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(NetworkListResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, NetworkListResponse 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 NetworkListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + NetworkListResponse 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 NetworkListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of NetworkListResponse + * @throws IOException if the JSON string is invalid with respect to NetworkListResponse + */ + public static NetworkListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NetworkListResponse.class); + } + + /** + * Convert an instance of NetworkListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/NexthopBlackhole.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/NexthopBlackhole.java new file mode 100644 index 00000000..a2b950df --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/NexthopBlackhole.java @@ -0,0 +1,307 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2alpha1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2alpha1api.model; + +import cloud.stackit.sdk.iaas.v2alpha1api.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; + +/** Object that represents a blackhole route. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class NexthopBlackhole { + public static final String SERIALIZED_NAME_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private String type; + + public NexthopBlackhole() {} + + public NexthopBlackhole 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 NexthopBlackhole instance itself + */ + public NexthopBlackhole 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; + } + NexthopBlackhole nexthopBlackhole = (NexthopBlackhole) o; + return Objects.equals(this.type, nexthopBlackhole.type) + && Objects.equals(this.additionalProperties, nexthopBlackhole.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NexthopBlackhole {\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("type")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("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 NexthopBlackhole + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NexthopBlackhole.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 NexthopBlackhole is not found in the empty JSON string", + NexthopBlackhole.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : NexthopBlackhole.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("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 (!NexthopBlackhole.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NexthopBlackhole' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(NexthopBlackhole.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, NexthopBlackhole 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 NexthopBlackhole read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + NexthopBlackhole 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 NexthopBlackhole given an JSON string + * + * @param jsonString JSON string + * @return An instance of NexthopBlackhole + * @throws IOException if the JSON string is invalid with respect to NexthopBlackhole + */ + public static NexthopBlackhole fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NexthopBlackhole.class); + } + + /** + * Convert an instance of NexthopBlackhole to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/NexthopIPv4.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/NexthopIPv4.java new file mode 100644 index 00000000..041c32c0 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/NexthopIPv4.java @@ -0,0 +1,340 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2alpha1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2alpha1api.model; + +import cloud.stackit.sdk.iaas.v2alpha1api.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; + +/** Object that represents an IPv4 address. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class NexthopIPv4 { + public static final String SERIALIZED_NAME_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private String type; + + public static final String SERIALIZED_NAME_VALUE = "value"; + + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nonnull + private String value; + + public NexthopIPv4() {} + + public NexthopIPv4 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; + } + + public NexthopIPv4 value(@javax.annotation.Nonnull String value) { + this.value = value; + return this; + } + + /** + * An IPv4 address. + * + * @return value + */ + @javax.annotation.Nonnull + public String getValue() { + return value; + } + + public void setValue(@javax.annotation.Nonnull String value) { + this.value = value; + } + + /** + * 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 NexthopIPv4 instance itself + */ + public NexthopIPv4 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; + } + NexthopIPv4 nexthopIPv4 = (NexthopIPv4) o; + return Objects.equals(this.type, nexthopIPv4.type) + && Objects.equals(this.value, nexthopIPv4.value) + && Objects.equals(this.additionalProperties, nexthopIPv4.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(type, value, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NexthopIPv4 {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).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("type", "value")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("type", "value")); + } + + /** + * 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 NexthopIPv4 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NexthopIPv4.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 NexthopIPv4 is not found in the empty JSON string", + NexthopIPv4.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : NexthopIPv4.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("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())); + } + if (!jsonObj.get("value").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `value` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("value").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!NexthopIPv4.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NexthopIPv4' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(NexthopIPv4.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, NexthopIPv4 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 NexthopIPv4 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + NexthopIPv4 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 NexthopIPv4 given an JSON string + * + * @param jsonString JSON string + * @return An instance of NexthopIPv4 + * @throws IOException if the JSON string is invalid with respect to NexthopIPv4 + */ + public static NexthopIPv4 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NexthopIPv4.class); + } + + /** + * Convert an instance of NexthopIPv4 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/NexthopIPv6.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/NexthopIPv6.java new file mode 100644 index 00000000..b10185a8 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/NexthopIPv6.java @@ -0,0 +1,340 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2alpha1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2alpha1api.model; + +import cloud.stackit.sdk.iaas.v2alpha1api.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; + +/** Object that represents an IPv6 address. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class NexthopIPv6 { + public static final String SERIALIZED_NAME_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private String type; + + public static final String SERIALIZED_NAME_VALUE = "value"; + + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nonnull + private String value; + + public NexthopIPv6() {} + + public NexthopIPv6 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; + } + + public NexthopIPv6 value(@javax.annotation.Nonnull String value) { + this.value = value; + return this; + } + + /** + * An IPv6 address. + * + * @return value + */ + @javax.annotation.Nonnull + public String getValue() { + return value; + } + + public void setValue(@javax.annotation.Nonnull String value) { + this.value = value; + } + + /** + * 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 NexthopIPv6 instance itself + */ + public NexthopIPv6 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; + } + NexthopIPv6 nexthopIPv6 = (NexthopIPv6) o; + return Objects.equals(this.type, nexthopIPv6.type) + && Objects.equals(this.value, nexthopIPv6.value) + && Objects.equals(this.additionalProperties, nexthopIPv6.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(type, value, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NexthopIPv6 {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).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("type", "value")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("type", "value")); + } + + /** + * 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 NexthopIPv6 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NexthopIPv6.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 NexthopIPv6 is not found in the empty JSON string", + NexthopIPv6.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : NexthopIPv6.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("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())); + } + if (!jsonObj.get("value").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `value` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("value").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!NexthopIPv6.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NexthopIPv6' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(NexthopIPv6.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, NexthopIPv6 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 NexthopIPv6 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + NexthopIPv6 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 NexthopIPv6 given an JSON string + * + * @param jsonString JSON string + * @return An instance of NexthopIPv6 + * @throws IOException if the JSON string is invalid with respect to NexthopIPv6 + */ + public static NexthopIPv6 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NexthopIPv6.class); + } + + /** + * Convert an instance of NexthopIPv6 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/NexthopInternet.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/NexthopInternet.java new file mode 100644 index 00000000..8f5177bd --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/NexthopInternet.java @@ -0,0 +1,307 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2alpha1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2alpha1api.model; + +import cloud.stackit.sdk.iaas.v2alpha1api.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; + +/** Object that represents a route to the internet. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class NexthopInternet { + public static final String SERIALIZED_NAME_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private String type; + + public NexthopInternet() {} + + public NexthopInternet 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 NexthopInternet instance itself + */ + public NexthopInternet 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; + } + NexthopInternet nexthopInternet = (NexthopInternet) o; + return Objects.equals(this.type, nexthopInternet.type) + && Objects.equals(this.additionalProperties, nexthopInternet.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NexthopInternet {\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("type")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("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 NexthopInternet + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NexthopInternet.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 NexthopInternet is not found in the empty JSON string", + NexthopInternet.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : NexthopInternet.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("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 (!NexthopInternet.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NexthopInternet' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(NexthopInternet.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, NexthopInternet 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 NexthopInternet read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + NexthopInternet 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 NexthopInternet given an JSON string + * + * @param jsonString JSON string + * @return An instance of NexthopInternet + * @throws IOException if the JSON string is invalid with respect to NexthopInternet + */ + public static NexthopInternet fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NexthopInternet.class); + } + + /** + * Convert an instance of NexthopInternet to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/PartialUpdateNetworkPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/PartialUpdateNetworkPayload.java new file mode 100644 index 00000000..5ae99bea --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/PartialUpdateNetworkPayload.java @@ -0,0 +1,481 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2alpha1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2alpha1api.model; + +import cloud.stackit.sdk.iaas.v2alpha1api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +/** Object that represents the request body for a network update. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class PartialUpdateNetworkPayload { + public static final String SERIALIZED_NAME_DHCP = "dhcp"; + + @SerializedName(SERIALIZED_NAME_DHCP) + @javax.annotation.Nullable private Boolean dhcp; + + public static final String SERIALIZED_NAME_IPV4 = "ipv4"; + + @SerializedName(SERIALIZED_NAME_IPV4) + @javax.annotation.Nullable private UpdateNetworkIPv4Body ipv4; + + public static final String SERIALIZED_NAME_IPV6 = "ipv6"; + + @SerializedName(SERIALIZED_NAME_IPV6) + @javax.annotation.Nullable private UpdateNetworkIPv6Body ipv6; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; + + public static final String SERIALIZED_NAME_ROUTED = "routed"; + + @SerializedName(SERIALIZED_NAME_ROUTED) + @javax.annotation.Nullable private Boolean routed; + + public static final String SERIALIZED_NAME_ROUTING_TABLE_ID = "routingTableId"; + + @SerializedName(SERIALIZED_NAME_ROUTING_TABLE_ID) + @javax.annotation.Nullable private UUID routingTableId; + + public PartialUpdateNetworkPayload() {} + + public PartialUpdateNetworkPayload dhcp(@javax.annotation.Nullable Boolean dhcp) { + this.dhcp = dhcp; + return this; + } + + /** + * Enable or disable DHCP for a network. + * + * @return dhcp + */ + @javax.annotation.Nullable public Boolean getDhcp() { + return dhcp; + } + + public void setDhcp(@javax.annotation.Nullable Boolean dhcp) { + this.dhcp = dhcp; + } + + public PartialUpdateNetworkPayload ipv4(@javax.annotation.Nullable UpdateNetworkIPv4Body ipv4) { + this.ipv4 = ipv4; + return this; + } + + /** + * Get ipv4 + * + * @return ipv4 + */ + @javax.annotation.Nullable public UpdateNetworkIPv4Body getIpv4() { + return ipv4; + } + + public void setIpv4(@javax.annotation.Nullable UpdateNetworkIPv4Body ipv4) { + this.ipv4 = ipv4; + } + + public PartialUpdateNetworkPayload ipv6(@javax.annotation.Nullable UpdateNetworkIPv6Body ipv6) { + this.ipv6 = ipv6; + return this; + } + + /** + * Get ipv6 + * + * @return ipv6 + */ + @javax.annotation.Nullable public UpdateNetworkIPv6Body getIpv6() { + return ipv6; + } + + public void setIpv6(@javax.annotation.Nullable UpdateNetworkIPv6Body ipv6) { + this.ipv6 = ipv6; + } + + public PartialUpdateNetworkPayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public PartialUpdateNetworkPayload name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nullable public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + public PartialUpdateNetworkPayload routed(@javax.annotation.Nullable Boolean routed) { + this.routed = routed; + return this; + } + + /** + * Shows if the network is routed and therefore accessible from other networks. + * + * @return routed + */ + @javax.annotation.Nullable public Boolean getRouted() { + return routed; + } + + public void setRouted(@javax.annotation.Nullable Boolean routed) { + this.routed = routed; + } + + public PartialUpdateNetworkPayload routingTableId( + @javax.annotation.Nullable UUID routingTableId) { + this.routingTableId = routingTableId; + return this; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return routingTableId + */ + @javax.annotation.Nullable public UUID getRoutingTableId() { + return routingTableId; + } + + public void setRoutingTableId(@javax.annotation.Nullable UUID routingTableId) { + this.routingTableId = routingTableId; + } + + /** + * 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 PartialUpdateNetworkPayload instance itself + */ + public PartialUpdateNetworkPayload 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; + } + PartialUpdateNetworkPayload partialUpdateNetworkPayload = (PartialUpdateNetworkPayload) o; + return Objects.equals(this.dhcp, partialUpdateNetworkPayload.dhcp) + && Objects.equals(this.ipv4, partialUpdateNetworkPayload.ipv4) + && Objects.equals(this.ipv6, partialUpdateNetworkPayload.ipv6) + && Objects.equals(this.labels, partialUpdateNetworkPayload.labels) + && Objects.equals(this.name, partialUpdateNetworkPayload.name) + && Objects.equals(this.routed, partialUpdateNetworkPayload.routed) + && Objects.equals(this.routingTableId, partialUpdateNetworkPayload.routingTableId) + && Objects.equals( + this.additionalProperties, + partialUpdateNetworkPayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + dhcp, ipv4, ipv6, labels, name, routed, routingTableId, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PartialUpdateNetworkPayload {\n"); + sb.append(" dhcp: ").append(toIndentedString(dhcp)).append("\n"); + sb.append(" ipv4: ").append(toIndentedString(ipv4)).append("\n"); + sb.append(" ipv6: ").append(toIndentedString(ipv6)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" routed: ").append(toIndentedString(routed)).append("\n"); + sb.append(" routingTableId: ").append(toIndentedString(routingTableId)).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( + "dhcp", + "ipv4", + "ipv6", + "labels", + "name", + "routed", + "routingTableId")); + + // 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 + * PartialUpdateNetworkPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PartialUpdateNetworkPayload.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 PartialUpdateNetworkPayload is not found in the empty JSON string", + PartialUpdateNetworkPayload.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `ipv4` + if (jsonObj.get("ipv4") != null && !jsonObj.get("ipv4").isJsonNull()) { + UpdateNetworkIPv4Body.validateJsonElement(jsonObj.get("ipv4")); + } + // validate the optional field `ipv6` + if (jsonObj.get("ipv6") != null && !jsonObj.get("ipv6").isJsonNull()) { + UpdateNetworkIPv6Body.validateJsonElement(jsonObj.get("ipv6")); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `name` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("name").toString())); + } + if ((jsonObj.get("routingTableId") != null && !jsonObj.get("routingTableId").isJsonNull()) + && !jsonObj.get("routingTableId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `routingTableId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("routingTableId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PartialUpdateNetworkPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PartialUpdateNetworkPayload' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(PartialUpdateNetworkPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, PartialUpdateNetworkPayload 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 PartialUpdateNetworkPayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PartialUpdateNetworkPayload 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 PartialUpdateNetworkPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of PartialUpdateNetworkPayload + * @throws IOException if the JSON string is invalid with respect to PartialUpdateNetworkPayload + */ + public static PartialUpdateNetworkPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PartialUpdateNetworkPayload.class); + } + + /** + * Convert an instance of PartialUpdateNetworkPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/Route.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/Route.java new file mode 100644 index 00000000..b433a7f8 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/Route.java @@ -0,0 +1,433 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2alpha1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2alpha1api.model; + +import cloud.stackit.sdk.iaas.v2alpha1api.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; +import java.util.UUID; + +/** Object represents a network route. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class Route { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_DESTINATION = "destination"; + + @SerializedName(SERIALIZED_NAME_DESTINATION) + @javax.annotation.Nonnull + private RouteDestination destination; + + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NEXTHOP = "nexthop"; + + @SerializedName(SERIALIZED_NAME_NEXTHOP) + @javax.annotation.Nonnull + private RouteNexthop nexthop; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable private OffsetDateTime updatedAt; + + public Route() {} + + public Route(OffsetDateTime createdAt, UUID id, OffsetDateTime updatedAt) { + this(); + this.createdAt = createdAt; + this.id = id; + this.updatedAt = updatedAt; + } + + /** + * Date-time when resource was created. + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public Route destination(@javax.annotation.Nonnull RouteDestination destination) { + this.destination = destination; + return this; + } + + /** + * Get destination + * + * @return destination + */ + @javax.annotation.Nonnull + public RouteDestination getDestination() { + return destination; + } + + public void setDestination(@javax.annotation.Nonnull RouteDestination destination) { + this.destination = destination; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + public Route labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public Route nexthop(@javax.annotation.Nonnull RouteNexthop nexthop) { + this.nexthop = nexthop; + return this; + } + + /** + * Get nexthop + * + * @return nexthop + */ + @javax.annotation.Nonnull + public RouteNexthop getNexthop() { + return nexthop; + } + + public void setNexthop(@javax.annotation.Nonnull RouteNexthop nexthop) { + this.nexthop = nexthop; + } + + /** + * Date-time when resource was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nullable public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * 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 Route instance itself + */ + public Route 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; + } + Route route = (Route) o; + return Objects.equals(this.createdAt, route.createdAt) + && Objects.equals(this.destination, route.destination) + && Objects.equals(this.id, route.id) + && Objects.equals(this.labels, route.labels) + && Objects.equals(this.nexthop, route.nexthop) + && Objects.equals(this.updatedAt, route.updatedAt) + && Objects.equals(this.additionalProperties, route.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + createdAt, destination, id, labels, nexthop, updatedAt, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Route {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" destination: ").append(toIndentedString(destination)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" nexthop: ").append(toIndentedString(nexthop)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).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( + "createdAt", + "destination", + "id", + "labels", + "nexthop", + "updatedAt")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("destination", "nexthop")); + } + + /** + * 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 Route + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Route.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 Route is not found in the empty JSON string", + Route.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Route.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 `destination` + RouteDestination.validateJsonElement(jsonObj.get("destination")); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + // validate the required field `nexthop` + RouteNexthop.validateJsonElement(jsonObj.get("nexthop")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Route.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Route' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(Route.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, Route 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 Route read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Route 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 Route given an JSON string + * + * @param jsonString JSON string + * @return An instance of Route + * @throws IOException if the JSON string is invalid with respect to Route + */ + public static Route fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Route.class); + } + + /** + * Convert an instance of Route to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/RouteDestination.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/RouteDestination.java new file mode 100644 index 00000000..918edadd --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/RouteDestination.java @@ -0,0 +1,290 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2alpha1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2alpha1api.model; + +import cloud.stackit.sdk.iaas.v2alpha1api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +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 RouteDestination extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(RouteDestination.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RouteDestination.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RouteDestination' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterDestinationCIDRv4 = + gson.getDelegateAdapter(this, TypeToken.get(DestinationCIDRv4.class)); + final TypeAdapter adapterDestinationCIDRv6 = + gson.getDelegateAdapter(this, TypeToken.get(DestinationCIDRv6.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, RouteDestination value) + throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `DestinationCIDRv4` + if (value.getActualInstance() instanceof DestinationCIDRv4) { + JsonElement element = + adapterDestinationCIDRv4.toJsonTree( + (DestinationCIDRv4) value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `DestinationCIDRv6` + if (value.getActualInstance() instanceof DestinationCIDRv6) { + JsonElement element = + adapterDestinationCIDRv6.toJsonTree( + (DestinationCIDRv6) value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException( + "Failed to serialize as the type doesn't match oneOf schemas: DestinationCIDRv4, DestinationCIDRv6"); + } + + @Override + public RouteDestination read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize DestinationCIDRv4 + try { + // validate the JSON object to see if any exception is thrown + DestinationCIDRv4.validateJsonElement(jsonElement); + actualAdapter = adapterDestinationCIDRv4; + match++; + log.log( + Level.FINER, + "Input data matches schema 'DestinationCIDRv4'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for DestinationCIDRv4 failed with `%s`.", + e.getMessage())); + log.log( + Level.FINER, + "Input data does not match schema 'DestinationCIDRv4'", + e); + } + // deserialize DestinationCIDRv6 + try { + // validate the JSON object to see if any exception is thrown + DestinationCIDRv6.validateJsonElement(jsonElement); + actualAdapter = adapterDestinationCIDRv6; + match++; + log.log( + Level.FINER, + "Input data matches schema 'DestinationCIDRv6'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for DestinationCIDRv6 failed with `%s`.", + e.getMessage())); + log.log( + Level.FINER, + "Input data does not match schema 'DestinationCIDRv6'", + e); + } + + if (match == 1) { + RouteDestination ret = new RouteDestination(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException( + String.format( + java.util.Locale.ROOT, + "Failed deserialization for RouteDestination: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", + match, + errorMessages, + jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public RouteDestination() { + super("oneOf", Boolean.FALSE); + } + + public RouteDestination(Object o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("DestinationCIDRv4", DestinationCIDRv4.class); + schemas.put("DestinationCIDRv6", DestinationCIDRv6.class); + } + + @Override + public Map> getSchemas() { + return RouteDestination.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: DestinationCIDRv4, DestinationCIDRv6 + * + *

It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof DestinationCIDRv4) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof DestinationCIDRv6) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException( + "Invalid instance type. Must be DestinationCIDRv4, DestinationCIDRv6"); + } + + /** + * Get the actual instance, which can be the following: DestinationCIDRv4, DestinationCIDRv6 + * + * @return The actual instance (DestinationCIDRv4, DestinationCIDRv6) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `DestinationCIDRv4`. If the actual instance is not + * `DestinationCIDRv4`, the ClassCastException will be thrown. + * + * @return The actual instance of `DestinationCIDRv4` + * @throws ClassCastException if the instance is not `DestinationCIDRv4` + */ + public DestinationCIDRv4 getDestinationCIDRv4() throws ClassCastException { + return (DestinationCIDRv4) super.getActualInstance(); + } + + /** + * Get the actual instance of `DestinationCIDRv6`. If the actual instance is not + * `DestinationCIDRv6`, the ClassCastException will be thrown. + * + * @return The actual instance of `DestinationCIDRv6` + * @throws ClassCastException if the instance is not `DestinationCIDRv6` + */ + public DestinationCIDRv6 getDestinationCIDRv6() throws ClassCastException { + return (DestinationCIDRv6) 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 RouteDestination + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with DestinationCIDRv4 + try { + DestinationCIDRv4.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for DestinationCIDRv4 failed with `%s`.", + e.getMessage())); + // continue to the next one + } + // validate the json string with DestinationCIDRv6 + try { + DestinationCIDRv6.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for DestinationCIDRv6 failed with `%s`.", + e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException( + String.format( + java.util.Locale.ROOT, + "The JSON string is invalid for RouteDestination with oneOf schemas: DestinationCIDRv4, DestinationCIDRv6. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", + validCount, + errorMessages, + jsonElement.toString())); + } + } + + /** + * Create an instance of RouteDestination given an JSON string + * + * @param jsonString JSON string + * @return An instance of RouteDestination + * @throws IOException if the JSON string is invalid with respect to RouteDestination + */ + public static RouteDestination fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RouteDestination.class); + } + + /** + * Convert an instance of RouteDestination to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/RouteListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/RouteListResponse.java new file mode 100644 index 00000000..2602a9c6 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/RouteListResponse.java @@ -0,0 +1,326 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2alpha1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2alpha1api.model; + +import cloud.stackit.sdk.iaas.v2alpha1api.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; + +/** Route list response. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class RouteListResponse { + public static final String SERIALIZED_NAME_ITEMS = "items"; + + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public RouteListResponse() {} + + public RouteListResponse items(@javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public RouteListResponse addItemsItem(Route itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list of routes. + * + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the RouteListResponse instance itself + */ + public RouteListResponse 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; + } + RouteListResponse routeListResponse = (RouteListResponse) o; + return Objects.equals(this.items, routeListResponse.items) + && Objects.equals( + this.additionalProperties, routeListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RouteListResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("items")); + } + + /** + * 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 RouteListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RouteListResponse.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 RouteListResponse is not found in the empty JSON string", + RouteListResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RouteListResponse.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("items").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `items` to be an array in the JSON string but got `%s`", + jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + Route.validateJsonElement(jsonArrayitems.get(i)); + } + ; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RouteListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RouteListResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(RouteListResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, RouteListResponse 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 RouteListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + RouteListResponse 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 RouteListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of RouteListResponse + * @throws IOException if the JSON string is invalid with respect to RouteListResponse + */ + public static RouteListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RouteListResponse.class); + } + + /** + * Convert an instance of RouteListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/RouteNexthop.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/RouteNexthop.java new file mode 100644 index 00000000..822f6bd8 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/RouteNexthop.java @@ -0,0 +1,404 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2alpha1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2alpha1api.model; + +import cloud.stackit.sdk.iaas.v2alpha1api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +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 RouteNexthop extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(RouteNexthop.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RouteNexthop.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RouteNexthop' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterNexthopIPv4 = + gson.getDelegateAdapter(this, TypeToken.get(NexthopIPv4.class)); + final TypeAdapter adapterNexthopIPv6 = + gson.getDelegateAdapter(this, TypeToken.get(NexthopIPv6.class)); + final TypeAdapter adapterNexthopInternet = + gson.getDelegateAdapter(this, TypeToken.get(NexthopInternet.class)); + final TypeAdapter adapterNexthopBlackhole = + gson.getDelegateAdapter(this, TypeToken.get(NexthopBlackhole.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, RouteNexthop value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `NexthopIPv4` + if (value.getActualInstance() instanceof NexthopIPv4) { + JsonElement element = + adapterNexthopIPv4.toJsonTree( + (NexthopIPv4) value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `NexthopIPv6` + if (value.getActualInstance() instanceof NexthopIPv6) { + JsonElement element = + adapterNexthopIPv6.toJsonTree( + (NexthopIPv6) value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `NexthopInternet` + if (value.getActualInstance() instanceof NexthopInternet) { + JsonElement element = + adapterNexthopInternet.toJsonTree( + (NexthopInternet) value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `NexthopBlackhole` + if (value.getActualInstance() instanceof NexthopBlackhole) { + JsonElement element = + adapterNexthopBlackhole.toJsonTree( + (NexthopBlackhole) value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException( + "Failed to serialize as the type doesn't match oneOf schemas: NexthopBlackhole, NexthopIPv4, NexthopIPv6, NexthopInternet"); + } + + @Override + public RouteNexthop read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize NexthopIPv4 + try { + // validate the JSON object to see if any exception is thrown + NexthopIPv4.validateJsonElement(jsonElement); + actualAdapter = adapterNexthopIPv4; + match++; + log.log(Level.FINER, "Input data matches schema 'NexthopIPv4'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for NexthopIPv4 failed with `%s`.", + e.getMessage())); + log.log( + Level.FINER, + "Input data does not match schema 'NexthopIPv4'", + e); + } + // deserialize NexthopIPv6 + try { + // validate the JSON object to see if any exception is thrown + NexthopIPv6.validateJsonElement(jsonElement); + actualAdapter = adapterNexthopIPv6; + match++; + log.log(Level.FINER, "Input data matches schema 'NexthopIPv6'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for NexthopIPv6 failed with `%s`.", + e.getMessage())); + log.log( + Level.FINER, + "Input data does not match schema 'NexthopIPv6'", + e); + } + // deserialize NexthopInternet + try { + // validate the JSON object to see if any exception is thrown + NexthopInternet.validateJsonElement(jsonElement); + actualAdapter = adapterNexthopInternet; + match++; + log.log(Level.FINER, "Input data matches schema 'NexthopInternet'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for NexthopInternet failed with `%s`.", + e.getMessage())); + log.log( + Level.FINER, + "Input data does not match schema 'NexthopInternet'", + e); + } + // deserialize NexthopBlackhole + try { + // validate the JSON object to see if any exception is thrown + NexthopBlackhole.validateJsonElement(jsonElement); + actualAdapter = adapterNexthopBlackhole; + match++; + log.log( + Level.FINER, + "Input data matches schema 'NexthopBlackhole'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for NexthopBlackhole failed with `%s`.", + e.getMessage())); + log.log( + Level.FINER, + "Input data does not match schema 'NexthopBlackhole'", + e); + } + + if (match == 1) { + RouteNexthop ret = new RouteNexthop(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException( + String.format( + java.util.Locale.ROOT, + "Failed deserialization for RouteNexthop: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", + match, + errorMessages, + jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public RouteNexthop() { + super("oneOf", Boolean.FALSE); + } + + public RouteNexthop(Object o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("NexthopIPv4", NexthopIPv4.class); + schemas.put("NexthopIPv6", NexthopIPv6.class); + schemas.put("NexthopInternet", NexthopInternet.class); + schemas.put("NexthopBlackhole", NexthopBlackhole.class); + } + + @Override + public Map> getSchemas() { + return RouteNexthop.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: NexthopBlackhole, NexthopIPv4, NexthopIPv6, NexthopInternet + * + *

It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof NexthopIPv4) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof NexthopIPv6) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof NexthopInternet) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof NexthopBlackhole) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException( + "Invalid instance type. Must be NexthopBlackhole, NexthopIPv4, NexthopIPv6, NexthopInternet"); + } + + /** + * Get the actual instance, which can be the following: NexthopBlackhole, NexthopIPv4, + * NexthopIPv6, NexthopInternet + * + * @return The actual instance (NexthopBlackhole, NexthopIPv4, NexthopIPv6, NexthopInternet) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `NexthopIPv4`. If the actual instance is not `NexthopIPv4`, the + * ClassCastException will be thrown. + * + * @return The actual instance of `NexthopIPv4` + * @throws ClassCastException if the instance is not `NexthopIPv4` + */ + public NexthopIPv4 getNexthopIPv4() throws ClassCastException { + return (NexthopIPv4) super.getActualInstance(); + } + + /** + * Get the actual instance of `NexthopIPv6`. If the actual instance is not `NexthopIPv6`, the + * ClassCastException will be thrown. + * + * @return The actual instance of `NexthopIPv6` + * @throws ClassCastException if the instance is not `NexthopIPv6` + */ + public NexthopIPv6 getNexthopIPv6() throws ClassCastException { + return (NexthopIPv6) super.getActualInstance(); + } + + /** + * Get the actual instance of `NexthopInternet`. If the actual instance is not + * `NexthopInternet`, the ClassCastException will be thrown. + * + * @return The actual instance of `NexthopInternet` + * @throws ClassCastException if the instance is not `NexthopInternet` + */ + public NexthopInternet getNexthopInternet() throws ClassCastException { + return (NexthopInternet) super.getActualInstance(); + } + + /** + * Get the actual instance of `NexthopBlackhole`. If the actual instance is not + * `NexthopBlackhole`, the ClassCastException will be thrown. + * + * @return The actual instance of `NexthopBlackhole` + * @throws ClassCastException if the instance is not `NexthopBlackhole` + */ + public NexthopBlackhole getNexthopBlackhole() throws ClassCastException { + return (NexthopBlackhole) 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 RouteNexthop + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with NexthopIPv4 + try { + NexthopIPv4.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for NexthopIPv4 failed with `%s`.", + e.getMessage())); + // continue to the next one + } + // validate the json string with NexthopIPv6 + try { + NexthopIPv6.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for NexthopIPv6 failed with `%s`.", + e.getMessage())); + // continue to the next one + } + // validate the json string with NexthopInternet + try { + NexthopInternet.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for NexthopInternet failed with `%s`.", + e.getMessage())); + // continue to the next one + } + // validate the json string with NexthopBlackhole + try { + NexthopBlackhole.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for NexthopBlackhole failed with `%s`.", + e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException( + String.format( + java.util.Locale.ROOT, + "The JSON string is invalid for RouteNexthop with oneOf schemas: NexthopBlackhole, NexthopIPv4, NexthopIPv6, NexthopInternet. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", + validCount, + errorMessages, + jsonElement.toString())); + } + } + + /** + * Create an instance of RouteNexthop given an JSON string + * + * @param jsonString JSON string + * @return An instance of RouteNexthop + * @throws IOException if the JSON string is invalid with respect to RouteNexthop + */ + public static RouteNexthop fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RouteNexthop.class); + } + + /** + * Convert an instance of RouteNexthop to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/RoutingTable.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/RoutingTable.java new file mode 100644 index 00000000..3f378ca2 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/RoutingTable.java @@ -0,0 +1,525 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2alpha1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2alpha1api.model; + +import cloud.stackit.sdk.iaas.v2alpha1api.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; +import java.util.UUID; + +/** An object representing a routing table. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class RoutingTable { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_DEFAULT = "default"; + + @SerializedName(SERIALIZED_NAME_DEFAULT) + @javax.annotation.Nullable private Boolean _default = true; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable private String description; + + public static final String SERIALIZED_NAME_DYNAMIC_ROUTES = "dynamicRoutes"; + + @SerializedName(SERIALIZED_NAME_DYNAMIC_ROUTES) + @javax.annotation.Nullable private Boolean dynamicRoutes = true; + + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_SYSTEM_ROUTES = "systemRoutes"; + + @SerializedName(SERIALIZED_NAME_SYSTEM_ROUTES) + @javax.annotation.Nullable private Boolean systemRoutes = true; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable private OffsetDateTime updatedAt; + + public RoutingTable() {} + + public RoutingTable( + OffsetDateTime createdAt, Boolean _default, UUID id, OffsetDateTime updatedAt) { + this(); + this.createdAt = createdAt; + this._default = _default; + this.id = id; + this.updatedAt = updatedAt; + } + + /** + * Date-time when resource was created. + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * This is the default routing table. It can't be deleted and is used if the user does not + * specify it otherwise. + * + * @return _default + */ + @javax.annotation.Nullable public Boolean getDefault() { + return _default; + } + + public RoutingTable description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Description Object. Allows string up to 255 Characters. + * + * @return description + */ + @javax.annotation.Nullable public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + public RoutingTable dynamicRoutes(@javax.annotation.Nullable Boolean dynamicRoutes) { + this.dynamicRoutes = dynamicRoutes; + return this; + } + + /** + * A config setting for a routing table which allows propagation of dynamic routes to this + * routing table. + * + * @return dynamicRoutes + */ + @javax.annotation.Nullable public Boolean getDynamicRoutes() { + return dynamicRoutes; + } + + public void setDynamicRoutes(@javax.annotation.Nullable Boolean dynamicRoutes) { + this.dynamicRoutes = dynamicRoutes; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + public RoutingTable labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public RoutingTable name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + public RoutingTable systemRoutes(@javax.annotation.Nullable Boolean systemRoutes) { + this.systemRoutes = systemRoutes; + return this; + } + + /** + * A config setting for a routing table which allows installation of automatic system routes for + * connectivity between projects in the same SNA. + * + * @return systemRoutes + */ + @javax.annotation.Nullable public Boolean getSystemRoutes() { + return systemRoutes; + } + + public void setSystemRoutes(@javax.annotation.Nullable Boolean systemRoutes) { + this.systemRoutes = systemRoutes; + } + + /** + * Date-time when resource was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nullable public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * 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 RoutingTable instance itself + */ + public RoutingTable 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; + } + RoutingTable routingTable = (RoutingTable) o; + return Objects.equals(this.createdAt, routingTable.createdAt) + && Objects.equals(this._default, routingTable._default) + && Objects.equals(this.description, routingTable.description) + && Objects.equals(this.dynamicRoutes, routingTable.dynamicRoutes) + && Objects.equals(this.id, routingTable.id) + && Objects.equals(this.labels, routingTable.labels) + && Objects.equals(this.name, routingTable.name) + && Objects.equals(this.systemRoutes, routingTable.systemRoutes) + && Objects.equals(this.updatedAt, routingTable.updatedAt) + && Objects.equals(this.additionalProperties, routingTable.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + createdAt, + _default, + description, + dynamicRoutes, + id, + labels, + name, + systemRoutes, + updatedAt, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RoutingTable {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" _default: ").append(toIndentedString(_default)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" dynamicRoutes: ").append(toIndentedString(dynamicRoutes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" systemRoutes: ").append(toIndentedString(systemRoutes)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).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( + "createdAt", + "default", + "description", + "dynamicRoutes", + "id", + "labels", + "name", + "systemRoutes", + "updatedAt")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name")); + } + + /** + * 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 RoutingTable + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RoutingTable.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 RoutingTable is not found in the empty JSON string", + RoutingTable.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RoutingTable.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("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `description` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("description").toString())); + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if (!jsonObj.get("name").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())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RoutingTable.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RoutingTable' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(RoutingTable.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, RoutingTable 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 RoutingTable read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + RoutingTable 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 RoutingTable given an JSON string + * + * @param jsonString JSON string + * @return An instance of RoutingTable + * @throws IOException if the JSON string is invalid with respect to RoutingTable + */ + public static RoutingTable fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RoutingTable.class); + } + + /** + * Convert an instance of RoutingTable to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/RoutingTableListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/RoutingTableListResponse.java new file mode 100644 index 00000000..7094e41a --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/RoutingTableListResponse.java @@ -0,0 +1,327 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2alpha1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2alpha1api.model; + +import cloud.stackit.sdk.iaas.v2alpha1api.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; + +/** Routing table response. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class RoutingTableListResponse { + public static final String SERIALIZED_NAME_ITEMS = "items"; + + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public RoutingTableListResponse() {} + + public RoutingTableListResponse items(@javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public RoutingTableListResponse addItemsItem(RoutingTable itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list of routing tables. + * + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the RoutingTableListResponse instance itself + */ + public RoutingTableListResponse 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; + } + RoutingTableListResponse routingTableListResponse = (RoutingTableListResponse) o; + return Objects.equals(this.items, routingTableListResponse.items) + && Objects.equals( + this.additionalProperties, routingTableListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RoutingTableListResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("items")); + } + + /** + * 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 RoutingTableListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RoutingTableListResponse.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 RoutingTableListResponse is not found in the empty JSON string", + RoutingTableListResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RoutingTableListResponse.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("items").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `items` to be an array in the JSON string but got `%s`", + jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + RoutingTable.validateJsonElement(jsonArrayitems.get(i)); + } + ; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RoutingTableListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RoutingTableListResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(RoutingTableListResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, RoutingTableListResponse 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 RoutingTableListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + RoutingTableListResponse 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 RoutingTableListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of RoutingTableListResponse + * @throws IOException if the JSON string is invalid with respect to RoutingTableListResponse + */ + public static RoutingTableListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RoutingTableListResponse.class); + } + + /** + * Convert an instance of RoutingTableListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/UpdateNetworkIPv4Body.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/UpdateNetworkIPv4Body.java new file mode 100644 index 00000000..2ccd9045 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/UpdateNetworkIPv4Body.java @@ -0,0 +1,357 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2alpha1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2alpha1api.model; + +import cloud.stackit.sdk.iaas.v2alpha1api.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.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; +import org.openapitools.jackson.nullable.JsonNullable; + +/** The config object for a IPv4 network update. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class UpdateNetworkIPv4Body { + public static final String SERIALIZED_NAME_GATEWAY = "gateway"; + + @SerializedName(SERIALIZED_NAME_GATEWAY) + @javax.annotation.Nullable private String gateway; + + public static final String SERIALIZED_NAME_NAMESERVERS = "nameservers"; + + @SerializedName(SERIALIZED_NAME_NAMESERVERS) + @javax.annotation.Nullable private List nameservers = new ArrayList<>(); + + public UpdateNetworkIPv4Body() {} + + public UpdateNetworkIPv4Body gateway(@javax.annotation.Nullable String gateway) { + this.gateway = gateway; + return this; + } + + /** + * The IPv4 gateway of a network. If not specified the first IP of the network will be assigned + * as the gateway. If 'null' is sent, then the network doesn't have a gateway. + * + * @return gateway + */ + @javax.annotation.Nullable public String getGateway() { + return gateway; + } + + public void setGateway(@javax.annotation.Nullable String gateway) { + this.gateway = gateway; + } + + public UpdateNetworkIPv4Body nameservers(@javax.annotation.Nullable List nameservers) { + this.nameservers = nameservers; + return this; + } + + public UpdateNetworkIPv4Body addNameserversItem(String nameserversItem) { + if (this.nameservers == null) { + this.nameservers = new ArrayList<>(); + } + this.nameservers.add(nameserversItem); + return this; + } + + /** + * A list containing DNS Servers/Nameservers for IPv4. + * + * @return nameservers + */ + @javax.annotation.Nullable public List getNameservers() { + return nameservers; + } + + public void setNameservers(@javax.annotation.Nullable List nameservers) { + this.nameservers = nameservers; + } + + /** + * 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 UpdateNetworkIPv4Body instance itself + */ + public UpdateNetworkIPv4Body 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; + } + UpdateNetworkIPv4Body updateNetworkIPv4Body = (UpdateNetworkIPv4Body) o; + return Objects.equals(this.gateway, updateNetworkIPv4Body.gateway) + && Objects.equals(this.nameservers, updateNetworkIPv4Body.nameservers) + && Objects.equals( + this.additionalProperties, updateNetworkIPv4Body.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(gateway, nameservers, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateNetworkIPv4Body {\n"); + sb.append(" gateway: ").append(toIndentedString(gateway)).append("\n"); + sb.append(" nameservers: ").append(toIndentedString(nameservers)).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("gateway", "nameservers")); + + // 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 UpdateNetworkIPv4Body + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateNetworkIPv4Body.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 UpdateNetworkIPv4Body is not found in the empty JSON string", + UpdateNetworkIPv4Body.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("gateway") != null && !jsonObj.get("gateway").isJsonNull()) + && !jsonObj.get("gateway").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `gateway` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("gateway").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("nameservers") != null + && !jsonObj.get("nameservers").isJsonNull() + && !jsonObj.get("nameservers").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `nameservers` to be an array in the JSON string but got `%s`", + jsonObj.get("nameservers").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateNetworkIPv4Body.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateNetworkIPv4Body' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateNetworkIPv4Body.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateNetworkIPv4Body 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 UpdateNetworkIPv4Body read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateNetworkIPv4Body 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 UpdateNetworkIPv4Body given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateNetworkIPv4Body + * @throws IOException if the JSON string is invalid with respect to UpdateNetworkIPv4Body + */ + public static UpdateNetworkIPv4Body fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateNetworkIPv4Body.class); + } + + /** + * Convert an instance of UpdateNetworkIPv4Body to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/UpdateNetworkIPv6Body.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/UpdateNetworkIPv6Body.java new file mode 100644 index 00000000..642c034c --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/UpdateNetworkIPv6Body.java @@ -0,0 +1,357 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2alpha1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2alpha1api.model; + +import cloud.stackit.sdk.iaas.v2alpha1api.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.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; +import org.openapitools.jackson.nullable.JsonNullable; + +/** The config object for a IPv6 network update. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class UpdateNetworkIPv6Body { + public static final String SERIALIZED_NAME_GATEWAY = "gateway"; + + @SerializedName(SERIALIZED_NAME_GATEWAY) + @javax.annotation.Nullable private String gateway; + + public static final String SERIALIZED_NAME_NAMESERVERS = "nameservers"; + + @SerializedName(SERIALIZED_NAME_NAMESERVERS) + @javax.annotation.Nullable private List nameservers = new ArrayList<>(); + + public UpdateNetworkIPv6Body() {} + + public UpdateNetworkIPv6Body gateway(@javax.annotation.Nullable String gateway) { + this.gateway = gateway; + return this; + } + + /** + * The IPv6 gateway of a network. If not specified the first IP of the network will be assigned + * as the gateway. If 'null' is sent, then the network doesn't have a gateway. + * + * @return gateway + */ + @javax.annotation.Nullable public String getGateway() { + return gateway; + } + + public void setGateway(@javax.annotation.Nullable String gateway) { + this.gateway = gateway; + } + + public UpdateNetworkIPv6Body nameservers(@javax.annotation.Nullable List nameservers) { + this.nameservers = nameservers; + return this; + } + + public UpdateNetworkIPv6Body addNameserversItem(String nameserversItem) { + if (this.nameservers == null) { + this.nameservers = new ArrayList<>(); + } + this.nameservers.add(nameserversItem); + return this; + } + + /** + * A list containing DNS Servers/Nameservers for IPv6. + * + * @return nameservers + */ + @javax.annotation.Nullable public List getNameservers() { + return nameservers; + } + + public void setNameservers(@javax.annotation.Nullable List nameservers) { + this.nameservers = nameservers; + } + + /** + * 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 UpdateNetworkIPv6Body instance itself + */ + public UpdateNetworkIPv6Body 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; + } + UpdateNetworkIPv6Body updateNetworkIPv6Body = (UpdateNetworkIPv6Body) o; + return Objects.equals(this.gateway, updateNetworkIPv6Body.gateway) + && Objects.equals(this.nameservers, updateNetworkIPv6Body.nameservers) + && Objects.equals( + this.additionalProperties, updateNetworkIPv6Body.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(gateway, nameservers, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateNetworkIPv6Body {\n"); + sb.append(" gateway: ").append(toIndentedString(gateway)).append("\n"); + sb.append(" nameservers: ").append(toIndentedString(nameservers)).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("gateway", "nameservers")); + + // 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 UpdateNetworkIPv6Body + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateNetworkIPv6Body.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 UpdateNetworkIPv6Body is not found in the empty JSON string", + UpdateNetworkIPv6Body.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("gateway") != null && !jsonObj.get("gateway").isJsonNull()) + && !jsonObj.get("gateway").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `gateway` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("gateway").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("nameservers") != null + && !jsonObj.get("nameservers").isJsonNull() + && !jsonObj.get("nameservers").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `nameservers` to be an array in the JSON string but got `%s`", + jsonObj.get("nameservers").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateNetworkIPv6Body.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateNetworkIPv6Body' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateNetworkIPv6Body.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateNetworkIPv6Body 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 UpdateNetworkIPv6Body read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateNetworkIPv6Body 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 UpdateNetworkIPv6Body given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateNetworkIPv6Body + * @throws IOException if the JSON string is invalid with respect to UpdateNetworkIPv6Body + */ + public static UpdateNetworkIPv6Body fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateNetworkIPv6Body.class); + } + + /** + * Convert an instance of UpdateNetworkIPv6Body to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/UpdateRouteOfRoutingTablePayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/UpdateRouteOfRoutingTablePayload.java new file mode 100644 index 00000000..5a30d4b6 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/UpdateRouteOfRoutingTablePayload.java @@ -0,0 +1,299 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2alpha1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2alpha1api.model; + +import cloud.stackit.sdk.iaas.v2alpha1api.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; + +/** Object that represents the request body for a route update. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class UpdateRouteOfRoutingTablePayload { + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public UpdateRouteOfRoutingTablePayload() {} + + public UpdateRouteOfRoutingTablePayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UpdateRouteOfRoutingTablePayload instance itself + */ + public UpdateRouteOfRoutingTablePayload 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; + } + UpdateRouteOfRoutingTablePayload updateRouteOfRoutingTablePayload = + (UpdateRouteOfRoutingTablePayload) o; + return Objects.equals(this.labels, updateRouteOfRoutingTablePayload.labels) + && Objects.equals( + this.additionalProperties, + updateRouteOfRoutingTablePayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(labels, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateRouteOfRoutingTablePayload {\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("labels")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(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 + * UpdateRouteOfRoutingTablePayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateRouteOfRoutingTablePayload.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 UpdateRouteOfRoutingTablePayload is not found in the empty JSON string", + UpdateRouteOfRoutingTablePayload.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateRouteOfRoutingTablePayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateRouteOfRoutingTablePayload' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(UpdateRouteOfRoutingTablePayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateRouteOfRoutingTablePayload 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 UpdateRouteOfRoutingTablePayload read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateRouteOfRoutingTablePayload 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 UpdateRouteOfRoutingTablePayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateRouteOfRoutingTablePayload + * @throws IOException if the JSON string is invalid with respect to + * UpdateRouteOfRoutingTablePayload + */ + public static UpdateRouteOfRoutingTablePayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateRouteOfRoutingTablePayload.class); + } + + /** + * Convert an instance of UpdateRouteOfRoutingTablePayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/UpdateRoutingTableOfAreaPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/UpdateRoutingTableOfAreaPayload.java new file mode 100644 index 00000000..a7768d0a --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2alpha1api/model/UpdateRoutingTableOfAreaPayload.java @@ -0,0 +1,424 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2alpha1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2alpha1api.model; + +import cloud.stackit.sdk.iaas.v2alpha1api.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; + +/** Object that represents the request body for a routing table update. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class UpdateRoutingTableOfAreaPayload { + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable private String description; + + public static final String SERIALIZED_NAME_DYNAMIC_ROUTES = "dynamicRoutes"; + + @SerializedName(SERIALIZED_NAME_DYNAMIC_ROUTES) + @javax.annotation.Nullable private Boolean dynamicRoutes; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; + + public static final String SERIALIZED_NAME_SYSTEM_ROUTES = "systemRoutes"; + + @SerializedName(SERIALIZED_NAME_SYSTEM_ROUTES) + @javax.annotation.Nullable private Boolean systemRoutes; + + public UpdateRoutingTableOfAreaPayload() {} + + public UpdateRoutingTableOfAreaPayload description( + @javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Description Object. Allows string up to 255 Characters. + * + * @return description + */ + @javax.annotation.Nullable public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + public UpdateRoutingTableOfAreaPayload dynamicRoutes( + @javax.annotation.Nullable Boolean dynamicRoutes) { + this.dynamicRoutes = dynamicRoutes; + return this; + } + + /** + * The update config setting for a routing table which allows propagation of dynamic routes to + * this routing table. + * + * @return dynamicRoutes + */ + @javax.annotation.Nullable public Boolean getDynamicRoutes() { + return dynamicRoutes; + } + + public void setDynamicRoutes(@javax.annotation.Nullable Boolean dynamicRoutes) { + this.dynamicRoutes = dynamicRoutes; + } + + public UpdateRoutingTableOfAreaPayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public UpdateRoutingTableOfAreaPayload name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nullable public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + public UpdateRoutingTableOfAreaPayload systemRoutes( + @javax.annotation.Nullable Boolean systemRoutes) { + this.systemRoutes = systemRoutes; + return this; + } + + /** + * The update config setting for a routing table which allows installation of automatic system + * routes for connectivity between projects in the same SNA. + * + * @return systemRoutes + */ + @javax.annotation.Nullable public Boolean getSystemRoutes() { + return systemRoutes; + } + + public void setSystemRoutes(@javax.annotation.Nullable Boolean systemRoutes) { + this.systemRoutes = systemRoutes; + } + + /** + * 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 UpdateRoutingTableOfAreaPayload instance itself + */ + public UpdateRoutingTableOfAreaPayload 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; + } + UpdateRoutingTableOfAreaPayload updateRoutingTableOfAreaPayload = + (UpdateRoutingTableOfAreaPayload) o; + return Objects.equals(this.description, updateRoutingTableOfAreaPayload.description) + && Objects.equals(this.dynamicRoutes, updateRoutingTableOfAreaPayload.dynamicRoutes) + && Objects.equals(this.labels, updateRoutingTableOfAreaPayload.labels) + && Objects.equals(this.name, updateRoutingTableOfAreaPayload.name) + && Objects.equals(this.systemRoutes, updateRoutingTableOfAreaPayload.systemRoutes) + && Objects.equals( + this.additionalProperties, + updateRoutingTableOfAreaPayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + description, dynamicRoutes, labels, name, systemRoutes, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateRoutingTableOfAreaPayload {\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" dynamicRoutes: ").append(toIndentedString(dynamicRoutes)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" systemRoutes: ").append(toIndentedString(systemRoutes)).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( + "description", "dynamicRoutes", "labels", "name", "systemRoutes")); + + // 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 + * UpdateRoutingTableOfAreaPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateRoutingTableOfAreaPayload.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 UpdateRoutingTableOfAreaPayload is not found in the empty JSON string", + UpdateRoutingTableOfAreaPayload.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `description` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("description").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `name` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateRoutingTableOfAreaPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateRoutingTableOfAreaPayload' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(UpdateRoutingTableOfAreaPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateRoutingTableOfAreaPayload 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 UpdateRoutingTableOfAreaPayload read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateRoutingTableOfAreaPayload 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 UpdateRoutingTableOfAreaPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateRoutingTableOfAreaPayload + * @throws IOException if the JSON string is invalid with respect to + * UpdateRoutingTableOfAreaPayload + */ + public static UpdateRoutingTableOfAreaPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateRoutingTableOfAreaPayload.class); + } + + /** + * Convert an instance of UpdateRoutingTableOfAreaPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/ApiCallback.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/ApiCallback.java similarity index 97% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/ApiCallback.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/ApiCallback.java index 1e6f143f..8efee0ff 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/ApiCallback.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/ApiCallback.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas; +package cloud.stackit.sdk.iaas.v2api; import cloud.stackit.sdk.core.exception.ApiException; import java.util.List; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/ApiClient.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/ApiClient.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/ApiClient.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/ApiClient.java index fbcadb72..9de74931 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/ApiClient.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/ApiClient.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas; +package cloud.stackit.sdk.iaas.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.iaas.ApiClient} object + * @return a {@link cloud.stackit.sdk.iaas.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.iaas.ApiClient} object + * @return a {@link cloud.stackit.sdk.iaas.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.iaas.ApiClient} object + * @return a {@link cloud.stackit.sdk.iaas.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.iaas.ApiClient} object + * @return a {@link cloud.stackit.sdk.iaas.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.iaas.ApiClient} object + * @return a {@link cloud.stackit.sdk.iaas.v2api.ApiClient} object */ public ApiClient setLenientOnJson(boolean lenientOnJson) { JSON.setLenientOnJson(lenientOnJson); diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/ApiResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/ApiResponse.java similarity index 97% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/ApiResponse.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/ApiResponse.java index 4c2f518f..02461368 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/ApiResponse.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/ApiResponse.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas; +package cloud.stackit.sdk.iaas.v2api; import java.util.List; import java.util.Map; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/GzipRequestInterceptor.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/GzipRequestInterceptor.java similarity index 98% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/GzipRequestInterceptor.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/GzipRequestInterceptor.java index 1dcf7655..c4dcc486 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/GzipRequestInterceptor.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/GzipRequestInterceptor.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas; +package cloud.stackit.sdk.iaas.v2api; import java.io.IOException; import okhttp3.*; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/JSON.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/JSON.java similarity index 63% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/JSON.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/JSON.java index 3f9df25d..e5b97e64 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/JSON.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/JSON.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas; +package cloud.stackit.sdk.iaas.v2api; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -60,27 +60,28 @@ public static GsonBuilder createGson() { GsonFireBuilder fireBuilder = new GsonFireBuilder() .registerTypeSelector( - cloud.stackit.sdk.iaas.model.RouteDestination.class, - new TypeSelector() { + cloud.stackit.sdk.iaas.v2api.model.RouteDestination.class, + new TypeSelector< + cloud.stackit.sdk.iaas.v2api.model.RouteDestination>() { @Override public Class< ? extends - cloud.stackit.sdk.iaas.model + cloud.stackit.sdk.iaas.v2api.model .RouteDestination> getClassForElement(JsonElement readElement) { Map classByDiscriminatorValue = new HashMap(); classByDiscriminatorValue.put( "cidrv4", - cloud.stackit.sdk.iaas.model.DestinationCIDRv4 + cloud.stackit.sdk.iaas.v2api.model.DestinationCIDRv4 .class); classByDiscriminatorValue.put( "cidrv6", - cloud.stackit.sdk.iaas.model.DestinationCIDRv6 + cloud.stackit.sdk.iaas.v2api.model.DestinationCIDRv6 .class); classByDiscriminatorValue.put( "Route_destination", - cloud.stackit.sdk.iaas.model.RouteDestination + cloud.stackit.sdk.iaas.v2api.model.RouteDestination .class); return getClassByDiscriminator( classByDiscriminatorValue, @@ -88,32 +89,37 @@ public static GsonBuilder createGson() { } }) .registerTypeSelector( - cloud.stackit.sdk.iaas.model.RouteNexthop.class, - new TypeSelector() { + cloud.stackit.sdk.iaas.v2api.model.RouteNexthop.class, + new TypeSelector< + cloud.stackit.sdk.iaas.v2api.model.RouteNexthop>() { @Override public Class< ? extends - cloud.stackit.sdk.iaas.model + cloud.stackit.sdk.iaas.v2api.model .RouteNexthop> getClassForElement(JsonElement readElement) { Map classByDiscriminatorValue = new HashMap(); classByDiscriminatorValue.put( "blackhole", - cloud.stackit.sdk.iaas.model.NexthopBlackhole + cloud.stackit.sdk.iaas.v2api.model.NexthopBlackhole .class); classByDiscriminatorValue.put( "internet", - cloud.stackit.sdk.iaas.model.NexthopInternet.class); + cloud.stackit.sdk.iaas.v2api.model.NexthopInternet + .class); classByDiscriminatorValue.put( "ipv4", - cloud.stackit.sdk.iaas.model.NexthopIPv4.class); + cloud.stackit.sdk.iaas.v2api.model.NexthopIPv4 + .class); classByDiscriminatorValue.put( "ipv6", - cloud.stackit.sdk.iaas.model.NexthopIPv6.class); + cloud.stackit.sdk.iaas.v2api.model.NexthopIPv6 + .class); classByDiscriminatorValue.put( "Route_nexthop", - cloud.stackit.sdk.iaas.model.RouteNexthop.class); + cloud.stackit.sdk.iaas.v2api.model.RouteNexthop + .class); return getClassByDiscriminator( classByDiscriminatorValue, getDiscriminatorValue(readElement, "type")); @@ -159,334 +165,380 @@ private static Class getClassByDiscriminator( gsonBuilder.registerTypeAdapter(LocalDate.class, localDateTypeAdapter); gsonBuilder.registerTypeAdapter(byte[].class, byteArrayAdapter); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.AddRoutesToRoutingTablePayload + new cloud.stackit.sdk.iaas.v2api.model.AddRoutesToRoutingTablePayload .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.AddRoutingTableToAreaPayload + new cloud.stackit.sdk.iaas.v2api.model.AddRoutingTableToAreaPayload .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.AddVolumeToServerPayload + new cloud.stackit.sdk.iaas.v2api.model.AddVolumeToServerPayload .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.AffinityGroup.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.AffinityGroup.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.AffinityGroupListResponse + new cloud.stackit.sdk.iaas.v2api.model.AffinityGroupListResponse .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.AllowedAddressesInner.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.AllowedAddressesInner + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.AreaId.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.AreaId.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.AvailabilityZoneListResponse + new cloud.stackit.sdk.iaas.v2api.model.AvailabilityZoneListResponse .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.Backup.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.Backup.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.BackupListResponse.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.BackupListResponse + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.BackupSource.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.BackupSource.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.BaseSecurityGroupRule.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.BaseSecurityGroupRule + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.BootVolume.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.BootVolume.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.BootVolumeSource.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.BootVolumeSource.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.CreateAffinityGroupPayload + new cloud.stackit.sdk.iaas.v2api.model.CreateAffinityGroupPayload .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.CreateBackupPayload.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.CreateBackupPayload + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.CreateImagePayload.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.CreateImagePayload + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.CreateIsolatedNetworkPayload + new cloud.stackit.sdk.iaas.v2api.model.CreateIsolatedNetworkPayload .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.CreateKeyPairPayload.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.CreateKeyPairPayload + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.CreateNetworkAreaPayload + new cloud.stackit.sdk.iaas.v2api.model.CreateNetworkAreaPayload .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.CreateNetworkAreaRangePayload + new cloud.stackit.sdk.iaas.v2api.model.CreateNetworkAreaRangePayload .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.CreateNetworkAreaRegionPayload + new cloud.stackit.sdk.iaas.v2api.model.CreateNetworkAreaRegionPayload .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.CreateNetworkAreaRoutePayload + new cloud.stackit.sdk.iaas.v2api.model.CreateNetworkAreaRoutePayload .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.CreateNetworkIPv4.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.CreateNetworkIPv4 + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.CreateNetworkIPv4WithPrefix + new cloud.stackit.sdk.iaas.v2api.model.CreateNetworkIPv4WithPrefix .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.CreateNetworkIPv4WithPrefixLength + new cloud.stackit.sdk.iaas.v2api.model.CreateNetworkIPv4WithPrefixLength .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.CreateNetworkIPv6.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.CreateNetworkIPv6 + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.CreateNetworkIPv6WithPrefix + new cloud.stackit.sdk.iaas.v2api.model.CreateNetworkIPv6WithPrefix .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.CreateNetworkIPv6WithPrefixLength + new cloud.stackit.sdk.iaas.v2api.model.CreateNetworkIPv6WithPrefixLength .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.CreateNetworkPayload.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.CreateNetworkPayload + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.CreateNicPayload.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.CreateNicPayload.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.CreateProtocol.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.CreateProtocol.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.CreatePublicIPPayload.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.CreatePublicIPPayload + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.CreateSecurityGroupPayload + new cloud.stackit.sdk.iaas.v2api.model.CreateSecurityGroupPayload .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.CreateSecurityGroupRulePayload + new cloud.stackit.sdk.iaas.v2api.model.CreateSecurityGroupRulePayload .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.CreateSecurityGroupRuleProtocol + new cloud.stackit.sdk.iaas.v2api.model.CreateSecurityGroupRuleProtocol .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.CreateServerNetworking.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.CreateServerNetworking + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.CreateServerNetworkingWithNics + new cloud.stackit.sdk.iaas.v2api.model.CreateServerNetworkingWithNics .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.CreateServerPayload.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.CreateServerPayload + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.CreateServerPayloadAllOfNetworking + new cloud.stackit.sdk.iaas.v2api.model.CreateServerPayloadAllOfNetworking .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.CreateSnapshotPayload.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.CreateSnapshotPayload + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.CreateVolumePayload.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.CreateVolumePayload + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.DestinationCIDRv4.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.DestinationCIDRv4 + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.DestinationCIDRv6.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.DestinationCIDRv6 + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.Error.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.Error.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.GetServerLog200Response + new cloud.stackit.sdk.iaas.v2api.model.GetServerLog200Response .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.ICMPParameters.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.ICMPParameters.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.Image.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.Image.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.ImageAgent.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.ImageAgent.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.ImageChecksum.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.ImageChecksum.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.ImageConfig.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.ImageConfig.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.ImageCreateResponse.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.ImageCreateResponse + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.ImageFromVolumePayload.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.ImageFromVolumePayload + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.ImageListResponse.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.ImageListResponse + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.ImageShare.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.ImageShare.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.ImageShareConsumer.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.ImageShareConsumer + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.KeyPairListResponse.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.KeyPairListResponse + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.Keypair.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.Keypair.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.MachineType.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.MachineType.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.MachineTypeListResponse + new cloud.stackit.sdk.iaas.v2api.model.MachineTypeListResponse .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.NIC.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.NIC.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.NICListResponse.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.NICListResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.Network.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.Network.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.NetworkArea.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.NetworkArea.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.NetworkAreaListResponse + new cloud.stackit.sdk.iaas.v2api.model.NetworkAreaListResponse .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.NetworkIPv4.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.NetworkIPv4.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.NetworkIPv6.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.NetworkIPv6.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.NetworkListResponse.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.NetworkListResponse + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.NetworkRange.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.NetworkRange.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.NetworkRangeListResponse + new cloud.stackit.sdk.iaas.v2api.model.NetworkRangeListResponse .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.NexthopBlackhole.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.NexthopBlackhole.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.NexthopIPv4.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.NexthopIPv4.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.NexthopIPv6.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.NexthopIPv6.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.NexthopInternet.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.NexthopInternet.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.PartialUpdateNetworkAreaPayload + new cloud.stackit.sdk.iaas.v2api.model.PartialUpdateNetworkAreaPayload .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.PartialUpdateNetworkPayload + new cloud.stackit.sdk.iaas.v2api.model.PartialUpdateNetworkPayload .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.PortRange.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.PortRange.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.Project.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.Project.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.ProjectListResponse.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.ProjectListResponse + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.Protocol.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.Protocol.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.PublicIp.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.PublicIp.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.PublicIpListResponse.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.PublicIpListResponse + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.PublicNetwork.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.PublicNetwork.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.PublicNetworkListResponse + new cloud.stackit.sdk.iaas.v2api.model.PublicNetworkListResponse .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.Quota.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.Quota.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.QuotaList.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.QuotaList.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.QuotaListResponse.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.QuotaListResponse + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.RegionalArea.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.RegionalArea.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.RegionalAreaIPv4.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.RegionalAreaIPv4.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.RegionalAreaListResponse + new cloud.stackit.sdk.iaas.v2api.model.RegionalAreaListResponse .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.Request.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.Request.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.RequestResource.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.RequestResource.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.RescueServerPayload.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.RescueServerPayload + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.ResizeServerPayload.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.ResizeServerPayload + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.ResizeVolumePayload.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.ResizeVolumePayload + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.Route.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.Route.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.RouteDestination.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.RouteDestination.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.RouteListResponse.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.RouteListResponse + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.RouteNexthop.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.RouteNexthop.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.RoutingTable.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.RoutingTable.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.RoutingTableListResponse + new cloud.stackit.sdk.iaas.v2api.model.RoutingTableListResponse .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.SecurityGroup.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.SecurityGroup.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.SecurityGroupListResponse + new cloud.stackit.sdk.iaas.v2api.model.SecurityGroupListResponse .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.SecurityGroupRule.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.SecurityGroupRule + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.SecurityGroupRuleListResponse + new cloud.stackit.sdk.iaas.v2api.model.SecurityGroupRuleListResponse .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.SecurityGroupRuleProtocol + new cloud.stackit.sdk.iaas.v2api.model.SecurityGroupRuleProtocol .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.Server.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.Server.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.ServerAgent.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.ServerAgent.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.ServerConsoleUrl.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.ServerConsoleUrl.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.ServerListResponse.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.ServerListResponse + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.ServerMaintenance.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.ServerMaintenance + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.ServerNetwork.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.ServerNetwork.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.ServerNetworking.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.ServerNetworking.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.ServiceAccountMailListResponse + new cloud.stackit.sdk.iaas.v2api.model.ServiceAccountMailListResponse .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.SetImageSharePayload.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.SetImageSharePayload + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.Snapshot.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.Snapshot.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.SnapshotListResponse.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.SnapshotListResponse + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.UpdateAttachedVolumePayload + new cloud.stackit.sdk.iaas.v2api.model.UpdateAttachedVolumePayload .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.UpdateBackupPayload.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.UpdateBackupPayload + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.UpdateImagePayload.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.UpdateImagePayload + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.UpdateImageSharePayload + new cloud.stackit.sdk.iaas.v2api.model.UpdateImageSharePayload .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.UpdateKeyPairPayload.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.UpdateKeyPairPayload + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.UpdateNetworkAreaRegionPayload + new cloud.stackit.sdk.iaas.v2api.model.UpdateNetworkAreaRegionPayload .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.UpdateNetworkAreaRoutePayload + new cloud.stackit.sdk.iaas.v2api.model.UpdateNetworkAreaRoutePayload .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.UpdateNetworkIPv4Body.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.UpdateNetworkIPv4Body + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.UpdateNetworkIPv6Body.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.UpdateNetworkIPv6Body + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.UpdateNicPayload.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.UpdateNicPayload.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.UpdatePublicIPPayload.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.UpdatePublicIPPayload + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.UpdateRegionalAreaIPv4.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.UpdateRegionalAreaIPv4 + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.UpdateRouteOfRoutingTablePayload + new cloud.stackit.sdk.iaas.v2api.model.UpdateRouteOfRoutingTablePayload .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.UpdateRoutingTableOfAreaPayload + new cloud.stackit.sdk.iaas.v2api.model.UpdateRoutingTableOfAreaPayload .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.UpdateSecurityGroupPayload + new cloud.stackit.sdk.iaas.v2api.model.UpdateSecurityGroupPayload .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.UpdateServerPayload.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.UpdateServerPayload + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.UpdateSnapshotPayload.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.UpdateSnapshotPayload + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.UpdateVolumePayload.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.UpdateVolumePayload + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.Volume.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.Volume.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.VolumeAttachment.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.VolumeAttachment.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.VolumeAttachmentListResponse + new cloud.stackit.sdk.iaas.v2api.model.VolumeAttachmentListResponse .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.VolumeEncryptionParameter + new cloud.stackit.sdk.iaas.v2api.model.VolumeEncryptionParameter .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.VolumeListResponse.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.VolumeListResponse + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.VolumePerformanceClass.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.VolumePerformanceClass + .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.VolumePerformanceClassListResponse + new cloud.stackit.sdk.iaas.v2api.model.VolumePerformanceClassListResponse .CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory( - new cloud.stackit.sdk.iaas.model.VolumeSource.CustomTypeAdapterFactory()); + new cloud.stackit.sdk.iaas.v2api.model.VolumeSource.CustomTypeAdapterFactory()); gson = gsonBuilder.create(); } diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/Pair.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/Pair.java similarity index 95% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/Pair.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/Pair.java index dc57930d..de90fa7c 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/Pair.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/Pair.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas; +package cloud.stackit.sdk.iaas.v2api; @javax.annotation.Generated( value = "org.openapitools.codegen.languages.JavaClientCodegen", diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/ProgressRequestBody.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/ProgressRequestBody.java similarity index 97% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/ProgressRequestBody.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/ProgressRequestBody.java index 08d131df..80c7a94b 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/ProgressRequestBody.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/ProgressRequestBody.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas; +package cloud.stackit.sdk.iaas.v2api; import java.io.IOException; import okhttp3.MediaType; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/ProgressResponseBody.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/ProgressResponseBody.java similarity index 97% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/ProgressResponseBody.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/ProgressResponseBody.java index 9eab5aa7..7569467c 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/ProgressResponseBody.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/ProgressResponseBody.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas; +package cloud.stackit.sdk.iaas.v2api; import java.io.IOException; import okhttp3.MediaType; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/ServerConfiguration.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/ServerConfiguration.java similarity index 98% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/ServerConfiguration.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/ServerConfiguration.java index 7ac9ed5c..a772f606 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/ServerConfiguration.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/ServerConfiguration.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas; +package cloud.stackit.sdk.iaas.v2api; import java.util.Map; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/ServerVariable.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/ServerVariable.java similarity index 96% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/ServerVariable.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/ServerVariable.java index d2925be9..72d66d3c 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/ServerVariable.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/ServerVariable.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas; +package cloud.stackit.sdk.iaas.v2api; import java.util.HashSet; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/StringUtil.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/StringUtil.java similarity index 98% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/StringUtil.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/StringUtil.java index ff3e6083..b0ab9115 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/StringUtil.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/StringUtil.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas; +package cloud.stackit.sdk.iaas.v2api; import java.util.Collection; import java.util.Iterator; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/api/DefaultApi.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/api/DefaultApi.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/api/DefaultApi.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/api/DefaultApi.java index 252f0852..eb68ad37 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/api/DefaultApi.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/api/DefaultApi.java @@ -10,108 +10,108 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.api; +package cloud.stackit.sdk.iaas.v2api.api; import cloud.stackit.sdk.core.config.CoreConfiguration; import cloud.stackit.sdk.core.exception.ApiException; -import cloud.stackit.sdk.iaas.ApiCallback; -import cloud.stackit.sdk.iaas.ApiClient; -import cloud.stackit.sdk.iaas.ApiResponse; -import cloud.stackit.sdk.iaas.Pair; -import cloud.stackit.sdk.iaas.model.AddRoutesToRoutingTablePayload; -import cloud.stackit.sdk.iaas.model.AddRoutingTableToAreaPayload; -import cloud.stackit.sdk.iaas.model.AddVolumeToServerPayload; -import cloud.stackit.sdk.iaas.model.AffinityGroup; -import cloud.stackit.sdk.iaas.model.AffinityGroupListResponse; -import cloud.stackit.sdk.iaas.model.AvailabilityZoneListResponse; -import cloud.stackit.sdk.iaas.model.Backup; -import cloud.stackit.sdk.iaas.model.BackupListResponse; -import cloud.stackit.sdk.iaas.model.CreateAffinityGroupPayload; -import cloud.stackit.sdk.iaas.model.CreateBackupPayload; -import cloud.stackit.sdk.iaas.model.CreateImagePayload; -import cloud.stackit.sdk.iaas.model.CreateIsolatedNetworkPayload; -import cloud.stackit.sdk.iaas.model.CreateKeyPairPayload; -import cloud.stackit.sdk.iaas.model.CreateNetworkAreaPayload; -import cloud.stackit.sdk.iaas.model.CreateNetworkAreaRangePayload; -import cloud.stackit.sdk.iaas.model.CreateNetworkAreaRegionPayload; -import cloud.stackit.sdk.iaas.model.CreateNetworkAreaRoutePayload; -import cloud.stackit.sdk.iaas.model.CreateNetworkPayload; -import cloud.stackit.sdk.iaas.model.CreateNicPayload; -import cloud.stackit.sdk.iaas.model.CreatePublicIPPayload; -import cloud.stackit.sdk.iaas.model.CreateSecurityGroupPayload; -import cloud.stackit.sdk.iaas.model.CreateSecurityGroupRulePayload; -import cloud.stackit.sdk.iaas.model.CreateServerPayload; -import cloud.stackit.sdk.iaas.model.CreateSnapshotPayload; -import cloud.stackit.sdk.iaas.model.CreateVolumePayload; -import cloud.stackit.sdk.iaas.model.GetServerLog200Response; -import cloud.stackit.sdk.iaas.model.Image; -import cloud.stackit.sdk.iaas.model.ImageCreateResponse; -import cloud.stackit.sdk.iaas.model.ImageFromVolumePayload; -import cloud.stackit.sdk.iaas.model.ImageListResponse; -import cloud.stackit.sdk.iaas.model.ImageShare; -import cloud.stackit.sdk.iaas.model.ImageShareConsumer; -import cloud.stackit.sdk.iaas.model.KeyPairListResponse; -import cloud.stackit.sdk.iaas.model.Keypair; -import cloud.stackit.sdk.iaas.model.MachineType; -import cloud.stackit.sdk.iaas.model.MachineTypeListResponse; -import cloud.stackit.sdk.iaas.model.NIC; -import cloud.stackit.sdk.iaas.model.NICListResponse; -import cloud.stackit.sdk.iaas.model.Network; -import cloud.stackit.sdk.iaas.model.NetworkArea; -import cloud.stackit.sdk.iaas.model.NetworkAreaListResponse; -import cloud.stackit.sdk.iaas.model.NetworkListResponse; -import cloud.stackit.sdk.iaas.model.NetworkRange; -import cloud.stackit.sdk.iaas.model.NetworkRangeListResponse; -import cloud.stackit.sdk.iaas.model.PartialUpdateNetworkAreaPayload; -import cloud.stackit.sdk.iaas.model.PartialUpdateNetworkPayload; -import cloud.stackit.sdk.iaas.model.Project; -import cloud.stackit.sdk.iaas.model.ProjectListResponse; -import cloud.stackit.sdk.iaas.model.PublicIp; -import cloud.stackit.sdk.iaas.model.PublicIpListResponse; -import cloud.stackit.sdk.iaas.model.PublicNetworkListResponse; -import cloud.stackit.sdk.iaas.model.QuotaListResponse; -import cloud.stackit.sdk.iaas.model.RegionalArea; -import cloud.stackit.sdk.iaas.model.RegionalAreaListResponse; -import cloud.stackit.sdk.iaas.model.Request; -import cloud.stackit.sdk.iaas.model.RescueServerPayload; -import cloud.stackit.sdk.iaas.model.ResizeServerPayload; -import cloud.stackit.sdk.iaas.model.ResizeVolumePayload; -import cloud.stackit.sdk.iaas.model.Route; -import cloud.stackit.sdk.iaas.model.RouteListResponse; -import cloud.stackit.sdk.iaas.model.RoutingTable; -import cloud.stackit.sdk.iaas.model.RoutingTableListResponse; -import cloud.stackit.sdk.iaas.model.SecurityGroup; -import cloud.stackit.sdk.iaas.model.SecurityGroupListResponse; -import cloud.stackit.sdk.iaas.model.SecurityGroupRule; -import cloud.stackit.sdk.iaas.model.SecurityGroupRuleListResponse; -import cloud.stackit.sdk.iaas.model.Server; -import cloud.stackit.sdk.iaas.model.ServerConsoleUrl; -import cloud.stackit.sdk.iaas.model.ServerListResponse; -import cloud.stackit.sdk.iaas.model.ServiceAccountMailListResponse; -import cloud.stackit.sdk.iaas.model.SetImageSharePayload; -import cloud.stackit.sdk.iaas.model.Snapshot; -import cloud.stackit.sdk.iaas.model.SnapshotListResponse; -import cloud.stackit.sdk.iaas.model.UpdateAttachedVolumePayload; -import cloud.stackit.sdk.iaas.model.UpdateBackupPayload; -import cloud.stackit.sdk.iaas.model.UpdateImagePayload; -import cloud.stackit.sdk.iaas.model.UpdateImageSharePayload; -import cloud.stackit.sdk.iaas.model.UpdateKeyPairPayload; -import cloud.stackit.sdk.iaas.model.UpdateNetworkAreaRegionPayload; -import cloud.stackit.sdk.iaas.model.UpdateNetworkAreaRoutePayload; -import cloud.stackit.sdk.iaas.model.UpdateNicPayload; -import cloud.stackit.sdk.iaas.model.UpdatePublicIPPayload; -import cloud.stackit.sdk.iaas.model.UpdateRouteOfRoutingTablePayload; -import cloud.stackit.sdk.iaas.model.UpdateRoutingTableOfAreaPayload; -import cloud.stackit.sdk.iaas.model.UpdateSecurityGroupPayload; -import cloud.stackit.sdk.iaas.model.UpdateServerPayload; -import cloud.stackit.sdk.iaas.model.UpdateSnapshotPayload; -import cloud.stackit.sdk.iaas.model.UpdateVolumePayload; -import cloud.stackit.sdk.iaas.model.Volume; -import cloud.stackit.sdk.iaas.model.VolumeAttachment; -import cloud.stackit.sdk.iaas.model.VolumeAttachmentListResponse; -import cloud.stackit.sdk.iaas.model.VolumeListResponse; -import cloud.stackit.sdk.iaas.model.VolumePerformanceClass; -import cloud.stackit.sdk.iaas.model.VolumePerformanceClassListResponse; +import cloud.stackit.sdk.iaas.v2api.ApiCallback; +import cloud.stackit.sdk.iaas.v2api.ApiClient; +import cloud.stackit.sdk.iaas.v2api.ApiResponse; +import cloud.stackit.sdk.iaas.v2api.Pair; +import cloud.stackit.sdk.iaas.v2api.model.AddRoutesToRoutingTablePayload; +import cloud.stackit.sdk.iaas.v2api.model.AddRoutingTableToAreaPayload; +import cloud.stackit.sdk.iaas.v2api.model.AddVolumeToServerPayload; +import cloud.stackit.sdk.iaas.v2api.model.AffinityGroup; +import cloud.stackit.sdk.iaas.v2api.model.AffinityGroupListResponse; +import cloud.stackit.sdk.iaas.v2api.model.AvailabilityZoneListResponse; +import cloud.stackit.sdk.iaas.v2api.model.Backup; +import cloud.stackit.sdk.iaas.v2api.model.BackupListResponse; +import cloud.stackit.sdk.iaas.v2api.model.CreateAffinityGroupPayload; +import cloud.stackit.sdk.iaas.v2api.model.CreateBackupPayload; +import cloud.stackit.sdk.iaas.v2api.model.CreateImagePayload; +import cloud.stackit.sdk.iaas.v2api.model.CreateIsolatedNetworkPayload; +import cloud.stackit.sdk.iaas.v2api.model.CreateKeyPairPayload; +import cloud.stackit.sdk.iaas.v2api.model.CreateNetworkAreaPayload; +import cloud.stackit.sdk.iaas.v2api.model.CreateNetworkAreaRangePayload; +import cloud.stackit.sdk.iaas.v2api.model.CreateNetworkAreaRegionPayload; +import cloud.stackit.sdk.iaas.v2api.model.CreateNetworkAreaRoutePayload; +import cloud.stackit.sdk.iaas.v2api.model.CreateNetworkPayload; +import cloud.stackit.sdk.iaas.v2api.model.CreateNicPayload; +import cloud.stackit.sdk.iaas.v2api.model.CreatePublicIPPayload; +import cloud.stackit.sdk.iaas.v2api.model.CreateSecurityGroupPayload; +import cloud.stackit.sdk.iaas.v2api.model.CreateSecurityGroupRulePayload; +import cloud.stackit.sdk.iaas.v2api.model.CreateServerPayload; +import cloud.stackit.sdk.iaas.v2api.model.CreateSnapshotPayload; +import cloud.stackit.sdk.iaas.v2api.model.CreateVolumePayload; +import cloud.stackit.sdk.iaas.v2api.model.GetServerLog200Response; +import cloud.stackit.sdk.iaas.v2api.model.Image; +import cloud.stackit.sdk.iaas.v2api.model.ImageCreateResponse; +import cloud.stackit.sdk.iaas.v2api.model.ImageFromVolumePayload; +import cloud.stackit.sdk.iaas.v2api.model.ImageListResponse; +import cloud.stackit.sdk.iaas.v2api.model.ImageShare; +import cloud.stackit.sdk.iaas.v2api.model.ImageShareConsumer; +import cloud.stackit.sdk.iaas.v2api.model.KeyPairListResponse; +import cloud.stackit.sdk.iaas.v2api.model.Keypair; +import cloud.stackit.sdk.iaas.v2api.model.MachineType; +import cloud.stackit.sdk.iaas.v2api.model.MachineTypeListResponse; +import cloud.stackit.sdk.iaas.v2api.model.NIC; +import cloud.stackit.sdk.iaas.v2api.model.NICListResponse; +import cloud.stackit.sdk.iaas.v2api.model.Network; +import cloud.stackit.sdk.iaas.v2api.model.NetworkArea; +import cloud.stackit.sdk.iaas.v2api.model.NetworkAreaListResponse; +import cloud.stackit.sdk.iaas.v2api.model.NetworkListResponse; +import cloud.stackit.sdk.iaas.v2api.model.NetworkRange; +import cloud.stackit.sdk.iaas.v2api.model.NetworkRangeListResponse; +import cloud.stackit.sdk.iaas.v2api.model.PartialUpdateNetworkAreaPayload; +import cloud.stackit.sdk.iaas.v2api.model.PartialUpdateNetworkPayload; +import cloud.stackit.sdk.iaas.v2api.model.Project; +import cloud.stackit.sdk.iaas.v2api.model.ProjectListResponse; +import cloud.stackit.sdk.iaas.v2api.model.PublicIp; +import cloud.stackit.sdk.iaas.v2api.model.PublicIpListResponse; +import cloud.stackit.sdk.iaas.v2api.model.PublicNetworkListResponse; +import cloud.stackit.sdk.iaas.v2api.model.QuotaListResponse; +import cloud.stackit.sdk.iaas.v2api.model.RegionalArea; +import cloud.stackit.sdk.iaas.v2api.model.RegionalAreaListResponse; +import cloud.stackit.sdk.iaas.v2api.model.Request; +import cloud.stackit.sdk.iaas.v2api.model.RescueServerPayload; +import cloud.stackit.sdk.iaas.v2api.model.ResizeServerPayload; +import cloud.stackit.sdk.iaas.v2api.model.ResizeVolumePayload; +import cloud.stackit.sdk.iaas.v2api.model.Route; +import cloud.stackit.sdk.iaas.v2api.model.RouteListResponse; +import cloud.stackit.sdk.iaas.v2api.model.RoutingTable; +import cloud.stackit.sdk.iaas.v2api.model.RoutingTableListResponse; +import cloud.stackit.sdk.iaas.v2api.model.SecurityGroup; +import cloud.stackit.sdk.iaas.v2api.model.SecurityGroupListResponse; +import cloud.stackit.sdk.iaas.v2api.model.SecurityGroupRule; +import cloud.stackit.sdk.iaas.v2api.model.SecurityGroupRuleListResponse; +import cloud.stackit.sdk.iaas.v2api.model.Server; +import cloud.stackit.sdk.iaas.v2api.model.ServerConsoleUrl; +import cloud.stackit.sdk.iaas.v2api.model.ServerListResponse; +import cloud.stackit.sdk.iaas.v2api.model.ServiceAccountMailListResponse; +import cloud.stackit.sdk.iaas.v2api.model.SetImageSharePayload; +import cloud.stackit.sdk.iaas.v2api.model.Snapshot; +import cloud.stackit.sdk.iaas.v2api.model.SnapshotListResponse; +import cloud.stackit.sdk.iaas.v2api.model.UpdateAttachedVolumePayload; +import cloud.stackit.sdk.iaas.v2api.model.UpdateBackupPayload; +import cloud.stackit.sdk.iaas.v2api.model.UpdateImagePayload; +import cloud.stackit.sdk.iaas.v2api.model.UpdateImageSharePayload; +import cloud.stackit.sdk.iaas.v2api.model.UpdateKeyPairPayload; +import cloud.stackit.sdk.iaas.v2api.model.UpdateNetworkAreaRegionPayload; +import cloud.stackit.sdk.iaas.v2api.model.UpdateNetworkAreaRoutePayload; +import cloud.stackit.sdk.iaas.v2api.model.UpdateNicPayload; +import cloud.stackit.sdk.iaas.v2api.model.UpdatePublicIPPayload; +import cloud.stackit.sdk.iaas.v2api.model.UpdateRouteOfRoutingTablePayload; +import cloud.stackit.sdk.iaas.v2api.model.UpdateRoutingTableOfAreaPayload; +import cloud.stackit.sdk.iaas.v2api.model.UpdateSecurityGroupPayload; +import cloud.stackit.sdk.iaas.v2api.model.UpdateServerPayload; +import cloud.stackit.sdk.iaas.v2api.model.UpdateSnapshotPayload; +import cloud.stackit.sdk.iaas.v2api.model.UpdateVolumePayload; +import cloud.stackit.sdk.iaas.v2api.model.Volume; +import cloud.stackit.sdk.iaas.v2api.model.VolumeAttachment; +import cloud.stackit.sdk.iaas.v2api.model.VolumeAttachmentListResponse; +import cloud.stackit.sdk.iaas.v2api.model.VolumeListResponse; +import cloud.stackit.sdk.iaas.v2api.model.VolumePerformanceClass; +import cloud.stackit.sdk.iaas.v2api.model.VolumePerformanceClassListResponse; import com.google.gson.reflect.TypeToken; import java.io.IOException; import java.lang.reflect.Type; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/api/IaasApi.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/api/IaasApi.java similarity index 93% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/api/IaasApi.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/api/IaasApi.java index 8646560a..a2921daa 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/api/IaasApi.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/api/IaasApi.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.api; +package cloud.stackit.sdk.iaas.v2api.api; import cloud.stackit.sdk.core.config.CoreConfiguration; import java.io.IOException; @@ -33,7 +33,7 @@ public IaasApi() 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 IaasApi(CoreConfiguration configuration) throws IOException { diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/AbstractOpenApiSchema.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/AbstractOpenApiSchema.java similarity index 98% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/AbstractOpenApiSchema.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/AbstractOpenApiSchema.java index c41a84a1..d75fd741 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/AbstractOpenApiSchema.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/AbstractOpenApiSchema.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; import java.util.Map; import java.util.Objects; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/AddRoutesToRoutingTablePayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/AddRoutesToRoutingTablePayload.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/AddRoutesToRoutingTablePayload.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/AddRoutesToRoutingTablePayload.java index 7c7363c3..36145625 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/AddRoutesToRoutingTablePayload.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/AddRoutesToRoutingTablePayload.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/AddRoutingTableToAreaPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/AddRoutingTableToAreaPayload.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/AddRoutingTableToAreaPayload.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/AddRoutingTableToAreaPayload.java index 00eba24f..c8fed02c 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/AddRoutingTableToAreaPayload.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/AddRoutingTableToAreaPayload.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/AddVolumeToServerPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/AddVolumeToServerPayload.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/AddVolumeToServerPayload.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/AddVolumeToServerPayload.java index 9c2459b9..073c5cb3 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/AddVolumeToServerPayload.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/AddVolumeToServerPayload.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/AffinityGroup.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/AffinityGroup.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/AffinityGroup.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/AffinityGroup.java index 8c944b26..3cea044e 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/AffinityGroup.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/AffinityGroup.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/AffinityGroupListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/AffinityGroupListResponse.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/AffinityGroupListResponse.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/AffinityGroupListResponse.java index 2c598a5b..76fda88f 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/AffinityGroupListResponse.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/AffinityGroupListResponse.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/AllowedAddressesInner.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/AllowedAddressesInner.java similarity index 98% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/AllowedAddressesInner.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/AllowedAddressesInner.java index e24d3e10..3a7267d2 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/AllowedAddressesInner.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/AllowedAddressesInner.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonPrimitive; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/AreaId.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/AreaId.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/AreaId.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/AreaId.java index 293d999c..31413d04 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/AreaId.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/AreaId.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.TypeAdapter; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/AvailabilityZoneListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/AvailabilityZoneListResponse.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/AvailabilityZoneListResponse.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/AvailabilityZoneListResponse.java index 67829cbb..aaf50607 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/AvailabilityZoneListResponse.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/AvailabilityZoneListResponse.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/Backup.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/Backup.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/Backup.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/Backup.java index 6e904d54..6be36283 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/Backup.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/Backup.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/BackupListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/BackupListResponse.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/BackupListResponse.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/BackupListResponse.java index 780981ff..9b0304a2 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/BackupListResponse.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/BackupListResponse.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/BackupSource.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/BackupSource.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/BackupSource.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/BackupSource.java index 147d3971..98394859 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/BackupSource.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/BackupSource.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/BaseSecurityGroupRule.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/BaseSecurityGroupRule.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/BaseSecurityGroupRule.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/BaseSecurityGroupRule.java index 33d8da6f..7c52a0ca 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/BaseSecurityGroupRule.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/BaseSecurityGroupRule.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/BootVolume.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/BootVolume.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/BootVolume.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/BootVolume.java index d559bff6..e2e8ac00 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/BootVolume.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/BootVolume.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/BootVolumeSource.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/BootVolumeSource.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/BootVolumeSource.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/BootVolumeSource.java index 29541640..5f5662d9 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/BootVolumeSource.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/BootVolumeSource.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateAffinityGroupPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateAffinityGroupPayload.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateAffinityGroupPayload.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateAffinityGroupPayload.java index ab09a8b4..858a7081 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateAffinityGroupPayload.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateAffinityGroupPayload.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateBackupPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateBackupPayload.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateBackupPayload.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateBackupPayload.java index aac4c8b7..ba515908 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateBackupPayload.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateBackupPayload.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateImagePayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateImagePayload.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateImagePayload.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateImagePayload.java index 764c7b32..1b75e14f 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateImagePayload.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateImagePayload.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateIsolatedNetworkPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateIsolatedNetworkPayload.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateIsolatedNetworkPayload.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateIsolatedNetworkPayload.java index b0a6512d..0238be46 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateIsolatedNetworkPayload.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateIsolatedNetworkPayload.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateKeyPairPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateKeyPairPayload.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateKeyPairPayload.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateKeyPairPayload.java index 12d11eda..8a8e9e22 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateKeyPairPayload.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateKeyPairPayload.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateNetworkAreaPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateNetworkAreaPayload.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateNetworkAreaPayload.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateNetworkAreaPayload.java index 1c71ab16..8577ec8f 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateNetworkAreaPayload.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateNetworkAreaPayload.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateNetworkAreaRangePayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateNetworkAreaRangePayload.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateNetworkAreaRangePayload.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateNetworkAreaRangePayload.java index 9073631e..71f7c5bd 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateNetworkAreaRangePayload.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateNetworkAreaRangePayload.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateNetworkAreaRegionPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateNetworkAreaRegionPayload.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateNetworkAreaRegionPayload.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateNetworkAreaRegionPayload.java index 995c59b7..5d74c003 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateNetworkAreaRegionPayload.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateNetworkAreaRegionPayload.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateNetworkAreaRoutePayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateNetworkAreaRoutePayload.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateNetworkAreaRoutePayload.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateNetworkAreaRoutePayload.java index ed593d36..8a26471c 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateNetworkAreaRoutePayload.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateNetworkAreaRoutePayload.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateNetworkIPv4.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateNetworkIPv4.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateNetworkIPv4.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateNetworkIPv4.java index 2ee5043d..cad4e581 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateNetworkIPv4.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateNetworkIPv4.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.TypeAdapter; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateNetworkIPv4WithPrefix.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateNetworkIPv4WithPrefix.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateNetworkIPv4WithPrefix.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateNetworkIPv4WithPrefix.java index c63a625c..10e46166 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateNetworkIPv4WithPrefix.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateNetworkIPv4WithPrefix.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateNetworkIPv4WithPrefixLength.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateNetworkIPv4WithPrefixLength.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateNetworkIPv4WithPrefixLength.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateNetworkIPv4WithPrefixLength.java index fd25c7d7..43b52819 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateNetworkIPv4WithPrefixLength.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateNetworkIPv4WithPrefixLength.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateNetworkIPv6.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateNetworkIPv6.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateNetworkIPv6.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateNetworkIPv6.java index 90e6aeaf..8212bf9f 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateNetworkIPv6.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateNetworkIPv6.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.TypeAdapter; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateNetworkIPv6WithPrefix.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateNetworkIPv6WithPrefix.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateNetworkIPv6WithPrefix.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateNetworkIPv6WithPrefix.java index 91501338..4121d8cd 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateNetworkIPv6WithPrefix.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateNetworkIPv6WithPrefix.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateNetworkIPv6WithPrefixLength.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateNetworkIPv6WithPrefixLength.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateNetworkIPv6WithPrefixLength.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateNetworkIPv6WithPrefixLength.java index 1e6e7371..06cc17b8 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateNetworkIPv6WithPrefixLength.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateNetworkIPv6WithPrefixLength.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateNetworkPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateNetworkPayload.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateNetworkPayload.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateNetworkPayload.java index caba2f0f..33d52960 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateNetworkPayload.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateNetworkPayload.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateNicPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateNicPayload.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateNicPayload.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateNicPayload.java index ba00a131..603dff8b 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateNicPayload.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateNicPayload.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateProtocol.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateProtocol.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateProtocol.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateProtocol.java index 0a5cf686..faeb283e 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateProtocol.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateProtocol.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonPrimitive; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreatePublicIPPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreatePublicIPPayload.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreatePublicIPPayload.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreatePublicIPPayload.java index cbef621b..f403eef0 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreatePublicIPPayload.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreatePublicIPPayload.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateSecurityGroupPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateSecurityGroupPayload.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateSecurityGroupPayload.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateSecurityGroupPayload.java index a1211078..bbaa9bca 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateSecurityGroupPayload.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateSecurityGroupPayload.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateSecurityGroupRulePayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateSecurityGroupRulePayload.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateSecurityGroupRulePayload.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateSecurityGroupRulePayload.java index 9e2c5e6d..60fb2d0a 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateSecurityGroupRulePayload.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateSecurityGroupRulePayload.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateSecurityGroupRuleProtocol.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateSecurityGroupRuleProtocol.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateSecurityGroupRuleProtocol.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateSecurityGroupRuleProtocol.java index 7e180891..7a89fd79 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateSecurityGroupRuleProtocol.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateSecurityGroupRuleProtocol.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateServerNetworking.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateServerNetworking.java similarity index 98% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateServerNetworking.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateServerNetworking.java index 5b8080ea..8d66b4ce 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateServerNetworking.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateServerNetworking.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateServerNetworkingWithNics.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateServerNetworkingWithNics.java similarity index 98% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateServerNetworkingWithNics.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateServerNetworkingWithNics.java index c513993a..fd2a580c 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateServerNetworkingWithNics.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateServerNetworkingWithNics.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateServerPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateServerPayload.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateServerPayload.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateServerPayload.java index b7247783..870b13b5 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateServerPayload.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateServerPayload.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateServerPayloadAllOfNetworking.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateServerPayloadAllOfNetworking.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateServerPayloadAllOfNetworking.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateServerPayloadAllOfNetworking.java index 2de41fc5..44bf70c4 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateServerPayloadAllOfNetworking.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateServerPayloadAllOfNetworking.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.TypeAdapter; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateSnapshotPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateSnapshotPayload.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateSnapshotPayload.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateSnapshotPayload.java index a05aa21d..d939e1e2 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateSnapshotPayload.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateSnapshotPayload.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateVolumePayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateVolumePayload.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateVolumePayload.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateVolumePayload.java index 6a275c81..93d138b2 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/CreateVolumePayload.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/CreateVolumePayload.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/DestinationCIDRv4.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/DestinationCIDRv4.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/DestinationCIDRv4.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/DestinationCIDRv4.java index 9ae12f57..d9349e4b 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/DestinationCIDRv4.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/DestinationCIDRv4.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/DestinationCIDRv6.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/DestinationCIDRv6.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/DestinationCIDRv6.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/DestinationCIDRv6.java index aaeff173..798966d3 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/DestinationCIDRv6.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/DestinationCIDRv6.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/Error.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/Error.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/Error.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/Error.java index cfb15cf9..939cd572 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/Error.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/Error.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/GetServerLog200Response.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/GetServerLog200Response.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/GetServerLog200Response.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/GetServerLog200Response.java index dfc77bb4..8974b94a 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/GetServerLog200Response.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/GetServerLog200Response.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ICMPParameters.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ICMPParameters.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ICMPParameters.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ICMPParameters.java index cbe4ef3c..db9e57a1 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ICMPParameters.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ICMPParameters.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/Image.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/Image.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/Image.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/Image.java index daea55b4..f08fd73f 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/Image.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/Image.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ImageAgent.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ImageAgent.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ImageAgent.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ImageAgent.java index 356ab08b..0ea23a1a 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ImageAgent.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ImageAgent.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ImageChecksum.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ImageChecksum.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ImageChecksum.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ImageChecksum.java index 78efa2ab..ecb88d34 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ImageChecksum.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ImageChecksum.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ImageConfig.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ImageConfig.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ImageConfig.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ImageConfig.java index 4f057fd7..2eb6cd63 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ImageConfig.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ImageConfig.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ImageCreateResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ImageCreateResponse.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ImageCreateResponse.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ImageCreateResponse.java index c6b8e6d7..9ec785e7 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ImageCreateResponse.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ImageCreateResponse.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ImageFromVolumePayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ImageFromVolumePayload.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ImageFromVolumePayload.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ImageFromVolumePayload.java index 43e7d2a8..6163ba88 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ImageFromVolumePayload.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ImageFromVolumePayload.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ImageListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ImageListResponse.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ImageListResponse.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ImageListResponse.java index fb377065..f9428f58 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ImageListResponse.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ImageListResponse.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ImageShare.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ImageShare.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ImageShare.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ImageShare.java index d888146a..33080985 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ImageShare.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ImageShare.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ImageShareConsumer.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ImageShareConsumer.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ImageShareConsumer.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ImageShareConsumer.java index 6afcaf53..e4e4bebf 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ImageShareConsumer.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ImageShareConsumer.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/KeyPairListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/KeyPairListResponse.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/KeyPairListResponse.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/KeyPairListResponse.java index 484a036b..df0e9dab 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/KeyPairListResponse.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/KeyPairListResponse.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/Keypair.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/Keypair.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/Keypair.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/Keypair.java index ff232c2d..9485971e 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/Keypair.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/Keypair.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/MachineType.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/MachineType.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/MachineType.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/MachineType.java index 78aeef17..7d4b9626 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/MachineType.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/MachineType.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/MachineTypeListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/MachineTypeListResponse.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/MachineTypeListResponse.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/MachineTypeListResponse.java index ee9b724b..ef79f0c7 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/MachineTypeListResponse.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/MachineTypeListResponse.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/NIC.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/NIC.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/NIC.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/NIC.java index bd7c3792..0f1e2ede 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/NIC.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/NIC.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/NICListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/NICListResponse.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/NICListResponse.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/NICListResponse.java index 1c475a7c..b23e443d 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/NICListResponse.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/NICListResponse.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/Network.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/Network.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/Network.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/Network.java index bc53f773..242c8537 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/Network.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/Network.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/NetworkArea.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/NetworkArea.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/NetworkArea.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/NetworkArea.java index babf1c63..a04d0574 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/NetworkArea.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/NetworkArea.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/NetworkAreaListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/NetworkAreaListResponse.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/NetworkAreaListResponse.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/NetworkAreaListResponse.java index 4a4f7030..0c866bae 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/NetworkAreaListResponse.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/NetworkAreaListResponse.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/NetworkIPv4.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/NetworkIPv4.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/NetworkIPv4.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/NetworkIPv4.java index a697efcc..f0da0f08 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/NetworkIPv4.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/NetworkIPv4.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/NetworkIPv6.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/NetworkIPv6.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/NetworkIPv6.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/NetworkIPv6.java index 5fc2d028..73e36606 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/NetworkIPv6.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/NetworkIPv6.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/NetworkListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/NetworkListResponse.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/NetworkListResponse.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/NetworkListResponse.java index dc2a1435..678338b8 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/NetworkListResponse.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/NetworkListResponse.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/NetworkRange.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/NetworkRange.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/NetworkRange.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/NetworkRange.java index 16297a7c..39d9dcef 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/NetworkRange.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/NetworkRange.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/NetworkRangeListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/NetworkRangeListResponse.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/NetworkRangeListResponse.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/NetworkRangeListResponse.java index d4aa5f25..ff561579 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/NetworkRangeListResponse.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/NetworkRangeListResponse.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/NexthopBlackhole.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/NexthopBlackhole.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/NexthopBlackhole.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/NexthopBlackhole.java index afcbed13..62dc0e63 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/NexthopBlackhole.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/NexthopBlackhole.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/NexthopIPv4.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/NexthopIPv4.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/NexthopIPv4.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/NexthopIPv4.java index 335a4702..55cb56a9 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/NexthopIPv4.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/NexthopIPv4.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/NexthopIPv6.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/NexthopIPv6.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/NexthopIPv6.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/NexthopIPv6.java index 5e2b29a3..3b3e9423 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/NexthopIPv6.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/NexthopIPv6.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/NexthopInternet.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/NexthopInternet.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/NexthopInternet.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/NexthopInternet.java index 56d91532..7e47a504 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/NexthopInternet.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/NexthopInternet.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/PartialUpdateNetworkAreaPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/PartialUpdateNetworkAreaPayload.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/PartialUpdateNetworkAreaPayload.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/PartialUpdateNetworkAreaPayload.java index 1b2aff15..2c46adc2 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/PartialUpdateNetworkAreaPayload.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/PartialUpdateNetworkAreaPayload.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/PartialUpdateNetworkPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/PartialUpdateNetworkPayload.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/PartialUpdateNetworkPayload.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/PartialUpdateNetworkPayload.java index a38c34df..6a1e5feb 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/PartialUpdateNetworkPayload.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/PartialUpdateNetworkPayload.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/PortRange.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/PortRange.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/PortRange.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/PortRange.java index 5cdfc78f..80907501 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/PortRange.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/PortRange.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/Project.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/Project.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/Project.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/Project.java index 2a0753c3..60474a71 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/Project.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/Project.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ProjectListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ProjectListResponse.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ProjectListResponse.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ProjectListResponse.java index 13b86402..9c2c327a 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ProjectListResponse.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ProjectListResponse.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/Protocol.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/Protocol.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/Protocol.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/Protocol.java index ac1dfedb..a1f503d5 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/Protocol.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/Protocol.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/PublicIp.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/PublicIp.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/PublicIp.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/PublicIp.java index c45f81ce..cb2b55aa 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/PublicIp.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/PublicIp.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/PublicIpListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/PublicIpListResponse.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/PublicIpListResponse.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/PublicIpListResponse.java index f6181e2f..bb028050 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/PublicIpListResponse.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/PublicIpListResponse.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/PublicNetwork.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/PublicNetwork.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/PublicNetwork.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/PublicNetwork.java index 3c3b4809..a4f95f44 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/PublicNetwork.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/PublicNetwork.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/PublicNetworkListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/PublicNetworkListResponse.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/PublicNetworkListResponse.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/PublicNetworkListResponse.java index f3f6ff47..5ae683e9 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/PublicNetworkListResponse.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/PublicNetworkListResponse.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/Quota.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/Quota.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/Quota.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/Quota.java index a86fc701..3ee9df6f 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/Quota.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/Quota.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/QuotaList.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/QuotaList.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/QuotaList.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/QuotaList.java index fe03ddd6..56f55530 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/QuotaList.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/QuotaList.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/QuotaListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/QuotaListResponse.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/QuotaListResponse.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/QuotaListResponse.java index 76392511..50ebc6f2 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/QuotaListResponse.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/QuotaListResponse.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/RegionalArea.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/RegionalArea.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/RegionalArea.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/RegionalArea.java index 7cb577c5..f54cea94 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/RegionalArea.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/RegionalArea.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/RegionalAreaIPv4.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/RegionalAreaIPv4.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/RegionalAreaIPv4.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/RegionalAreaIPv4.java index c10c99a0..753b053e 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/RegionalAreaIPv4.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/RegionalAreaIPv4.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/RegionalAreaListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/RegionalAreaListResponse.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/RegionalAreaListResponse.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/RegionalAreaListResponse.java index 609e9b32..29255b7c 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/RegionalAreaListResponse.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/RegionalAreaListResponse.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/Request.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/Request.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/Request.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/Request.java index 9f654dcc..dee9d565 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/Request.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/Request.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/RequestResource.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/RequestResource.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/RequestResource.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/RequestResource.java index cd708bef..1d745c21 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/RequestResource.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/RequestResource.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/RescueServerPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/RescueServerPayload.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/RescueServerPayload.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/RescueServerPayload.java index fd5ddcaf..41f86356 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/RescueServerPayload.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/RescueServerPayload.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ResizeServerPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ResizeServerPayload.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ResizeServerPayload.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ResizeServerPayload.java index b5ce897d..188640f8 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ResizeServerPayload.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ResizeServerPayload.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ResizeVolumePayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ResizeVolumePayload.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ResizeVolumePayload.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ResizeVolumePayload.java index a7e5ec06..7618070e 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ResizeVolumePayload.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ResizeVolumePayload.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/Route.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/Route.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/Route.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/Route.java index bfdd1f60..f2b247b2 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/Route.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/Route.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/RouteDestination.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/RouteDestination.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/RouteDestination.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/RouteDestination.java index ed2db251..38cfc42f 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/RouteDestination.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/RouteDestination.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.TypeAdapter; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/RouteListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/RouteListResponse.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/RouteListResponse.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/RouteListResponse.java index 492a400e..64f2d018 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/RouteListResponse.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/RouteListResponse.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/RouteNexthop.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/RouteNexthop.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/RouteNexthop.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/RouteNexthop.java index e0dfdac4..8bc2448b 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/RouteNexthop.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/RouteNexthop.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.TypeAdapter; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/RoutingTable.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/RoutingTable.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/RoutingTable.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/RoutingTable.java index 98144abc..6a281393 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/RoutingTable.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/RoutingTable.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/RoutingTableListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/RoutingTableListResponse.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/RoutingTableListResponse.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/RoutingTableListResponse.java index b14175f1..2a5c8fbb 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/RoutingTableListResponse.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/RoutingTableListResponse.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/SecurityGroup.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/SecurityGroup.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/SecurityGroup.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/SecurityGroup.java index 38fe847c..0186793d 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/SecurityGroup.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/SecurityGroup.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/SecurityGroupListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/SecurityGroupListResponse.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/SecurityGroupListResponse.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/SecurityGroupListResponse.java index 7ef5d9c3..4a13b135 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/SecurityGroupListResponse.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/SecurityGroupListResponse.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/SecurityGroupRule.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/SecurityGroupRule.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/SecurityGroupRule.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/SecurityGroupRule.java index c29b6920..458a142a 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/SecurityGroupRule.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/SecurityGroupRule.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/SecurityGroupRuleListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/SecurityGroupRuleListResponse.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/SecurityGroupRuleListResponse.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/SecurityGroupRuleListResponse.java index a7f63f94..d1ddb133 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/SecurityGroupRuleListResponse.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/SecurityGroupRuleListResponse.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/SecurityGroupRuleProtocol.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/SecurityGroupRuleProtocol.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/SecurityGroupRuleProtocol.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/SecurityGroupRuleProtocol.java index c20011ed..69b7f42e 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/SecurityGroupRuleProtocol.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/SecurityGroupRuleProtocol.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/Server.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/Server.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/Server.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/Server.java index dbfd61f7..afa3f82f 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/Server.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/Server.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ServerAgent.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ServerAgent.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ServerAgent.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ServerAgent.java index e735ba1e..d48c4620 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ServerAgent.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ServerAgent.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ServerConsoleUrl.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ServerConsoleUrl.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ServerConsoleUrl.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ServerConsoleUrl.java index 8fd73242..038605d9 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ServerConsoleUrl.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ServerConsoleUrl.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ServerListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ServerListResponse.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ServerListResponse.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ServerListResponse.java index bd0f3994..2f451787 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ServerListResponse.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ServerListResponse.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ServerMaintenance.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ServerMaintenance.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ServerMaintenance.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ServerMaintenance.java index 45f030d6..feefcda9 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ServerMaintenance.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ServerMaintenance.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ServerNetwork.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ServerNetwork.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ServerNetwork.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ServerNetwork.java index 37c0c63c..87ee6598 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ServerNetwork.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ServerNetwork.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ServerNetworking.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ServerNetworking.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ServerNetworking.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ServerNetworking.java index 9a40c5b8..6f81554e 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ServerNetworking.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ServerNetworking.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.TypeAdapter; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ServiceAccountMailListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ServiceAccountMailListResponse.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ServiceAccountMailListResponse.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ServiceAccountMailListResponse.java index f2fa7f4b..050d3377 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/ServiceAccountMailListResponse.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/ServiceAccountMailListResponse.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/SetImageSharePayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/SetImageSharePayload.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/SetImageSharePayload.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/SetImageSharePayload.java index c3dd022d..d9b92b58 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/SetImageSharePayload.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/SetImageSharePayload.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/Snapshot.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/Snapshot.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/Snapshot.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/Snapshot.java index c9d0a2e9..06cf654f 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/Snapshot.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/Snapshot.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/SnapshotListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/SnapshotListResponse.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/SnapshotListResponse.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/SnapshotListResponse.java index 014319ff..b9617c9f 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/SnapshotListResponse.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/SnapshotListResponse.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/StaticAreaID.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/StaticAreaID.java similarity index 97% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/StaticAreaID.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/StaticAreaID.java index 76fd7b81..ba010819 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/StaticAreaID.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/StaticAreaID.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; import com.google.gson.JsonElement; import com.google.gson.TypeAdapter; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdateAttachedVolumePayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdateAttachedVolumePayload.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdateAttachedVolumePayload.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdateAttachedVolumePayload.java index e41a6c83..ac23cb6a 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdateAttachedVolumePayload.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdateAttachedVolumePayload.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdateBackupPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdateBackupPayload.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdateBackupPayload.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdateBackupPayload.java index 5af8ec55..d813ace9 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdateBackupPayload.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdateBackupPayload.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdateImagePayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdateImagePayload.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdateImagePayload.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdateImagePayload.java index c28db87e..034b3868 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdateImagePayload.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdateImagePayload.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdateImageSharePayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdateImageSharePayload.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdateImageSharePayload.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdateImageSharePayload.java index 11552c3d..25aac11e 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdateImageSharePayload.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdateImageSharePayload.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdateKeyPairPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdateKeyPairPayload.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdateKeyPairPayload.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdateKeyPairPayload.java index 1312df54..536d3ec8 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdateKeyPairPayload.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdateKeyPairPayload.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdateNetworkAreaRegionPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdateNetworkAreaRegionPayload.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdateNetworkAreaRegionPayload.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdateNetworkAreaRegionPayload.java index 2a2f8b97..eafab121 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdateNetworkAreaRegionPayload.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdateNetworkAreaRegionPayload.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdateNetworkAreaRoutePayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdateNetworkAreaRoutePayload.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdateNetworkAreaRoutePayload.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdateNetworkAreaRoutePayload.java index ce9089dd..64206ca9 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdateNetworkAreaRoutePayload.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdateNetworkAreaRoutePayload.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdateNetworkIPv4Body.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdateNetworkIPv4Body.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdateNetworkIPv4Body.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdateNetworkIPv4Body.java index 69b4bc63..13d10523 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdateNetworkIPv4Body.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdateNetworkIPv4Body.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdateNetworkIPv6Body.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdateNetworkIPv6Body.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdateNetworkIPv6Body.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdateNetworkIPv6Body.java index e30b3247..177c63c9 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdateNetworkIPv6Body.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdateNetworkIPv6Body.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdateNicPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdateNicPayload.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdateNicPayload.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdateNicPayload.java index 2acbc0ae..a923667a 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdateNicPayload.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdateNicPayload.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdatePublicIPPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdatePublicIPPayload.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdatePublicIPPayload.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdatePublicIPPayload.java index 0f81aec8..f065ac2e 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdatePublicIPPayload.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdatePublicIPPayload.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdateRegionalAreaIPv4.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdateRegionalAreaIPv4.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdateRegionalAreaIPv4.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdateRegionalAreaIPv4.java index b7edd1d6..b8f16c93 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdateRegionalAreaIPv4.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdateRegionalAreaIPv4.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdateRouteOfRoutingTablePayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdateRouteOfRoutingTablePayload.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdateRouteOfRoutingTablePayload.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdateRouteOfRoutingTablePayload.java index e32f702d..3ca534e6 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdateRouteOfRoutingTablePayload.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdateRouteOfRoutingTablePayload.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdateRoutingTableOfAreaPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdateRoutingTableOfAreaPayload.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdateRoutingTableOfAreaPayload.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdateRoutingTableOfAreaPayload.java index 27ad89b8..a88d93c0 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdateRoutingTableOfAreaPayload.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdateRoutingTableOfAreaPayload.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdateSecurityGroupPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdateSecurityGroupPayload.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdateSecurityGroupPayload.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdateSecurityGroupPayload.java index 06837978..e0ee7380 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdateSecurityGroupPayload.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdateSecurityGroupPayload.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdateServerPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdateServerPayload.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdateServerPayload.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdateServerPayload.java index 14572e43..b0c8ca25 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdateServerPayload.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdateServerPayload.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdateSnapshotPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdateSnapshotPayload.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdateSnapshotPayload.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdateSnapshotPayload.java index 2c2e6893..3d2bf179 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdateSnapshotPayload.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdateSnapshotPayload.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdateVolumePayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdateVolumePayload.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdateVolumePayload.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdateVolumePayload.java index 7f30de64..8bbdac3a 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/UpdateVolumePayload.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/UpdateVolumePayload.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/Volume.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/Volume.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/Volume.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/Volume.java index 19d19875..5969aa45 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/Volume.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/Volume.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/VolumeAttachment.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/VolumeAttachment.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/VolumeAttachment.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/VolumeAttachment.java index 96b3e7e4..04cd6c2f 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/VolumeAttachment.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/VolumeAttachment.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/VolumeAttachmentListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/VolumeAttachmentListResponse.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/VolumeAttachmentListResponse.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/VolumeAttachmentListResponse.java index 99d01b19..91d4da8d 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/VolumeAttachmentListResponse.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/VolumeAttachmentListResponse.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/VolumeEncryptionParameter.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/VolumeEncryptionParameter.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/VolumeEncryptionParameter.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/VolumeEncryptionParameter.java index e3df0a07..0329cd11 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/VolumeEncryptionParameter.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/VolumeEncryptionParameter.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/VolumeListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/VolumeListResponse.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/VolumeListResponse.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/VolumeListResponse.java index 2370efc7..7ef61a17 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/VolumeListResponse.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/VolumeListResponse.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/VolumePerformanceClass.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/VolumePerformanceClass.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/VolumePerformanceClass.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/VolumePerformanceClass.java index d662371f..c8cc2ca9 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/VolumePerformanceClass.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/VolumePerformanceClass.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/VolumePerformanceClassListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/VolumePerformanceClassListResponse.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/VolumePerformanceClassListResponse.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/VolumePerformanceClassListResponse.java index f48d4d12..c30b319f 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/VolumePerformanceClassListResponse.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/VolumePerformanceClassListResponse.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/VolumeSource.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/VolumeSource.java similarity index 99% rename from services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/VolumeSource.java rename to services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/VolumeSource.java index 3011dfa8..d16e6736 100644 --- a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/model/VolumeSource.java +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2api/model/VolumeSource.java @@ -10,9 +10,9 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.model; +package cloud.stackit.sdk.iaas.v2api.model; -import cloud.stackit.sdk.iaas.JSON; +import cloud.stackit.sdk.iaas.v2api.JSON; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/ApiCallback.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/ApiCallback.java new file mode 100644 index 00000000..b4cbce8f --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/ApiCallback.java @@ -0,0 +1,60 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api; + +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/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/ApiClient.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/ApiClient.java new file mode 100644 index 00000000..f72abeed --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/ApiClient.java @@ -0,0 +1,1600 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api; + +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://iaas.api.stackit.cloud"; + protected List servers = + new ArrayList( + Arrays.asList( + new ServerConfiguration( + "https://iaas.api.stackit.cloud", + "No description provided", + new HashMap() { + { + put( + "region", + new ServerVariable( + "No description provided", + "global", + new HashSet())); + } + }))); + 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/iaas"); + } + + /** + * Get base path + * + * @return Base path + */ + public String getBasePath() { + return basePath; + } + + /** + * Set base path + * + * @param basePath Base path of the URL (e.g https://iaas.api.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.iaas.v2beta1api.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.iaas.v2beta1api.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.iaas.v2beta1api.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.iaas.v2beta1api.ApiClient} object + */ + public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { + JSON.setLocalDateFormat(dateFormat); + return this; + } + + /** + * Set LenientOnJson. + * + * @param lenientOnJson a boolean + * @return a {@link cloud.stackit.sdk.iaas.v2beta1api.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/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/ApiResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/ApiResponse.java new file mode 100644 index 00000000..97739d1f --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/ApiResponse.java @@ -0,0 +1,73 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api; + +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/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/GzipRequestInterceptor.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/GzipRequestInterceptor.java new file mode 100644 index 00000000..072324eb --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/GzipRequestInterceptor.java @@ -0,0 +1,87 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api; + +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/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/JSON.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/JSON.java new file mode 100644 index 00000000..c1cd69e2 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/JSON.java @@ -0,0 +1,888 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api; + +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 io.gsonfire.TypeSelector; +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.HashMap; +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() + .registerTypeSelector( + cloud.stackit.sdk.iaas.v2beta1api.model.RouteDestination.class, + new TypeSelector< + cloud.stackit.sdk.iaas.v2beta1api.model + .RouteDestination>() { + @Override + public Class< + ? extends + cloud.stackit.sdk.iaas.v2beta1api.model + .RouteDestination> + getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = + new HashMap(); + classByDiscriminatorValue.put( + "cidrv4", + cloud.stackit.sdk.iaas.v2beta1api.model + .DestinationCIDRv4.class); + classByDiscriminatorValue.put( + "cidrv6", + cloud.stackit.sdk.iaas.v2beta1api.model + .DestinationCIDRv6.class); + classByDiscriminatorValue.put( + "Route_destination", + cloud.stackit.sdk.iaas.v2beta1api.model + .RouteDestination.class); + return getClassByDiscriminator( + classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }) + .registerTypeSelector( + cloud.stackit.sdk.iaas.v2beta1api.model.RouteNexthop.class, + new TypeSelector< + cloud.stackit.sdk.iaas.v2beta1api.model.RouteNexthop>() { + @Override + public Class< + ? extends + cloud.stackit.sdk.iaas.v2beta1api.model + .RouteNexthop> + getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = + new HashMap(); + classByDiscriminatorValue.put( + "blackhole", + cloud.stackit.sdk.iaas.v2beta1api.model + .NexthopBlackhole.class); + classByDiscriminatorValue.put( + "internet", + cloud.stackit.sdk.iaas.v2beta1api.model + .NexthopInternet.class); + classByDiscriminatorValue.put( + "ipv4", + cloud.stackit.sdk.iaas.v2beta1api.model.NexthopIPv4 + .class); + classByDiscriminatorValue.put( + "ipv6", + cloud.stackit.sdk.iaas.v2beta1api.model.NexthopIPv6 + .class); + classByDiscriminatorValue.put( + "Route_nexthop", + cloud.stackit.sdk.iaas.v2beta1api.model.RouteNexthop + .class); + return getClassByDiscriminator( + classByDiscriminatorValue, + getDiscriminatorValue(readElement, "type")); + } + }); + 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.iaas.v2beta1api.model.AddRoutesToRoutingTablePayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.AddRoutingTableToAreaPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.AddVolumeToServerPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.AffinityGroup + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.AffinityGroupListResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.AllowedAddressesInner + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.AreaId.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.AvailabilityZoneListResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.Backup.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.BackupListResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.BackupSource + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.BaseSecurityGroupRule + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.BootVolume.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.BootVolumeSource + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.CreateAffinityGroupPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.CreateBackupPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.CreateImagePayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.CreateIsolatedNetworkPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.CreateKeyPairPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.CreateNetworkAreaPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.CreateNetworkAreaRangePayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.CreateNetworkAreaRoutePayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.CreateNetworkIPv4 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.CreateNetworkIPv4WithPrefix + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.CreateNetworkIPv4WithPrefixLength + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.CreateNetworkIPv6 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.CreateNetworkIPv6WithPrefix + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.CreateNetworkIPv6WithPrefixLength + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.CreateNetworkPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.CreateNicPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.CreateProtocol + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.CreatePublicIPPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.CreateSecurityGroupPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.CreateSecurityGroupRulePayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.CreateSecurityGroupRuleProtocol + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.CreateServerNetworking + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.CreateServerNetworkingWithNics + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.CreateServerPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.CreateServerPayloadAllOfNetworking + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.CreateVolumePayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.DestinationCIDRv4 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.DestinationCIDRv6 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.Error.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.GetServerLog200Response + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.ICMPParameters + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.Image.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.ImageAgent.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.ImageChecksum + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.ImageConfig.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.ImageCreateResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.ImageListResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.ImageShare.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.ImageShareConsumer + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.KeyPairListResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.Keypair.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.MachineType.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.MachineTypeListResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.NIC.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.NICListResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.Network.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.NetworkArea.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.NetworkAreaListResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.NetworkIPv4.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.NetworkIPv6.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.NetworkListResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.NetworkRange + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.NetworkRangeListResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.NexthopBlackhole + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.NexthopIPv4.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.NexthopIPv6.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.NexthopInternet + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.PartialUpdateNetworkAreaPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.PartialUpdateNetworkPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.PortRange.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.Project.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.ProjectListResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.Protocol.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.PublicIp.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.PublicIpListResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.PublicNetwork + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.PublicNetworkListResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.Quota.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.QuotaList.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.QuotaListResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.RegionalArea + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.RegionalAreaIPv4 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.RegionalAreaListResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.Request.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.RequestResource + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.RescueServerPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.ResizeServerPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.ResizeVolumePayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.Route.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.RouteDestination + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.RouteListResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.RouteNexthop + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.RoutingTable + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.RoutingTableListResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.SecurityGroup + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.SecurityGroupListResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.SecurityGroupRule + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.SecurityGroupRuleListResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.SecurityGroupRuleProtocol + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.Server.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.ServerAgent.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.ServerConsoleUrl + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.ServerListResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.ServerMaintenance + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.ServerNetwork + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.ServerNetworking + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.ServiceAccountMailListResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.SetImageSharePayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.Snapshot.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.SnapshotListResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.UpdateAttachedVolumePayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.UpdateImagePayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.UpdateImageSharePayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.UpdateKeyPairPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.UpdateNetworkIPv4Body + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.UpdateNetworkIPv6Body + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.UpdateNicPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.UpdatePublicIPPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.UpdateRegionalAreaIPv4 + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.UpdateRouteOfRoutingTablePayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.UpdateRoutingTableOfAreaPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.UpdateServerPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.UpdateVolumePayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.V2beta1ConfigureNetworkAreaRegionPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.V2beta1CreateSnapshotPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.V2beta1UpdateBackupPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.V2beta1UpdateNetworkAreaRegionPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.V2beta1UpdateRouteOfAreaPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.V2beta1UpdateSecurityGroupPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.V2beta1UpdateSnapshotPayload + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.Volume.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.VolumeAttachment + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.VolumeAttachmentListResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.VolumeEncryptionParameter + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.VolumeListResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.VolumePerformanceClass + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.VolumePerformanceClassListResponse + .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory( + new cloud.stackit.sdk.iaas.v2beta1api.model.VolumeSource + .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/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/Pair.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/Pair.java new file mode 100644 index 00000000..602777e6 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/Pair.java @@ -0,0 +1,38 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api; + +@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/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/ProgressRequestBody.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/ProgressRequestBody.java new file mode 100644 index 00000000..aecd6b41 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/ProgressRequestBody.java @@ -0,0 +1,71 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api; + +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/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/ProgressResponseBody.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/ProgressResponseBody.java new file mode 100644 index 00000000..ca0d584f --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/ProgressResponseBody.java @@ -0,0 +1,68 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api; + +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/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/ServerConfiguration.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/ServerConfiguration.java new file mode 100644 index 00000000..fd172170 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/ServerConfiguration.java @@ -0,0 +1,79 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api; + +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/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/ServerVariable.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/ServerVariable.java new file mode 100644 index 00000000..c9f1012c --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/ServerVariable.java @@ -0,0 +1,37 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api; + +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/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/StringUtil.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/StringUtil.java new file mode 100644 index 00000000..33b789ab --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/StringUtil.java @@ -0,0 +1,83 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api; + +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/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/api/DefaultApi.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/api/DefaultApi.java new file mode 100644 index 00000000..7f9378eb --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/api/DefaultApi.java @@ -0,0 +1,30485 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.api; + +import cloud.stackit.sdk.core.config.CoreConfiguration; +import cloud.stackit.sdk.core.exception.ApiException; +import cloud.stackit.sdk.iaas.v2beta1api.ApiCallback; +import cloud.stackit.sdk.iaas.v2beta1api.ApiClient; +import cloud.stackit.sdk.iaas.v2beta1api.ApiResponse; +import cloud.stackit.sdk.iaas.v2beta1api.Pair; +import cloud.stackit.sdk.iaas.v2beta1api.model.AddRoutesToRoutingTablePayload; +import cloud.stackit.sdk.iaas.v2beta1api.model.AddRoutingTableToAreaPayload; +import cloud.stackit.sdk.iaas.v2beta1api.model.AddVolumeToServerPayload; +import cloud.stackit.sdk.iaas.v2beta1api.model.AffinityGroup; +import cloud.stackit.sdk.iaas.v2beta1api.model.AffinityGroupListResponse; +import cloud.stackit.sdk.iaas.v2beta1api.model.AvailabilityZoneListResponse; +import cloud.stackit.sdk.iaas.v2beta1api.model.Backup; +import cloud.stackit.sdk.iaas.v2beta1api.model.BackupListResponse; +import cloud.stackit.sdk.iaas.v2beta1api.model.CreateAffinityGroupPayload; +import cloud.stackit.sdk.iaas.v2beta1api.model.CreateBackupPayload; +import cloud.stackit.sdk.iaas.v2beta1api.model.CreateImagePayload; +import cloud.stackit.sdk.iaas.v2beta1api.model.CreateIsolatedNetworkPayload; +import cloud.stackit.sdk.iaas.v2beta1api.model.CreateKeyPairPayload; +import cloud.stackit.sdk.iaas.v2beta1api.model.CreateNetworkAreaPayload; +import cloud.stackit.sdk.iaas.v2beta1api.model.CreateNetworkAreaRangePayload; +import cloud.stackit.sdk.iaas.v2beta1api.model.CreateNetworkAreaRoutePayload; +import cloud.stackit.sdk.iaas.v2beta1api.model.CreateNetworkPayload; +import cloud.stackit.sdk.iaas.v2beta1api.model.CreateNicPayload; +import cloud.stackit.sdk.iaas.v2beta1api.model.CreatePublicIPPayload; +import cloud.stackit.sdk.iaas.v2beta1api.model.CreateSecurityGroupPayload; +import cloud.stackit.sdk.iaas.v2beta1api.model.CreateSecurityGroupRulePayload; +import cloud.stackit.sdk.iaas.v2beta1api.model.CreateServerPayload; +import cloud.stackit.sdk.iaas.v2beta1api.model.CreateVolumePayload; +import cloud.stackit.sdk.iaas.v2beta1api.model.GetServerLog200Response; +import cloud.stackit.sdk.iaas.v2beta1api.model.Image; +import cloud.stackit.sdk.iaas.v2beta1api.model.ImageCreateResponse; +import cloud.stackit.sdk.iaas.v2beta1api.model.ImageListResponse; +import cloud.stackit.sdk.iaas.v2beta1api.model.ImageShare; +import cloud.stackit.sdk.iaas.v2beta1api.model.ImageShareConsumer; +import cloud.stackit.sdk.iaas.v2beta1api.model.KeyPairListResponse; +import cloud.stackit.sdk.iaas.v2beta1api.model.Keypair; +import cloud.stackit.sdk.iaas.v2beta1api.model.MachineType; +import cloud.stackit.sdk.iaas.v2beta1api.model.MachineTypeListResponse; +import cloud.stackit.sdk.iaas.v2beta1api.model.NIC; +import cloud.stackit.sdk.iaas.v2beta1api.model.NICListResponse; +import cloud.stackit.sdk.iaas.v2beta1api.model.Network; +import cloud.stackit.sdk.iaas.v2beta1api.model.NetworkArea; +import cloud.stackit.sdk.iaas.v2beta1api.model.NetworkAreaListResponse; +import cloud.stackit.sdk.iaas.v2beta1api.model.NetworkListResponse; +import cloud.stackit.sdk.iaas.v2beta1api.model.NetworkRange; +import cloud.stackit.sdk.iaas.v2beta1api.model.NetworkRangeListResponse; +import cloud.stackit.sdk.iaas.v2beta1api.model.PartialUpdateNetworkAreaPayload; +import cloud.stackit.sdk.iaas.v2beta1api.model.PartialUpdateNetworkPayload; +import cloud.stackit.sdk.iaas.v2beta1api.model.Project; +import cloud.stackit.sdk.iaas.v2beta1api.model.ProjectListResponse; +import cloud.stackit.sdk.iaas.v2beta1api.model.PublicIp; +import cloud.stackit.sdk.iaas.v2beta1api.model.PublicIpListResponse; +import cloud.stackit.sdk.iaas.v2beta1api.model.PublicNetworkListResponse; +import cloud.stackit.sdk.iaas.v2beta1api.model.QuotaListResponse; +import cloud.stackit.sdk.iaas.v2beta1api.model.RegionalArea; +import cloud.stackit.sdk.iaas.v2beta1api.model.RegionalAreaListResponse; +import cloud.stackit.sdk.iaas.v2beta1api.model.Request; +import cloud.stackit.sdk.iaas.v2beta1api.model.RescueServerPayload; +import cloud.stackit.sdk.iaas.v2beta1api.model.ResizeServerPayload; +import cloud.stackit.sdk.iaas.v2beta1api.model.ResizeVolumePayload; +import cloud.stackit.sdk.iaas.v2beta1api.model.Route; +import cloud.stackit.sdk.iaas.v2beta1api.model.RouteListResponse; +import cloud.stackit.sdk.iaas.v2beta1api.model.RoutingTable; +import cloud.stackit.sdk.iaas.v2beta1api.model.RoutingTableListResponse; +import cloud.stackit.sdk.iaas.v2beta1api.model.SecurityGroup; +import cloud.stackit.sdk.iaas.v2beta1api.model.SecurityGroupListResponse; +import cloud.stackit.sdk.iaas.v2beta1api.model.SecurityGroupRule; +import cloud.stackit.sdk.iaas.v2beta1api.model.SecurityGroupRuleListResponse; +import cloud.stackit.sdk.iaas.v2beta1api.model.Server; +import cloud.stackit.sdk.iaas.v2beta1api.model.ServerConsoleUrl; +import cloud.stackit.sdk.iaas.v2beta1api.model.ServerListResponse; +import cloud.stackit.sdk.iaas.v2beta1api.model.ServiceAccountMailListResponse; +import cloud.stackit.sdk.iaas.v2beta1api.model.SetImageSharePayload; +import cloud.stackit.sdk.iaas.v2beta1api.model.Snapshot; +import cloud.stackit.sdk.iaas.v2beta1api.model.SnapshotListResponse; +import cloud.stackit.sdk.iaas.v2beta1api.model.UpdateAttachedVolumePayload; +import cloud.stackit.sdk.iaas.v2beta1api.model.UpdateImagePayload; +import cloud.stackit.sdk.iaas.v2beta1api.model.UpdateImageSharePayload; +import cloud.stackit.sdk.iaas.v2beta1api.model.UpdateKeyPairPayload; +import cloud.stackit.sdk.iaas.v2beta1api.model.UpdateNicPayload; +import cloud.stackit.sdk.iaas.v2beta1api.model.UpdatePublicIPPayload; +import cloud.stackit.sdk.iaas.v2beta1api.model.UpdateRouteOfRoutingTablePayload; +import cloud.stackit.sdk.iaas.v2beta1api.model.UpdateRoutingTableOfAreaPayload; +import cloud.stackit.sdk.iaas.v2beta1api.model.UpdateServerPayload; +import cloud.stackit.sdk.iaas.v2beta1api.model.UpdateVolumePayload; +import cloud.stackit.sdk.iaas.v2beta1api.model.V2beta1ConfigureNetworkAreaRegionPayload; +import cloud.stackit.sdk.iaas.v2beta1api.model.V2beta1CreateSnapshotPayload; +import cloud.stackit.sdk.iaas.v2beta1api.model.V2beta1UpdateBackupPayload; +import cloud.stackit.sdk.iaas.v2beta1api.model.V2beta1UpdateNetworkAreaRegionPayload; +import cloud.stackit.sdk.iaas.v2beta1api.model.V2beta1UpdateRouteOfAreaPayload; +import cloud.stackit.sdk.iaas.v2beta1api.model.V2beta1UpdateSecurityGroupPayload; +import cloud.stackit.sdk.iaas.v2beta1api.model.V2beta1UpdateSnapshotPayload; +import cloud.stackit.sdk.iaas.v2beta1api.model.Volume; +import cloud.stackit.sdk.iaas.v2beta1api.model.VolumeAttachment; +import cloud.stackit.sdk.iaas.v2beta1api.model.VolumeAttachmentListResponse; +import cloud.stackit.sdk.iaas.v2beta1api.model.VolumeListResponse; +import cloud.stackit.sdk.iaas.v2beta1api.model.VolumePerformanceClass; +import cloud.stackit.sdk.iaas.v2beta1api.model.VolumePerformanceClassListResponse; +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 java.util.UUID; +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 addNetworkToServer + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (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
202 Create and attach network interface was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call addNetworkToServerCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID networkId, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/networks/{networkId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())) + .replace( + "{" + "networkId" + "}", + localVarApiClient.escapeString(networkId.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 addNetworkToServerValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID networkId, + 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 addNetworkToServer(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling addNetworkToServer(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling addNetworkToServer(Async)"); + } + + // verify the required parameter 'networkId' is set + if (networkId == null) { + throw new ApiException( + "Missing the required parameter 'networkId' when calling addNetworkToServer(Async)"); + } + + return addNetworkToServerCall(projectId, region, serverId, networkId, _callback); + } + + /** + * Create and attach a network interface from the specified network. Create and attach a network + * interface from the specified network to the server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Create and attach network interface was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public void addNetworkToServer( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID networkId) + throws ApiException { + addNetworkToServerWithHttpInfo(projectId, region, serverId, networkId); + } + + /** + * Create and attach a network interface from the specified network. Create and attach a network + * interface from the specified network to the server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Create and attach network interface was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse addNetworkToServerWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID networkId) + throws ApiException { + okhttp3.Call localVarCall = + addNetworkToServerValidateBeforeCall(projectId, region, serverId, networkId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Create and attach a network interface from the specified network. (asynchronously) Create and + * attach a network interface from the specified network to the server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (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
202 Create and attach network interface was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call addNetworkToServerAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID networkId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + addNetworkToServerValidateBeforeCall( + projectId, region, serverId, networkId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for addNicToServer + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param nicId The identifier (ID) of a network interface. (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
202 Network interface attachment request was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call addNicToServerCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID nicId, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/nics/{nicId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())) + .replace( + "{" + "nicId" + "}", + localVarApiClient.escapeString(nicId.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, + "PUT", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call addNicToServerValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID nicId, + 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 addNicToServer(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling addNicToServer(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling addNicToServer(Async)"); + } + + // verify the required parameter 'nicId' is set + if (nicId == null) { + throw new ApiException( + "Missing the required parameter 'nicId' when calling addNicToServer(Async)"); + } + + return addNicToServerCall(projectId, region, serverId, nicId, _callback); + } + + /** + * Attach an existing network interface. Attach an existing network interface to a server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param nicId The identifier (ID) of a network interface. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Network interface attachment request was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public void addNicToServer( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID nicId) + throws ApiException { + addNicToServerWithHttpInfo(projectId, region, serverId, nicId); + } + + /** + * Attach an existing network interface. Attach an existing network interface to a server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param nicId The identifier (ID) of a network interface. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Network interface attachment request was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse addNicToServerWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID nicId) + throws ApiException { + okhttp3.Call localVarCall = + addNicToServerValidateBeforeCall(projectId, region, serverId, nicId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Attach an existing network interface. (asynchronously) Attach an existing network interface + * to a server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param nicId The identifier (ID) of a network interface. (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
202 Network interface attachment request was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call addNicToServerAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID nicId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + addNicToServerValidateBeforeCall(projectId, region, serverId, nicId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for addPublicIpToServer + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param publicIpId The identifier (ID) of a Public IP. (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
202 Attach Public IP to server was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call addPublicIpToServerCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID publicIpId, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/public-ips/{publicIpId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())) + .replace( + "{" + "publicIpId" + "}", + localVarApiClient.escapeString(publicIpId.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, + "PUT", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call addPublicIpToServerValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID publicIpId, + 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 addPublicIpToServer(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling addPublicIpToServer(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling addPublicIpToServer(Async)"); + } + + // verify the required parameter 'publicIpId' is set + if (publicIpId == null) { + throw new ApiException( + "Missing the required parameter 'publicIpId' when calling addPublicIpToServer(Async)"); + } + + return addPublicIpToServerCall(projectId, region, serverId, publicIpId, _callback); + } + + /** + * Associate a public IP to the server. Associate a public IP to a server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param publicIpId The identifier (ID) of a Public IP. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Attach Public IP to server was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public void addPublicIpToServer( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID publicIpId) + throws ApiException { + addPublicIpToServerWithHttpInfo(projectId, region, serverId, publicIpId); + } + + /** + * Associate a public IP to the server. Associate a public IP to a server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param publicIpId The identifier (ID) of a Public IP. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Attach Public IP to server was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse addPublicIpToServerWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID publicIpId) + throws ApiException { + okhttp3.Call localVarCall = + addPublicIpToServerValidateBeforeCall( + projectId, region, serverId, publicIpId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Associate a public IP to the server. (asynchronously) Associate a public IP to a server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param publicIpId The identifier (ID) of a Public IP. (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
202 Attach Public IP to server was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call addPublicIpToServerAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID publicIpId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + addPublicIpToServerValidateBeforeCall( + projectId, region, serverId, publicIpId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for addRoutesToRoutingTable + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @param addRoutesToRoutingTablePayload Request an addition of routes to a routing table. + * (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 Adding routes to routing table was successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call addRoutesToRoutingTableCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nonnull AddRoutesToRoutingTablePayload addRoutesToRoutingTablePayload, + 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 = addRoutesToRoutingTablePayload; + + // create path and map variables + String localVarPath = + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}/routes" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "areaId" + "}", + localVarApiClient.escapeString(areaId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "routingTableId" + "}", + localVarApiClient.escapeString(routingTableId.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 addRoutesToRoutingTableValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nonnull AddRoutesToRoutingTablePayload addRoutesToRoutingTablePayload, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling addRoutesToRoutingTable(Async)"); + } + + // verify the required parameter 'areaId' is set + if (areaId == null) { + throw new ApiException( + "Missing the required parameter 'areaId' when calling addRoutesToRoutingTable(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling addRoutesToRoutingTable(Async)"); + } + + // verify the required parameter 'routingTableId' is set + if (routingTableId == null) { + throw new ApiException( + "Missing the required parameter 'routingTableId' when calling addRoutesToRoutingTable(Async)"); + } + + // verify the required parameter 'addRoutesToRoutingTablePayload' is set + if (addRoutesToRoutingTablePayload == null) { + throw new ApiException( + "Missing the required parameter 'addRoutesToRoutingTablePayload' when calling addRoutesToRoutingTable(Async)"); + } + + return addRoutesToRoutingTableCall( + organizationId, + areaId, + region, + routingTableId, + addRoutesToRoutingTablePayload, + _callback); + } + + /** + * Create new routes in a routing table. Create new routes in an existing routing table. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @param addRoutesToRoutingTablePayload Request an addition of routes to a routing table. + * (required) + * @return RouteListResponse + * @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 Adding routes to routing table was successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public RouteListResponse addRoutesToRoutingTable( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nonnull AddRoutesToRoutingTablePayload addRoutesToRoutingTablePayload) + throws ApiException { + ApiResponse localVarResp = + addRoutesToRoutingTableWithHttpInfo( + organizationId, + areaId, + region, + routingTableId, + addRoutesToRoutingTablePayload); + return localVarResp.getData(); + } + + /** + * Create new routes in a routing table. Create new routes in an existing routing table. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @param addRoutesToRoutingTablePayload Request an addition of routes to a routing table. + * (required) + * @return ApiResponse<RouteListResponse> + * @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 Adding routes to routing table was successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse addRoutesToRoutingTableWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nonnull AddRoutesToRoutingTablePayload addRoutesToRoutingTablePayload) + throws ApiException { + okhttp3.Call localVarCall = + addRoutesToRoutingTableValidateBeforeCall( + organizationId, + areaId, + region, + routingTableId, + addRoutesToRoutingTablePayload, + null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create new routes in a routing table. (asynchronously) Create new routes in an existing + * routing table. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @param addRoutesToRoutingTablePayload Request an addition of routes to a routing table. + * (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 Adding routes to routing table was successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call addRoutesToRoutingTableAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nonnull AddRoutesToRoutingTablePayload addRoutesToRoutingTablePayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + addRoutesToRoutingTableValidateBeforeCall( + organizationId, + areaId, + region, + routingTableId, + addRoutesToRoutingTablePayload, + _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for addRoutingTableToArea + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param addRoutingTableToAreaPayload Request an addition of a routing table to an area. + * (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 Adding routing table was successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call addRoutingTableToAreaCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull AddRoutingTableToAreaPayload addRoutingTableToAreaPayload, + 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 = addRoutingTableToAreaPayload; + + // create path and map variables + String localVarPath = + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "areaId" + "}", + localVarApiClient.escapeString(areaId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/json"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call addRoutingTableToAreaValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull AddRoutingTableToAreaPayload addRoutingTableToAreaPayload, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling addRoutingTableToArea(Async)"); + } + + // verify the required parameter 'areaId' is set + if (areaId == null) { + throw new ApiException( + "Missing the required parameter 'areaId' when calling addRoutingTableToArea(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling addRoutingTableToArea(Async)"); + } + + // verify the required parameter 'addRoutingTableToAreaPayload' is set + if (addRoutingTableToAreaPayload == null) { + throw new ApiException( + "Missing the required parameter 'addRoutingTableToAreaPayload' when calling addRoutingTableToArea(Async)"); + } + + return addRoutingTableToAreaCall( + organizationId, areaId, region, addRoutingTableToAreaPayload, _callback); + } + + /** + * Create new routing table in a network area. Create a new routing table in an existing network + * area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param addRoutingTableToAreaPayload Request an addition of a routing table to an area. + * (required) + * @return RoutingTable + * @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 Adding routing table was successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public RoutingTable addRoutingTableToArea( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull AddRoutingTableToAreaPayload addRoutingTableToAreaPayload) + throws ApiException { + ApiResponse localVarResp = + addRoutingTableToAreaWithHttpInfo( + organizationId, areaId, region, addRoutingTableToAreaPayload); + return localVarResp.getData(); + } + + /** + * Create new routing table in a network area. Create a new routing table in an existing network + * area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param addRoutingTableToAreaPayload Request an addition of a routing table to an area. + * (required) + * @return ApiResponse<RoutingTable> + * @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 Adding routing table was successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse addRoutingTableToAreaWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull AddRoutingTableToAreaPayload addRoutingTableToAreaPayload) + throws ApiException { + okhttp3.Call localVarCall = + addRoutingTableToAreaValidateBeforeCall( + organizationId, areaId, region, addRoutingTableToAreaPayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create new routing table in a network area. (asynchronously) Create a new routing table in an + * existing network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param addRoutingTableToAreaPayload Request an addition of a routing table to an area. + * (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 Adding routing table was successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call addRoutingTableToAreaAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull AddRoutingTableToAreaPayload addRoutingTableToAreaPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + addRoutingTableToAreaValidateBeforeCall( + organizationId, areaId, region, addRoutingTableToAreaPayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for addSecurityGroupToServer + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security 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
202 Security group attachment request was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call addSecurityGroupToServerCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID securityGroupId, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/security-groups/{securityGroupId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())) + .replace( + "{" + "securityGroupId" + "}", + localVarApiClient.escapeString(securityGroupId.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, + "PUT", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call addSecurityGroupToServerValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID securityGroupId, + 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 addSecurityGroupToServer(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling addSecurityGroupToServer(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling addSecurityGroupToServer(Async)"); + } + + // verify the required parameter 'securityGroupId' is set + if (securityGroupId == null) { + throw new ApiException( + "Missing the required parameter 'securityGroupId' when calling addSecurityGroupToServer(Async)"); + } + + return addSecurityGroupToServerCall( + projectId, region, serverId, securityGroupId, _callback); + } + + /** + * Add a server to a security group. Add an existing server to an existing security group. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security Group. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Security group attachment request was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public void addSecurityGroupToServer( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID securityGroupId) + throws ApiException { + addSecurityGroupToServerWithHttpInfo(projectId, region, serverId, securityGroupId); + } + + /** + * Add a server to a security group. Add an existing server to an existing security group. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security Group. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Security group attachment request was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse addSecurityGroupToServerWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID securityGroupId) + throws ApiException { + okhttp3.Call localVarCall = + addSecurityGroupToServerValidateBeforeCall( + projectId, region, serverId, securityGroupId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Add a server to a security group. (asynchronously) Add an existing server to an existing + * security group. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security 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
202 Security group attachment request was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call addSecurityGroupToServerAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID securityGroupId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + addSecurityGroupToServerValidateBeforeCall( + projectId, region, serverId, securityGroupId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for addServiceAccountToServer + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param serviceAccountMail The e-mail address of a service account. (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 Service account attached to the server. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call addServiceAccountToServerCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull String serviceAccountMail, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/service-accounts/{serviceAccountMail}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())) + .replace( + "{" + "serviceAccountMail" + "}", + localVarApiClient.escapeString(serviceAccountMail.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, + "PUT", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call addServiceAccountToServerValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull String serviceAccountMail, + 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 addServiceAccountToServer(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling addServiceAccountToServer(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling addServiceAccountToServer(Async)"); + } + + // verify the required parameter 'serviceAccountMail' is set + if (serviceAccountMail == null) { + throw new ApiException( + "Missing the required parameter 'serviceAccountMail' when calling addServiceAccountToServer(Async)"); + } + + return addServiceAccountToServerCall( + projectId, region, serverId, serviceAccountMail, _callback); + } + + /** + * Attach service account to a server. Attach an additional service account to the server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param serviceAccountMail The e-mail address of a service account. (required) + * @return ServiceAccountMailListResponse + * @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 Service account attached to the server. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ServiceAccountMailListResponse addServiceAccountToServer( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull String serviceAccountMail) + throws ApiException { + ApiResponse localVarResp = + addServiceAccountToServerWithHttpInfo( + projectId, region, serverId, serviceAccountMail); + return localVarResp.getData(); + } + + /** + * Attach service account to a server. Attach an additional service account to the server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param serviceAccountMail The e-mail address of a service account. (required) + * @return ApiResponse<ServiceAccountMailListResponse> + * @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 Service account attached to the server. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse addServiceAccountToServerWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull String serviceAccountMail) + throws ApiException { + okhttp3.Call localVarCall = + addServiceAccountToServerValidateBeforeCall( + projectId, region, serverId, serviceAccountMail, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Attach service account to a server. (asynchronously) Attach an additional service account to + * the server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param serviceAccountMail The e-mail address of a service account. (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 Service account attached to the server. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call addServiceAccountToServerAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull String serviceAccountMail, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + addServiceAccountToServerValidateBeforeCall( + projectId, region, serverId, serviceAccountMail, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for addVolumeToServer + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @param addVolumeToServerPayload Request a volume attachment creation. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Volume attachment request was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call addVolumeToServerCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID volumeId, + @javax.annotation.Nullable AddVolumeToServerPayload addVolumeToServerPayload, + 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 = addVolumeToServerPayload; + + // create path and map variables + String localVarPath = + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/volume-attachments/{volumeId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())) + .replace( + "{" + "volumeId" + "}", + localVarApiClient.escapeString(volumeId.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 addVolumeToServerValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID volumeId, + @javax.annotation.Nullable AddVolumeToServerPayload addVolumeToServerPayload, + 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 addVolumeToServer(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling addVolumeToServer(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling addVolumeToServer(Async)"); + } + + // verify the required parameter 'volumeId' is set + if (volumeId == null) { + throw new ApiException( + "Missing the required parameter 'volumeId' when calling addVolumeToServer(Async)"); + } + + return addVolumeToServerCall( + projectId, region, serverId, volumeId, addVolumeToServerPayload, _callback); + } + + /** + * Attach a volume to a server. Attach an existing volume to an existing server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @param addVolumeToServerPayload Request a volume attachment creation. (optional) + * @return VolumeAttachment + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Volume attachment request was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public VolumeAttachment addVolumeToServer( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID volumeId, + @javax.annotation.Nullable AddVolumeToServerPayload addVolumeToServerPayload) + throws ApiException { + ApiResponse localVarResp = + addVolumeToServerWithHttpInfo( + projectId, region, serverId, volumeId, addVolumeToServerPayload); + return localVarResp.getData(); + } + + /** + * Attach a volume to a server. Attach an existing volume to an existing server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @param addVolumeToServerPayload Request a volume attachment creation. (optional) + * @return ApiResponse<VolumeAttachment> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Volume attachment request was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse addVolumeToServerWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID volumeId, + @javax.annotation.Nullable AddVolumeToServerPayload addVolumeToServerPayload) + throws ApiException { + okhttp3.Call localVarCall = + addVolumeToServerValidateBeforeCall( + projectId, region, serverId, volumeId, addVolumeToServerPayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Attach a volume to a server. (asynchronously) Attach an existing volume to an existing + * server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @param addVolumeToServerPayload Request a volume attachment creation. (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Volume attachment request was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call addVolumeToServerAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID volumeId, + @javax.annotation.Nullable AddVolumeToServerPayload addVolumeToServerPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + addVolumeToServerValidateBeforeCall( + projectId, region, serverId, volumeId, addVolumeToServerPayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for createAffinityGroup + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param createAffinityGroupPayload Request a affinity group creation. (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 Affinity group was created successfully. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call createAffinityGroupCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateAffinityGroupPayload createAffinityGroupPayload, + 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 = createAffinityGroupPayload; + + // create path and map variables + String localVarPath = + "/v2beta1/projects/{projectId}/regions/{region}/affinity-groups" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/json"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createAffinityGroupValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateAffinityGroupPayload createAffinityGroupPayload, + 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 createAffinityGroup(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling createAffinityGroup(Async)"); + } + + // verify the required parameter 'createAffinityGroupPayload' is set + if (createAffinityGroupPayload == null) { + throw new ApiException( + "Missing the required parameter 'createAffinityGroupPayload' when calling createAffinityGroup(Async)"); + } + + return createAffinityGroupCall(projectId, region, createAffinityGroupPayload, _callback); + } + + /** + * Create a new affinity group in a project. Create a new server affinity group in the given + * project ID. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param createAffinityGroupPayload Request a affinity group creation. (required) + * @return AffinityGroup + * @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 Affinity group was created successfully. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public AffinityGroup createAffinityGroup( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateAffinityGroupPayload createAffinityGroupPayload) + throws ApiException { + ApiResponse localVarResp = + createAffinityGroupWithHttpInfo(projectId, region, createAffinityGroupPayload); + return localVarResp.getData(); + } + + /** + * Create a new affinity group in a project. Create a new server affinity group in the given + * project ID. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param createAffinityGroupPayload Request a affinity group creation. (required) + * @return ApiResponse<AffinityGroup> + * @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 Affinity group was created successfully. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse createAffinityGroupWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateAffinityGroupPayload createAffinityGroupPayload) + throws ApiException { + okhttp3.Call localVarCall = + createAffinityGroupValidateBeforeCall( + projectId, region, createAffinityGroupPayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create a new affinity group in a project. (asynchronously) Create a new server affinity group + * in the given project ID. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param createAffinityGroupPayload Request a affinity group creation. (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 Affinity group was created successfully. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call createAffinityGroupAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateAffinityGroupPayload createAffinityGroupPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createAffinityGroupValidateBeforeCall( + projectId, region, createAffinityGroupPayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for createBackup + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param createBackupPayload Request a backup creation. (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 Create request for Backup accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call createBackupCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateBackupPayload createBackupPayload, + 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 = createBackupPayload; + + // create path and map variables + String localVarPath = + "/v2beta1/projects/{projectId}/regions/{region}/backups" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/json"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createBackupValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateBackupPayload createBackupPayload, + 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 createBackup(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling createBackup(Async)"); + } + + // verify the required parameter 'createBackupPayload' is set + if (createBackupPayload == null) { + throw new ApiException( + "Missing the required parameter 'createBackupPayload' when calling createBackup(Async)"); + } + + return createBackupCall(projectId, region, createBackupPayload, _callback); + } + + /** + * Create new Backup. Create a new Backup in a project. If a snapshot ID is provided create the + * backup from the snapshot. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param createBackupPayload Request a backup creation. (required) + * @return Backup + * @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 Create request for Backup accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public Backup createBackup( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateBackupPayload createBackupPayload) + throws ApiException { + ApiResponse localVarResp = + createBackupWithHttpInfo(projectId, region, createBackupPayload); + return localVarResp.getData(); + } + + /** + * Create new Backup. Create a new Backup in a project. If a snapshot ID is provided create the + * backup from the snapshot. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param createBackupPayload Request a backup creation. (required) + * @return ApiResponse<Backup> + * @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 Create request for Backup accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse createBackupWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateBackupPayload createBackupPayload) + throws ApiException { + okhttp3.Call localVarCall = + createBackupValidateBeforeCall(projectId, region, createBackupPayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create new Backup. (asynchronously) Create a new Backup in a project. If a snapshot ID is + * provided create the backup from the snapshot. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param createBackupPayload Request a backup creation. (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 Create request for Backup accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call createBackupAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateBackupPayload createBackupPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createBackupValidateBeforeCall(projectId, region, createBackupPayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for createImage + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param createImagePayload Request an image creation. (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 Create request for an Image has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
429 Too Many Requests. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call createImageCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateImagePayload createImagePayload, + 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 = createImagePayload; + + // create path and map variables + String localVarPath = + "/v2beta1/projects/{projectId}/regions/{region}/images" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/json"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createImageValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateImagePayload createImagePayload, + 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 createImage(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling createImage(Async)"); + } + + // verify the required parameter 'createImagePayload' is set + if (createImagePayload == null) { + throw new ApiException( + "Missing the required parameter 'createImagePayload' when calling createImage(Async)"); + } + + return createImageCall(projectId, region, createImagePayload, _callback); + } + + /** + * Create new Image. Create a new Image in a project. This call, if successful, returns a + * pre-signed URL for the customer to upload the image. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param createImagePayload Request an image creation. (required) + * @return ImageCreateResponse + * @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 Create request for an Image has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
429 Too Many Requests. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ImageCreateResponse createImage( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateImagePayload createImagePayload) + throws ApiException { + ApiResponse localVarResp = + createImageWithHttpInfo(projectId, region, createImagePayload); + return localVarResp.getData(); + } + + /** + * Create new Image. Create a new Image in a project. This call, if successful, returns a + * pre-signed URL for the customer to upload the image. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param createImagePayload Request an image creation. (required) + * @return ApiResponse<ImageCreateResponse> + * @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 Create request for an Image has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
429 Too Many Requests. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse createImageWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateImagePayload createImagePayload) + throws ApiException { + okhttp3.Call localVarCall = + createImageValidateBeforeCall(projectId, region, createImagePayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create new Image. (asynchronously) Create a new Image in a project. This call, if successful, + * returns a pre-signed URL for the customer to upload the image. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param createImagePayload Request an image creation. (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 Create request for an Image has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
429 Too Many Requests. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call createImageAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateImagePayload createImagePayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createImageValidateBeforeCall(projectId, region, createImagePayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for createIsolatedNetwork + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param createIsolatedNetworkPayload Request a single isolated network creation. (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
202 Isolated Network create has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call createIsolatedNetworkCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateIsolatedNetworkPayload createIsolatedNetworkPayload, + 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 = createIsolatedNetworkPayload; + + // create path and map variables + String localVarPath = + "/v2beta1/projects/{projectId}/regions/{region}/isolated-network" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/json"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createIsolatedNetworkValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateIsolatedNetworkPayload createIsolatedNetworkPayload, + 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 createIsolatedNetwork(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling createIsolatedNetwork(Async)"); + } + + // verify the required parameter 'createIsolatedNetworkPayload' is set + if (createIsolatedNetworkPayload == null) { + throw new ApiException( + "Missing the required parameter 'createIsolatedNetworkPayload' when calling createIsolatedNetwork(Async)"); + } + + return createIsolatedNetworkCall( + projectId, region, createIsolatedNetworkPayload, _callback); + } + + /** + * Create a single isolated network. Creates an isolated network which is not connected to other + * networks in this project. We recommend using this endpoint only if you are fully aware of its + * purpose and the consequences of its execution. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param createIsolatedNetworkPayload Request a single isolated network creation. (required) + * @return Network + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Isolated Network create has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public Network createIsolatedNetwork( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateIsolatedNetworkPayload createIsolatedNetworkPayload) + throws ApiException { + ApiResponse localVarResp = + createIsolatedNetworkWithHttpInfo(projectId, region, createIsolatedNetworkPayload); + return localVarResp.getData(); + } + + /** + * Create a single isolated network. Creates an isolated network which is not connected to other + * networks in this project. We recommend using this endpoint only if you are fully aware of its + * purpose and the consequences of its execution. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param createIsolatedNetworkPayload Request a single isolated network creation. (required) + * @return ApiResponse<Network> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Isolated Network create has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse createIsolatedNetworkWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateIsolatedNetworkPayload createIsolatedNetworkPayload) + throws ApiException { + okhttp3.Call localVarCall = + createIsolatedNetworkValidateBeforeCall( + projectId, region, createIsolatedNetworkPayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create a single isolated network. (asynchronously) Creates an isolated network which is not + * connected to other networks in this project. We recommend using this endpoint only if you are + * fully aware of its purpose and the consequences of its execution. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param createIsolatedNetworkPayload Request a single isolated network creation. (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
202 Isolated Network create has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call createIsolatedNetworkAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateIsolatedNetworkPayload createIsolatedNetworkPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createIsolatedNetworkValidateBeforeCall( + projectId, region, createIsolatedNetworkPayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for createKeyPair + * + * @param createKeyPairPayload Request a public key import. (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 Import of the public key was successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call createKeyPairCall( + @javax.annotation.Nonnull CreateKeyPairPayload createKeyPairPayload, + 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 = createKeyPairPayload; + + // create path and map variables + String localVarPath = "/v2beta1/keypairs"; + + 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 createKeyPairValidateBeforeCall( + @javax.annotation.Nonnull CreateKeyPairPayload createKeyPairPayload, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'createKeyPairPayload' is set + if (createKeyPairPayload == null) { + throw new ApiException( + "Missing the required parameter 'createKeyPairPayload' when calling createKeyPair(Async)"); + } + + return createKeyPairCall(createKeyPairPayload, _callback); + } + + /** + * Import a public key. Import a new public key for the requesting user based on provided public + * key material. The creation will fail if an SSH keypair with the same name already exists. If + * a name is not provided it is autogenerated form the ssh-pubkey comment section. If that is + * also not present it will be the the MD5 fingerprint of the key. For autogenerated names + * invalid characters will be removed. + * + * @param createKeyPairPayload Request a public key import. (required) + * @return Keypair + * @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 Import of the public key was successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public Keypair createKeyPair( + @javax.annotation.Nonnull CreateKeyPairPayload createKeyPairPayload) + throws ApiException { + ApiResponse localVarResp = createKeyPairWithHttpInfo(createKeyPairPayload); + return localVarResp.getData(); + } + + /** + * Import a public key. Import a new public key for the requesting user based on provided public + * key material. The creation will fail if an SSH keypair with the same name already exists. If + * a name is not provided it is autogenerated form the ssh-pubkey comment section. If that is + * also not present it will be the the MD5 fingerprint of the key. For autogenerated names + * invalid characters will be removed. + * + * @param createKeyPairPayload Request a public key import. (required) + * @return ApiResponse<Keypair> + * @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 Import of the public key was successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse createKeyPairWithHttpInfo( + @javax.annotation.Nonnull CreateKeyPairPayload createKeyPairPayload) + throws ApiException { + okhttp3.Call localVarCall = createKeyPairValidateBeforeCall(createKeyPairPayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Import a public key. (asynchronously) Import a new public key for the requesting user based + * on provided public key material. The creation will fail if an SSH keypair with the same name + * already exists. If a name is not provided it is autogenerated form the ssh-pubkey comment + * section. If that is also not present it will be the the MD5 fingerprint of the key. For + * autogenerated names invalid characters will be removed. + * + * @param createKeyPairPayload Request a public key import. (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 Import of the public key was successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call createKeyPairAsync( + @javax.annotation.Nonnull CreateKeyPairPayload createKeyPairPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createKeyPairValidateBeforeCall(createKeyPairPayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for createNetwork + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param createNetworkPayload Request a network creation. (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
202 Network create has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call createNetworkCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateNetworkPayload createNetworkPayload, + 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 = createNetworkPayload; + + // create path and map variables + String localVarPath = + "/v2beta1/projects/{projectId}/regions/{region}/networks" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/json"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createNetworkValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateNetworkPayload createNetworkPayload, + 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 createNetwork(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling createNetwork(Async)"); + } + + // verify the required parameter 'createNetworkPayload' is set + if (createNetworkPayload == null) { + throw new ApiException( + "Missing the required parameter 'createNetworkPayload' when calling createNetwork(Async)"); + } + + return createNetworkCall(projectId, region, createNetworkPayload, _callback); + } + + /** + * Create new network. Create a new network in a project. `nameservers` will be filled + * from `defaultNameservers` of the respective area if not specified. If the project + * has `internetAccess` enabled and this is the first network in the project this + * might incur cost. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param createNetworkPayload Request a network creation. (required) + * @return Network + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Network create has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public Network createNetwork( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateNetworkPayload createNetworkPayload) + throws ApiException { + ApiResponse localVarResp = + createNetworkWithHttpInfo(projectId, region, createNetworkPayload); + return localVarResp.getData(); + } + + /** + * Create new network. Create a new network in a project. `nameservers` will be filled + * from `defaultNameservers` of the respective area if not specified. If the project + * has `internetAccess` enabled and this is the first network in the project this + * might incur cost. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param createNetworkPayload Request a network creation. (required) + * @return ApiResponse<Network> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Network create has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse createNetworkWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateNetworkPayload createNetworkPayload) + throws ApiException { + okhttp3.Call localVarCall = + createNetworkValidateBeforeCall(projectId, region, createNetworkPayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create new network. (asynchronously) Create a new network in a project. + * `nameservers` will be filled from `defaultNameservers` of the respective + * area if not specified. If the project has `internetAccess` enabled and this is the + * first network in the project this might incur cost. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param createNetworkPayload Request a network creation. (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
202 Network create has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call createNetworkAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateNetworkPayload createNetworkPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createNetworkValidateBeforeCall(projectId, region, createNetworkPayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for createNetworkArea + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param createNetworkAreaPayload Request an Area creation. (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 Area has been successfully created. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call createNetworkAreaCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull CreateNetworkAreaPayload createNetworkAreaPayload, + 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 = createNetworkAreaPayload; + + // create path and map variables + String localVarPath = + "/v2beta1/organizations/{organizationId}/network-areas" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.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 createNetworkAreaValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull CreateNetworkAreaPayload createNetworkAreaPayload, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling createNetworkArea(Async)"); + } + + // verify the required parameter 'createNetworkAreaPayload' is set + if (createNetworkAreaPayload == null) { + throw new ApiException( + "Missing the required parameter 'createNetworkAreaPayload' when calling createNetworkArea(Async)"); + } + + return createNetworkAreaCall(organizationId, createNetworkAreaPayload, _callback); + } + + /** + * Create new network area in an organization. Create a new network area in an organization. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param createNetworkAreaPayload Request an Area creation. (required) + * @return NetworkArea + * @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 Area has been successfully created. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public NetworkArea createNetworkArea( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull CreateNetworkAreaPayload createNetworkAreaPayload) + throws ApiException { + ApiResponse localVarResp = + createNetworkAreaWithHttpInfo(organizationId, createNetworkAreaPayload); + return localVarResp.getData(); + } + + /** + * Create new network area in an organization. Create a new network area in an organization. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param createNetworkAreaPayload Request an Area creation. (required) + * @return ApiResponse<NetworkArea> + * @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 Area has been successfully created. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse createNetworkAreaWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull CreateNetworkAreaPayload createNetworkAreaPayload) + throws ApiException { + okhttp3.Call localVarCall = + createNetworkAreaValidateBeforeCall(organizationId, createNetworkAreaPayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create new network area in an organization. (asynchronously) Create a new network area in an + * organization. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param createNetworkAreaPayload Request an Area creation. (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 Area has been successfully created. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call createNetworkAreaAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull CreateNetworkAreaPayload createNetworkAreaPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createNetworkAreaValidateBeforeCall( + organizationId, createNetworkAreaPayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for createNetworkAreaRange + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param createNetworkAreaRangePayload Request an addition of network ranges to an area. + * (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 Adding network ranges was successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call createNetworkAreaRangeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateNetworkAreaRangePayload createNetworkAreaRangePayload, + 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 = createNetworkAreaRangePayload; + + // create path and map variables + String localVarPath = + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/network-ranges" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "areaId" + "}", + localVarApiClient.escapeString(areaId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/json"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createNetworkAreaRangeValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateNetworkAreaRangePayload createNetworkAreaRangePayload, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling createNetworkAreaRange(Async)"); + } + + // verify the required parameter 'areaId' is set + if (areaId == null) { + throw new ApiException( + "Missing the required parameter 'areaId' when calling createNetworkAreaRange(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling createNetworkAreaRange(Async)"); + } + + // verify the required parameter 'createNetworkAreaRangePayload' is set + if (createNetworkAreaRangePayload == null) { + throw new ApiException( + "Missing the required parameter 'createNetworkAreaRangePayload' when calling createNetworkAreaRange(Async)"); + } + + return createNetworkAreaRangeCall( + organizationId, areaId, region, createNetworkAreaRangePayload, _callback); + } + + /** + * Create new network range in a network area. Create a new network range in an existing network + * area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param createNetworkAreaRangePayload Request an addition of network ranges to an area. + * (required) + * @return NetworkRangeListResponse + * @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 Adding network ranges was successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public NetworkRangeListResponse createNetworkAreaRange( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateNetworkAreaRangePayload createNetworkAreaRangePayload) + throws ApiException { + ApiResponse localVarResp = + createNetworkAreaRangeWithHttpInfo( + organizationId, areaId, region, createNetworkAreaRangePayload); + return localVarResp.getData(); + } + + /** + * Create new network range in a network area. Create a new network range in an existing network + * area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param createNetworkAreaRangePayload Request an addition of network ranges to an area. + * (required) + * @return ApiResponse<NetworkRangeListResponse> + * @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 Adding network ranges was successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse createNetworkAreaRangeWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateNetworkAreaRangePayload createNetworkAreaRangePayload) + throws ApiException { + okhttp3.Call localVarCall = + createNetworkAreaRangeValidateBeforeCall( + organizationId, areaId, region, createNetworkAreaRangePayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create new network range in a network area. (asynchronously) Create a new network range in an + * existing network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param createNetworkAreaRangePayload Request an addition of network ranges to an area. + * (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 Adding network ranges was successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call createNetworkAreaRangeAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateNetworkAreaRangePayload createNetworkAreaRangePayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createNetworkAreaRangeValidateBeforeCall( + organizationId, areaId, region, createNetworkAreaRangePayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for createNetworkAreaRoute + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param createNetworkAreaRoutePayload Request an addition of routes to an area. (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
202 Create request for network routes accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call createNetworkAreaRouteCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateNetworkAreaRoutePayload createNetworkAreaRoutePayload, + 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 = createNetworkAreaRoutePayload; + + // create path and map variables + String localVarPath = + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routes" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "areaId" + "}", + localVarApiClient.escapeString(areaId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/json"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createNetworkAreaRouteValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateNetworkAreaRoutePayload createNetworkAreaRoutePayload, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling createNetworkAreaRoute(Async)"); + } + + // verify the required parameter 'areaId' is set + if (areaId == null) { + throw new ApiException( + "Missing the required parameter 'areaId' when calling createNetworkAreaRoute(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling createNetworkAreaRoute(Async)"); + } + + // verify the required parameter 'createNetworkAreaRoutePayload' is set + if (createNetworkAreaRoutePayload == null) { + throw new ApiException( + "Missing the required parameter 'createNetworkAreaRoutePayload' when calling createNetworkAreaRoute(Async)"); + } + + return createNetworkAreaRouteCall( + organizationId, areaId, region, createNetworkAreaRoutePayload, _callback); + } + + /** + * Create new network routes. Create one or several new network routes in a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param createNetworkAreaRoutePayload Request an addition of routes to an area. (required) + * @return RouteListResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Create request for network routes accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public RouteListResponse createNetworkAreaRoute( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateNetworkAreaRoutePayload createNetworkAreaRoutePayload) + throws ApiException { + ApiResponse localVarResp = + createNetworkAreaRouteWithHttpInfo( + organizationId, areaId, region, createNetworkAreaRoutePayload); + return localVarResp.getData(); + } + + /** + * Create new network routes. Create one or several new network routes in a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param createNetworkAreaRoutePayload Request an addition of routes to an area. (required) + * @return ApiResponse<RouteListResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Create request for network routes accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse createNetworkAreaRouteWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateNetworkAreaRoutePayload createNetworkAreaRoutePayload) + throws ApiException { + okhttp3.Call localVarCall = + createNetworkAreaRouteValidateBeforeCall( + organizationId, areaId, region, createNetworkAreaRoutePayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create new network routes. (asynchronously) Create one or several new network routes in a + * network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param createNetworkAreaRoutePayload Request an addition of routes to an area. (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
202 Create request for network routes accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call createNetworkAreaRouteAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateNetworkAreaRoutePayload createNetworkAreaRoutePayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createNetworkAreaRouteValidateBeforeCall( + organizationId, areaId, region, createNetworkAreaRoutePayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for createNic + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param createNicPayload Request a network interface creation. (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 Network interface was created successfully. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
429 Too Many Requests. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call createNicCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull CreateNicPayload createNicPayload, + 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 = createNicPayload; + + // create path and map variables + String localVarPath = + "/v2beta1/projects/{projectId}/regions/{region}/networks/{networkId}/nics" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "networkId" + "}", + localVarApiClient.escapeString(networkId.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 createNicValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull CreateNicPayload createNicPayload, + 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 createNic(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling createNic(Async)"); + } + + // verify the required parameter 'networkId' is set + if (networkId == null) { + throw new ApiException( + "Missing the required parameter 'networkId' when calling createNic(Async)"); + } + + // verify the required parameter 'createNicPayload' is set + if (createNicPayload == null) { + throw new ApiException( + "Missing the required parameter 'createNicPayload' when calling createNic(Async)"); + } + + return createNicCall(projectId, region, networkId, createNicPayload, _callback); + } + + /** + * Create new network interface. Create a new network interface in a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param createNicPayload Request a network interface creation. (required) + * @return NIC + * @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 Network interface was created successfully. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
429 Too Many Requests. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public NIC createNic( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull CreateNicPayload createNicPayload) + throws ApiException { + ApiResponse localVarResp = + createNicWithHttpInfo(projectId, region, networkId, createNicPayload); + return localVarResp.getData(); + } + + /** + * Create new network interface. Create a new network interface in a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param createNicPayload Request a network interface creation. (required) + * @return ApiResponse<NIC> + * @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 Network interface was created successfully. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
429 Too Many Requests. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse createNicWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull CreateNicPayload createNicPayload) + throws ApiException { + okhttp3.Call localVarCall = + createNicValidateBeforeCall(projectId, region, networkId, createNicPayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create new network interface. (asynchronously) Create a new network interface in a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param createNicPayload Request a network interface creation. (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 Network interface was created successfully. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
429 Too Many Requests. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call createNicAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull CreateNicPayload createNicPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createNicValidateBeforeCall( + projectId, region, networkId, createNicPayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for createPublicIP + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param createPublicIPPayload Request a public IP creation. (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 The public IP has been created. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
429 Too Many Requests. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call createPublicIPCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreatePublicIPPayload createPublicIPPayload, + 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 = createPublicIPPayload; + + // create path and map variables + String localVarPath = + "/v2beta1/projects/{projectId}/regions/{region}/public-ips" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/json"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createPublicIPValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreatePublicIPPayload createPublicIPPayload, + 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 createPublicIP(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling createPublicIP(Async)"); + } + + // verify the required parameter 'createPublicIPPayload' is set + if (createPublicIPPayload == null) { + throw new ApiException( + "Missing the required parameter 'createPublicIPPayload' when calling createPublicIP(Async)"); + } + + return createPublicIPCall(projectId, region, createPublicIPPayload, _callback); + } + + /** + * Create new public IP. Create a new public IP in a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param createPublicIPPayload Request a public IP creation. (required) + * @return PublicIp + * @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 The public IP has been created. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
429 Too Many Requests. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public PublicIp createPublicIP( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreatePublicIPPayload createPublicIPPayload) + throws ApiException { + ApiResponse localVarResp = + createPublicIPWithHttpInfo(projectId, region, createPublicIPPayload); + return localVarResp.getData(); + } + + /** + * Create new public IP. Create a new public IP in a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param createPublicIPPayload Request a public IP creation. (required) + * @return ApiResponse<PublicIp> + * @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 The public IP has been created. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
429 Too Many Requests. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse createPublicIPWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreatePublicIPPayload createPublicIPPayload) + throws ApiException { + okhttp3.Call localVarCall = + createPublicIPValidateBeforeCall(projectId, region, createPublicIPPayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create new public IP. (asynchronously) Create a new public IP in a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param createPublicIPPayload Request a public IP creation. (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 The public IP has been created. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
429 Too Many Requests. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call createPublicIPAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreatePublicIPPayload createPublicIPPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createPublicIPValidateBeforeCall( + projectId, region, createPublicIPPayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for createSecurityGroup + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param createSecurityGroupPayload Request a security group creation. (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 Security group create has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call createSecurityGroupCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateSecurityGroupPayload createSecurityGroupPayload, + 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 = createSecurityGroupPayload; + + // create path and map variables + String localVarPath = + "/v2beta1/projects/{projectId}/regions/{region}/security-groups" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/json"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createSecurityGroupValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateSecurityGroupPayload createSecurityGroupPayload, + 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 createSecurityGroup(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling createSecurityGroup(Async)"); + } + + // verify the required parameter 'createSecurityGroupPayload' is set + if (createSecurityGroupPayload == null) { + throw new ApiException( + "Missing the required parameter 'createSecurityGroupPayload' when calling createSecurityGroup(Async)"); + } + + return createSecurityGroupCall(projectId, region, createSecurityGroupPayload, _callback); + } + + /** + * Create new security group. Create a new security group in a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param createSecurityGroupPayload Request a security group creation. (required) + * @return SecurityGroup + * @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 Security group create has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public SecurityGroup createSecurityGroup( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateSecurityGroupPayload createSecurityGroupPayload) + throws ApiException { + ApiResponse localVarResp = + createSecurityGroupWithHttpInfo(projectId, region, createSecurityGroupPayload); + return localVarResp.getData(); + } + + /** + * Create new security group. Create a new security group in a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param createSecurityGroupPayload Request a security group creation. (required) + * @return ApiResponse<SecurityGroup> + * @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 Security group create has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse createSecurityGroupWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateSecurityGroupPayload createSecurityGroupPayload) + throws ApiException { + okhttp3.Call localVarCall = + createSecurityGroupValidateBeforeCall( + projectId, region, createSecurityGroupPayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create new security group. (asynchronously) Create a new security group in a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param createSecurityGroupPayload Request a security group creation. (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 Security group create has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call createSecurityGroupAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateSecurityGroupPayload createSecurityGroupPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createSecurityGroupValidateBeforeCall( + projectId, region, createSecurityGroupPayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for createSecurityGroupRule + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security Group. (required) + * @param createSecurityGroupRulePayload Request for a security group rule creation. (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 Security group rule create has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call createSecurityGroupRuleCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID securityGroupId, + @javax.annotation.Nonnull CreateSecurityGroupRulePayload createSecurityGroupRulePayload, + 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 = createSecurityGroupRulePayload; + + // create path and map variables + String localVarPath = + "/v2beta1/projects/{projectId}/regions/{region}/security-groups/{securityGroupId}/rules" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "securityGroupId" + "}", + localVarApiClient.escapeString(securityGroupId.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 createSecurityGroupRuleValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID securityGroupId, + @javax.annotation.Nonnull CreateSecurityGroupRulePayload createSecurityGroupRulePayload, + 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 createSecurityGroupRule(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling createSecurityGroupRule(Async)"); + } + + // verify the required parameter 'securityGroupId' is set + if (securityGroupId == null) { + throw new ApiException( + "Missing the required parameter 'securityGroupId' when calling createSecurityGroupRule(Async)"); + } + + // verify the required parameter 'createSecurityGroupRulePayload' is set + if (createSecurityGroupRulePayload == null) { + throw new ApiException( + "Missing the required parameter 'createSecurityGroupRulePayload' when calling createSecurityGroupRule(Async)"); + } + + return createSecurityGroupRuleCall( + projectId, region, securityGroupId, createSecurityGroupRulePayload, _callback); + } + + /** + * Create new security group rule. Create a new security group rule in a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security Group. (required) + * @param createSecurityGroupRulePayload Request for a security group rule creation. (required) + * @return SecurityGroupRule + * @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 Security group rule create has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public SecurityGroupRule createSecurityGroupRule( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID securityGroupId, + @javax.annotation.Nonnull CreateSecurityGroupRulePayload createSecurityGroupRulePayload) + throws ApiException { + ApiResponse localVarResp = + createSecurityGroupRuleWithHttpInfo( + projectId, region, securityGroupId, createSecurityGroupRulePayload); + return localVarResp.getData(); + } + + /** + * Create new security group rule. Create a new security group rule in a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security Group. (required) + * @param createSecurityGroupRulePayload Request for a security group rule creation. (required) + * @return ApiResponse<SecurityGroupRule> + * @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 Security group rule create has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse createSecurityGroupRuleWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID securityGroupId, + @javax.annotation.Nonnull CreateSecurityGroupRulePayload createSecurityGroupRulePayload) + throws ApiException { + okhttp3.Call localVarCall = + createSecurityGroupRuleValidateBeforeCall( + projectId, region, securityGroupId, createSecurityGroupRulePayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create new security group rule. (asynchronously) Create a new security group rule in a + * project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security Group. (required) + * @param createSecurityGroupRulePayload Request for a security group rule creation. (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 Security group rule create has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call createSecurityGroupRuleAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID securityGroupId, + @javax.annotation.Nonnull CreateSecurityGroupRulePayload createSecurityGroupRulePayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createSecurityGroupRuleValidateBeforeCall( + projectId, + region, + securityGroupId, + createSecurityGroupRulePayload, + _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for createServer + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param createServerPayload Request a server creation. (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 Create request for server accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call createServerCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateServerPayload createServerPayload, + 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 = createServerPayload; + + // create path and map variables + String localVarPath = + "/v2beta1/projects/{projectId}/regions/{region}/servers" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/json"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createServerValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateServerPayload createServerPayload, + 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 createServer(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling createServer(Async)"); + } + + // verify the required parameter 'createServerPayload' is set + if (createServerPayload == null) { + throw new ApiException( + "Missing the required parameter 'createServerPayload' when calling createServer(Async)"); + } + + return createServerCall(projectId, region, createServerPayload, _callback); + } + + /** + * Create new server. Create a new server in a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param createServerPayload Request a server creation. (required) + * @return Server + * @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 Create request for server accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public Server createServer( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateServerPayload createServerPayload) + throws ApiException { + ApiResponse localVarResp = + createServerWithHttpInfo(projectId, region, createServerPayload); + return localVarResp.getData(); + } + + /** + * Create new server. Create a new server in a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param createServerPayload Request a server creation. (required) + * @return ApiResponse<Server> + * @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 Create request for server accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse createServerWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateServerPayload createServerPayload) + throws ApiException { + okhttp3.Call localVarCall = + createServerValidateBeforeCall(projectId, region, createServerPayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create new server. (asynchronously) Create a new server in a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param createServerPayload Request a server creation. (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 Create request for server accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call createServerAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateServerPayload createServerPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createServerValidateBeforeCall(projectId, region, createServerPayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for createVolume + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param createVolumePayload Request a volume creation. (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 Create request for volume accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call createVolumeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateVolumePayload createVolumePayload, + 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 = createVolumePayload; + + // create path and map variables + String localVarPath = + "/v2beta1/projects/{projectId}/regions/{region}/volumes" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/json"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createVolumeValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateVolumePayload createVolumePayload, + 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 createVolume(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling createVolume(Async)"); + } + + // verify the required parameter 'createVolumePayload' is set + if (createVolumePayload == null) { + throw new ApiException( + "Missing the required parameter 'createVolumePayload' when calling createVolume(Async)"); + } + + return createVolumeCall(projectId, region, createVolumePayload, _callback); + } + + /** + * Create new volume. Create a new volume in a project. If a volume source is not provided, an + * empty volume will be created. The size property is required if no source or an image source + * is provided. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param createVolumePayload Request a volume creation. (required) + * @return Volume + * @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 Create request for volume accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public Volume createVolume( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateVolumePayload createVolumePayload) + throws ApiException { + ApiResponse localVarResp = + createVolumeWithHttpInfo(projectId, region, createVolumePayload); + return localVarResp.getData(); + } + + /** + * Create new volume. Create a new volume in a project. If a volume source is not provided, an + * empty volume will be created. The size property is required if no source or an image source + * is provided. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param createVolumePayload Request a volume creation. (required) + * @return ApiResponse<Volume> + * @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 Create request for volume accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse createVolumeWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateVolumePayload createVolumePayload) + throws ApiException { + okhttp3.Call localVarCall = + createVolumeValidateBeforeCall(projectId, region, createVolumePayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create new volume. (asynchronously) Create a new volume in a project. If a volume source is + * not provided, an empty volume will be created. The size property is required if no source or + * an image source is provided. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param createVolumePayload Request a volume creation. (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 Create request for volume accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call createVolumeAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull CreateVolumePayload createVolumePayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + createVolumeValidateBeforeCall(projectId, region, createVolumePayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for deallocateServer + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (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
202 Server deallocation request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call deallocateServerCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/deallocate" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deallocateServerValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'projectId' is set + if (projectId == null) { + throw new ApiException( + "Missing the required parameter 'projectId' when calling deallocateServer(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling deallocateServer(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling deallocateServer(Async)"); + } + + return deallocateServerCall(projectId, region, serverId, _callback); + } + + /** + * Deallocate an existing server. Deallocate an existing server. The server will be removed from + * the hypervisor so only the volume will be billed. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Server deallocation request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public void deallocateServer( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId) + throws ApiException { + deallocateServerWithHttpInfo(projectId, region, serverId); + } + + /** + * Deallocate an existing server. Deallocate an existing server. The server will be removed from + * the hypervisor so only the volume will be billed. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Server deallocation request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse deallocateServerWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId) + throws ApiException { + okhttp3.Call localVarCall = + deallocateServerValidateBeforeCall(projectId, region, serverId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Deallocate an existing server. (asynchronously) Deallocate an existing server. The server + * will be removed from the hypervisor so only the volume will be billed. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (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
202 Server deallocation request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call deallocateServerAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + deallocateServerValidateBeforeCall(projectId, region, serverId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for deleteAffinityGroup + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param affinityGroupId The identifier (ID) of a STACKIT Affinity 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
204 Delete request for an server group was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call deleteAffinityGroupCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID affinityGroupId, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/affinity-groups/{affinityGroupId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "affinityGroupId" + "}", + localVarApiClient.escapeString(affinityGroupId.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 deleteAffinityGroupValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID affinityGroupId, + 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 deleteAffinityGroup(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling deleteAffinityGroup(Async)"); + } + + // verify the required parameter 'affinityGroupId' is set + if (affinityGroupId == null) { + throw new ApiException( + "Missing the required parameter 'affinityGroupId' when calling deleteAffinityGroup(Async)"); + } + + return deleteAffinityGroupCall(projectId, region, affinityGroupId, _callback); + } + + /** + * Delete a affinity group in a project. Delete a affinity group in the given project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param affinityGroupId The identifier (ID) of a STACKIT Affinity Group. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Delete request for an server group was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public void deleteAffinityGroup( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID affinityGroupId) + throws ApiException { + deleteAffinityGroupWithHttpInfo(projectId, region, affinityGroupId); + } + + /** + * Delete a affinity group in a project. Delete a affinity group in the given project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param affinityGroupId The identifier (ID) of a STACKIT Affinity Group. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Delete request for an server group was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse deleteAffinityGroupWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID affinityGroupId) + throws ApiException { + okhttp3.Call localVarCall = + deleteAffinityGroupValidateBeforeCall(projectId, region, affinityGroupId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete a affinity group in a project. (asynchronously) Delete a affinity group in the given + * project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param affinityGroupId The identifier (ID) of a STACKIT Affinity 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
204 Delete request for an server group was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call deleteAffinityGroupAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID affinityGroupId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + deleteAffinityGroupValidateBeforeCall( + projectId, region, affinityGroupId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for deleteBackup + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param backupId The identifier (ID) of a STACKIT Backup. (required) + * @param force Force action. (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
204 Backup delete request has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call deleteBackupCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID backupId, + @javax.annotation.Nullable Boolean force, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/backups/{backupId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "backupId" + "}", + localVarApiClient.escapeString(backupId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (force != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("force", force)); + } + + 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 deleteBackupValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID backupId, + @javax.annotation.Nullable Boolean force, + 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 deleteBackup(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling deleteBackup(Async)"); + } + + // verify the required parameter 'backupId' is set + if (backupId == null) { + throw new ApiException( + "Missing the required parameter 'backupId' when calling deleteBackup(Async)"); + } + + return deleteBackupCall(projectId, region, backupId, force, _callback); + } + + /** + * Delete a backup. Delete a backup that is part of the project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param backupId The identifier (ID) of a STACKIT Backup. (required) + * @param force Force action. (optional, default to false) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Backup delete request has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public void deleteBackup( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID backupId, + @javax.annotation.Nullable Boolean force) + throws ApiException { + deleteBackupWithHttpInfo(projectId, region, backupId, force); + } + + /** + * Delete a backup. Delete a backup that is part of the project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param backupId The identifier (ID) of a STACKIT Backup. (required) + * @param force Force action. (optional, default to false) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Backup delete request has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse deleteBackupWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID backupId, + @javax.annotation.Nullable Boolean force) + throws ApiException { + okhttp3.Call localVarCall = + deleteBackupValidateBeforeCall(projectId, region, backupId, force, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete a backup. (asynchronously) Delete a backup that is part of the project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param backupId The identifier (ID) of a STACKIT Backup. (required) + * @param force Force action. (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
204 Backup delete request has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call deleteBackupAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID backupId, + @javax.annotation.Nullable Boolean force, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + deleteBackupValidateBeforeCall(projectId, region, backupId, force, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for deleteImage + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Image delete request has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call deleteImageCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID imageId, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/images/{imageId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "imageId" + "}", + localVarApiClient.escapeString(imageId.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 deleteImageValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID imageId, + 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 deleteImage(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling deleteImage(Async)"); + } + + // verify the required parameter 'imageId' is set + if (imageId == null) { + throw new ApiException( + "Missing the required parameter 'imageId' when calling deleteImage(Async)"); + } + + return deleteImageCall(projectId, region, imageId, _callback); + } + + /** + * Delete an Image. Delete an image that is part of the project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Image delete request has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public void deleteImage( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID imageId) + throws ApiException { + deleteImageWithHttpInfo(projectId, region, imageId); + } + + /** + * Delete an Image. Delete an image that is part of the project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Image delete request has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse deleteImageWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID imageId) + throws ApiException { + okhttp3.Call localVarCall = deleteImageValidateBeforeCall(projectId, region, imageId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete an Image. (asynchronously) Delete an image that is part of the project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Image delete request has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call deleteImageAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID imageId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + deleteImageValidateBeforeCall(projectId, region, imageId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for deleteImageShare + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Image share removed. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call deleteImageShareCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID imageId, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/images/{imageId}/share" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "imageId" + "}", + localVarApiClient.escapeString(imageId.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 deleteImageShareValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID imageId, + 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 deleteImageShare(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling deleteImageShare(Async)"); + } + + // verify the required parameter 'imageId' is set + if (imageId == null) { + throw new ApiException( + "Missing the required parameter 'imageId' when calling deleteImageShare(Async)"); + } + + return deleteImageShareCall(projectId, region, imageId, _callback); + } + + /** + * Remove image share. Remove the image share. New scope will be local. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Image share removed. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public void deleteImageShare( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID imageId) + throws ApiException { + deleteImageShareWithHttpInfo(projectId, region, imageId); + } + + /** + * Remove image share. Remove the image share. New scope will be local. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Image share removed. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse deleteImageShareWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID imageId) + throws ApiException { + okhttp3.Call localVarCall = + deleteImageShareValidateBeforeCall(projectId, region, imageId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Remove image share. (asynchronously) Remove the image share. New scope will be local. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Image share removed. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call deleteImageShareAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID imageId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + deleteImageShareValidateBeforeCall(projectId, region, imageId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for deleteImageShareConsumer + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @param consumerProjectId The identifier (ID) of a STACKIT Project that consumes an image + * share. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Image share consumer removed. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call deleteImageShareConsumerCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID imageId, + @javax.annotation.Nonnull UUID consumerProjectId, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/images/{imageId}/share/{consumerProjectId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "imageId" + "}", + localVarApiClient.escapeString(imageId.toString())) + .replace( + "{" + "consumerProjectId" + "}", + localVarApiClient.escapeString(consumerProjectId.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 deleteImageShareConsumerValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID imageId, + @javax.annotation.Nonnull UUID consumerProjectId, + 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 deleteImageShareConsumer(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling deleteImageShareConsumer(Async)"); + } + + // verify the required parameter 'imageId' is set + if (imageId == null) { + throw new ApiException( + "Missing the required parameter 'imageId' when calling deleteImageShareConsumer(Async)"); + } + + // verify the required parameter 'consumerProjectId' is set + if (consumerProjectId == null) { + throw new ApiException( + "Missing the required parameter 'consumerProjectId' when calling deleteImageShareConsumer(Async)"); + } + + return deleteImageShareConsumerCall( + projectId, region, imageId, consumerProjectId, _callback); + } + + /** + * Remove an image share consumer. Remove consumer from a shared image. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @param consumerProjectId The identifier (ID) of a STACKIT Project that consumes an image + * share. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Image share consumer removed. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public void deleteImageShareConsumer( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID imageId, + @javax.annotation.Nonnull UUID consumerProjectId) + throws ApiException { + deleteImageShareConsumerWithHttpInfo(projectId, region, imageId, consumerProjectId); + } + + /** + * Remove an image share consumer. Remove consumer from a shared image. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @param consumerProjectId The identifier (ID) of a STACKIT Project that consumes an image + * share. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Image share consumer removed. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse deleteImageShareConsumerWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID imageId, + @javax.annotation.Nonnull UUID consumerProjectId) + throws ApiException { + okhttp3.Call localVarCall = + deleteImageShareConsumerValidateBeforeCall( + projectId, region, imageId, consumerProjectId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Remove an image share consumer. (asynchronously) Remove consumer from a shared image. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @param consumerProjectId The identifier (ID) of a STACKIT Project that consumes an image + * share. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Image share consumer removed. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call deleteImageShareConsumerAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID imageId, + @javax.annotation.Nonnull UUID consumerProjectId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + deleteImageShareConsumerValidateBeforeCall( + projectId, region, imageId, consumerProjectId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for deleteKeyPair + * + * @param keypairName The name of an SSH keypair. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Delete request for an SSH keypair was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call deleteKeyPairCall( + @javax.annotation.Nonnull String keypairName, 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 = + "/v2beta1/keypairs/{keypairName}" + .replace( + "{" + "keypairName" + "}", + localVarApiClient.escapeString(keypairName.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 deleteKeyPairValidateBeforeCall( + @javax.annotation.Nonnull String keypairName, final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'keypairName' is set + if (keypairName == null) { + throw new ApiException( + "Missing the required parameter 'keypairName' when calling deleteKeyPair(Async)"); + } + + return deleteKeyPairCall(keypairName, _callback); + } + + /** + * Delete an SSH keypair. Delete an SSH keypair from a user. + * + * @param keypairName The name of an SSH keypair. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Delete request for an SSH keypair was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public void deleteKeyPair(@javax.annotation.Nonnull String keypairName) throws ApiException { + deleteKeyPairWithHttpInfo(keypairName); + } + + /** + * Delete an SSH keypair. Delete an SSH keypair from a user. + * + * @param keypairName The name of an SSH keypair. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Delete request for an SSH keypair was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse deleteKeyPairWithHttpInfo(@javax.annotation.Nonnull String keypairName) + throws ApiException { + okhttp3.Call localVarCall = deleteKeyPairValidateBeforeCall(keypairName, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete an SSH keypair. (asynchronously) Delete an SSH keypair from a user. + * + * @param keypairName The name of an SSH keypair. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Delete request for an SSH keypair was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call deleteKeyPairAsync( + @javax.annotation.Nonnull String keypairName, final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = deleteKeyPairValidateBeforeCall(keypairName, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for deleteNetwork + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (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
202 Delete request for network has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call deleteNetworkCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/networks/{networkId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "networkId" + "}", + localVarApiClient.escapeString(networkId.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 deleteNetworkValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId, + 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 deleteNetwork(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling deleteNetwork(Async)"); + } + + // verify the required parameter 'networkId' is set + if (networkId == null) { + throw new ApiException( + "Missing the required parameter 'networkId' when calling deleteNetwork(Async)"); + } + + return deleteNetworkCall(projectId, region, networkId, _callback); + } + + /** + * Delete network. Delete a network. If the network is still in use, the deletion will fail. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Delete request for network has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public void deleteNetwork( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId) + throws ApiException { + deleteNetworkWithHttpInfo(projectId, region, networkId); + } + + /** + * Delete network. Delete a network. If the network is still in use, the deletion will fail. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Delete request for network has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse deleteNetworkWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId) + throws ApiException { + okhttp3.Call localVarCall = + deleteNetworkValidateBeforeCall(projectId, region, networkId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete network. (asynchronously) Delete a network. If the network is still in use, the + * deletion will fail. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (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
202 Delete request for network has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call deleteNetworkAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + deleteNetworkValidateBeforeCall(projectId, region, networkId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for deleteNetworkArea + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Delete request for area has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call deleteNetworkAreaCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + 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 = + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "areaId" + "}", + localVarApiClient.escapeString(areaId.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 deleteNetworkAreaValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling deleteNetworkArea(Async)"); + } + + // verify the required parameter 'areaId' is set + if (areaId == null) { + throw new ApiException( + "Missing the required parameter 'areaId' when calling deleteNetworkArea(Async)"); + } + + return deleteNetworkAreaCall(organizationId, areaId, _callback); + } + + /** + * Delete a network area. Delete an existing network area in an organization. This is only + * possible if no projects are using the area anymore. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Delete request for area has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public void deleteNetworkArea( + @javax.annotation.Nonnull UUID organizationId, @javax.annotation.Nonnull UUID areaId) + throws ApiException { + deleteNetworkAreaWithHttpInfo(organizationId, areaId); + } + + /** + * Delete a network area. Delete an existing network area in an organization. This is only + * possible if no projects are using the area anymore. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Delete request for area has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse deleteNetworkAreaWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, @javax.annotation.Nonnull UUID areaId) + throws ApiException { + okhttp3.Call localVarCall = + deleteNetworkAreaValidateBeforeCall(organizationId, areaId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete a network area. (asynchronously) Delete an existing network area in an organization. + * This is only possible if no projects are using the area anymore. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Delete request for area has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call deleteNetworkAreaAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + deleteNetworkAreaValidateBeforeCall(organizationId, areaId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for deleteNetworkAreaRange + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param networkRangeId The identifier (ID) of a STACKIT Network Range. (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
202 Delete request for network range accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call deleteNetworkAreaRangeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkRangeId, + 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 = + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/network-ranges/{networkRangeId}" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "areaId" + "}", + localVarApiClient.escapeString(areaId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "networkRangeId" + "}", + localVarApiClient.escapeString(networkRangeId.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 deleteNetworkAreaRangeValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkRangeId, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling deleteNetworkAreaRange(Async)"); + } + + // verify the required parameter 'areaId' is set + if (areaId == null) { + throw new ApiException( + "Missing the required parameter 'areaId' when calling deleteNetworkAreaRange(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling deleteNetworkAreaRange(Async)"); + } + + // verify the required parameter 'networkRangeId' is set + if (networkRangeId == null) { + throw new ApiException( + "Missing the required parameter 'networkRangeId' when calling deleteNetworkAreaRange(Async)"); + } + + return deleteNetworkAreaRangeCall( + organizationId, areaId, region, networkRangeId, _callback); + } + + /** + * Delete a network range. Delete a network range of a network area. The deletion will fail if + * the network range is still used. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param networkRangeId The identifier (ID) of a STACKIT Network Range. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Delete request for network range accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public void deleteNetworkAreaRange( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkRangeId) + throws ApiException { + deleteNetworkAreaRangeWithHttpInfo(organizationId, areaId, region, networkRangeId); + } + + /** + * Delete a network range. Delete a network range of a network area. The deletion will fail if + * the network range is still used. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param networkRangeId The identifier (ID) of a STACKIT Network Range. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Delete request for network range accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse deleteNetworkAreaRangeWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkRangeId) + throws ApiException { + okhttp3.Call localVarCall = + deleteNetworkAreaRangeValidateBeforeCall( + organizationId, areaId, region, networkRangeId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete a network range. (asynchronously) Delete a network range of a network area. The + * deletion will fail if the network range is still used. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param networkRangeId The identifier (ID) of a STACKIT Network Range. (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
202 Delete request for network range accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call deleteNetworkAreaRangeAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkRangeId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + deleteNetworkAreaRangeValidateBeforeCall( + organizationId, areaId, region, networkRangeId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for deleteNetworkAreaRoute + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routeId The identifier (ID) of a STACKIT Route. (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
202 Delete request for the network route has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call deleteNetworkAreaRouteCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routeId, + 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 = + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routes/{routeId}" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "areaId" + "}", + localVarApiClient.escapeString(areaId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "routeId" + "}", + localVarApiClient.escapeString(routeId.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 deleteNetworkAreaRouteValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routeId, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling deleteNetworkAreaRoute(Async)"); + } + + // verify the required parameter 'areaId' is set + if (areaId == null) { + throw new ApiException( + "Missing the required parameter 'areaId' when calling deleteNetworkAreaRoute(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling deleteNetworkAreaRoute(Async)"); + } + + // verify the required parameter 'routeId' is set + if (routeId == null) { + throw new ApiException( + "Missing the required parameter 'routeId' when calling deleteNetworkAreaRoute(Async)"); + } + + return deleteNetworkAreaRouteCall(organizationId, areaId, region, routeId, _callback); + } + + /** + * Delete a network route. Delete a network route of a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routeId The identifier (ID) of a STACKIT Route. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Delete request for the network route has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public void deleteNetworkAreaRoute( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routeId) + throws ApiException { + deleteNetworkAreaRouteWithHttpInfo(organizationId, areaId, region, routeId); + } + + /** + * Delete a network route. Delete a network route of a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routeId The identifier (ID) of a STACKIT Route. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Delete request for the network route has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse deleteNetworkAreaRouteWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routeId) + throws ApiException { + okhttp3.Call localVarCall = + deleteNetworkAreaRouteValidateBeforeCall( + organizationId, areaId, region, routeId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete a network route. (asynchronously) Delete a network route of a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routeId The identifier (ID) of a STACKIT Route. (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
202 Delete request for the network route has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call deleteNetworkAreaRouteAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routeId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + deleteNetworkAreaRouteValidateBeforeCall( + organizationId, areaId, region, routeId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for deleteNic + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param nicId The identifier (ID) of a network interface. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Network interface delete request has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call deleteNicCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull UUID nicId, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/networks/{networkId}/nics/{nicId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "networkId" + "}", + localVarApiClient.escapeString(networkId.toString())) + .replace( + "{" + "nicId" + "}", + localVarApiClient.escapeString(nicId.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 deleteNicValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull UUID nicId, + 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 deleteNic(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling deleteNic(Async)"); + } + + // verify the required parameter 'networkId' is set + if (networkId == null) { + throw new ApiException( + "Missing the required parameter 'networkId' when calling deleteNic(Async)"); + } + + // verify the required parameter 'nicId' is set + if (nicId == null) { + throw new ApiException( + "Missing the required parameter 'nicId' when calling deleteNic(Async)"); + } + + return deleteNicCall(projectId, region, networkId, nicId, _callback); + } + + /** + * Delete a network interface. Delete a network interface that is part of the project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param nicId The identifier (ID) of a network interface. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Network interface delete request has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public void deleteNic( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull UUID nicId) + throws ApiException { + deleteNicWithHttpInfo(projectId, region, networkId, nicId); + } + + /** + * Delete a network interface. Delete a network interface that is part of the project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param nicId The identifier (ID) of a network interface. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Network interface delete request has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse deleteNicWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull UUID nicId) + throws ApiException { + okhttp3.Call localVarCall = + deleteNicValidateBeforeCall(projectId, region, networkId, nicId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete a network interface. (asynchronously) Delete a network interface that is part of the + * project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param nicId The identifier (ID) of a network interface. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Network interface delete request has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call deleteNicAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull UUID nicId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + deleteNicValidateBeforeCall(projectId, region, networkId, nicId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for deletePublicIP + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param publicIpId The identifier (ID) of a Public IP. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 The public IP has been deleted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call deletePublicIPCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID publicIpId, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/public-ips/{publicIpId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "publicIpId" + "}", + localVarApiClient.escapeString(publicIpId.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 deletePublicIPValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID publicIpId, + 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 deletePublicIP(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling deletePublicIP(Async)"); + } + + // verify the required parameter 'publicIpId' is set + if (publicIpId == null) { + throw new ApiException( + "Missing the required parameter 'publicIpId' when calling deletePublicIP(Async)"); + } + + return deletePublicIPCall(projectId, region, publicIpId, _callback); + } + + /** + * Delete a public IP. Delete a public IP that is part of the project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param publicIpId The identifier (ID) of a Public IP. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 The public IP has been deleted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public void deletePublicIP( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID publicIpId) + throws ApiException { + deletePublicIPWithHttpInfo(projectId, region, publicIpId); + } + + /** + * Delete a public IP. Delete a public IP that is part of the project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param publicIpId The identifier (ID) of a Public IP. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 The public IP has been deleted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse deletePublicIPWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID publicIpId) + throws ApiException { + okhttp3.Call localVarCall = + deletePublicIPValidateBeforeCall(projectId, region, publicIpId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete a public IP. (asynchronously) Delete a public IP that is part of the project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param publicIpId The identifier (ID) of a Public IP. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 The public IP has been deleted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call deletePublicIPAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID publicIpId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + deletePublicIPValidateBeforeCall(projectId, region, publicIpId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for deleteRouteFromRoutingTable + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @param routeId The identifier (ID) of a STACKIT Route. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Delete request for the route has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call deleteRouteFromRoutingTableCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nonnull UUID routeId, + 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 = + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}/routes/{routeId}" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "areaId" + "}", + localVarApiClient.escapeString(areaId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "routingTableId" + "}", + localVarApiClient.escapeString(routingTableId.toString())) + .replace( + "{" + "routeId" + "}", + localVarApiClient.escapeString(routeId.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 deleteRouteFromRoutingTableValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nonnull UUID routeId, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling deleteRouteFromRoutingTable(Async)"); + } + + // verify the required parameter 'areaId' is set + if (areaId == null) { + throw new ApiException( + "Missing the required parameter 'areaId' when calling deleteRouteFromRoutingTable(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling deleteRouteFromRoutingTable(Async)"); + } + + // verify the required parameter 'routingTableId' is set + if (routingTableId == null) { + throw new ApiException( + "Missing the required parameter 'routingTableId' when calling deleteRouteFromRoutingTable(Async)"); + } + + // verify the required parameter 'routeId' is set + if (routeId == null) { + throw new ApiException( + "Missing the required parameter 'routeId' when calling deleteRouteFromRoutingTable(Async)"); + } + + return deleteRouteFromRoutingTableCall( + organizationId, areaId, region, routingTableId, routeId, _callback); + } + + /** + * Delete a route in a routing table. Delete a route in an existing routing table. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @param routeId The identifier (ID) of a STACKIT Route. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Delete request for the route has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public void deleteRouteFromRoutingTable( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nonnull UUID routeId) + throws ApiException { + deleteRouteFromRoutingTableWithHttpInfo( + organizationId, areaId, region, routingTableId, routeId); + } + + /** + * Delete a route in a routing table. Delete a route in an existing routing table. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @param routeId The identifier (ID) of a STACKIT Route. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Delete request for the route has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse deleteRouteFromRoutingTableWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nonnull UUID routeId) + throws ApiException { + okhttp3.Call localVarCall = + deleteRouteFromRoutingTableValidateBeforeCall( + organizationId, areaId, region, routingTableId, routeId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete a route in a routing table. (asynchronously) Delete a route in an existing routing + * table. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @param routeId The identifier (ID) of a STACKIT Route. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Delete request for the route has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call deleteRouteFromRoutingTableAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nonnull UUID routeId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + deleteRouteFromRoutingTableValidateBeforeCall( + organizationId, areaId, region, routingTableId, routeId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for deleteRoutingTableFromArea + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Delete request for the routing table has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call deleteRoutingTableFromAreaCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + 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 = + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "areaId" + "}", + localVarApiClient.escapeString(areaId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "routingTableId" + "}", + localVarApiClient.escapeString(routingTableId.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 deleteRoutingTableFromAreaValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling deleteRoutingTableFromArea(Async)"); + } + + // verify the required parameter 'areaId' is set + if (areaId == null) { + throw new ApiException( + "Missing the required parameter 'areaId' when calling deleteRoutingTableFromArea(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling deleteRoutingTableFromArea(Async)"); + } + + // verify the required parameter 'routingTableId' is set + if (routingTableId == null) { + throw new ApiException( + "Missing the required parameter 'routingTableId' when calling deleteRoutingTableFromArea(Async)"); + } + + return deleteRoutingTableFromAreaCall( + organizationId, areaId, region, routingTableId, _callback); + } + + /** + * Delete a routing table. Delete a routing table of a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Delete request for the routing table has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public void deleteRoutingTableFromArea( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId) + throws ApiException { + deleteRoutingTableFromAreaWithHttpInfo(organizationId, areaId, region, routingTableId); + } + + /** + * Delete a routing table. Delete a routing table of a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Delete request for the routing table has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse deleteRoutingTableFromAreaWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId) + throws ApiException { + okhttp3.Call localVarCall = + deleteRoutingTableFromAreaValidateBeforeCall( + organizationId, areaId, region, routingTableId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete a routing table. (asynchronously) Delete a routing table of a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Delete request for the routing table has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call deleteRoutingTableFromAreaAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + deleteRoutingTableFromAreaValidateBeforeCall( + organizationId, areaId, region, routingTableId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for deleteSecurityGroup + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security 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
204 Delete request for security group has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call deleteSecurityGroupCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID securityGroupId, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/security-groups/{securityGroupId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "securityGroupId" + "}", + localVarApiClient.escapeString(securityGroupId.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 deleteSecurityGroupValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID securityGroupId, + 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 deleteSecurityGroup(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling deleteSecurityGroup(Async)"); + } + + // verify the required parameter 'securityGroupId' is set + if (securityGroupId == null) { + throw new ApiException( + "Missing the required parameter 'securityGroupId' when calling deleteSecurityGroup(Async)"); + } + + return deleteSecurityGroupCall(projectId, region, securityGroupId, _callback); + } + + /** + * Delete security group. Delete a security group. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security Group. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Delete request for security group has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public void deleteSecurityGroup( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID securityGroupId) + throws ApiException { + deleteSecurityGroupWithHttpInfo(projectId, region, securityGroupId); + } + + /** + * Delete security group. Delete a security group. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security Group. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Delete request for security group has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse deleteSecurityGroupWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID securityGroupId) + throws ApiException { + okhttp3.Call localVarCall = + deleteSecurityGroupValidateBeforeCall(projectId, region, securityGroupId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete security group. (asynchronously) Delete a security group. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security 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
204 Delete request for security group has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call deleteSecurityGroupAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID securityGroupId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + deleteSecurityGroupValidateBeforeCall( + projectId, region, securityGroupId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for deleteSecurityGroupRule + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security Group. (required) + * @param securityGroupRuleId The identifier (ID) of a STACKIT Security Group Rule. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Delete request for security group rule has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call deleteSecurityGroupRuleCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID securityGroupId, + @javax.annotation.Nonnull UUID securityGroupRuleId, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/security-groups/{securityGroupId}/rules/{securityGroupRuleId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "securityGroupId" + "}", + localVarApiClient.escapeString(securityGroupId.toString())) + .replace( + "{" + "securityGroupRuleId" + "}", + localVarApiClient.escapeString(securityGroupRuleId.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 deleteSecurityGroupRuleValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID securityGroupId, + @javax.annotation.Nonnull UUID securityGroupRuleId, + 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 deleteSecurityGroupRule(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling deleteSecurityGroupRule(Async)"); + } + + // verify the required parameter 'securityGroupId' is set + if (securityGroupId == null) { + throw new ApiException( + "Missing the required parameter 'securityGroupId' when calling deleteSecurityGroupRule(Async)"); + } + + // verify the required parameter 'securityGroupRuleId' is set + if (securityGroupRuleId == null) { + throw new ApiException( + "Missing the required parameter 'securityGroupRuleId' when calling deleteSecurityGroupRule(Async)"); + } + + return deleteSecurityGroupRuleCall( + projectId, region, securityGroupId, securityGroupRuleId, _callback); + } + + /** + * Delete security group rule. Delete a security group rule. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security Group. (required) + * @param securityGroupRuleId The identifier (ID) of a STACKIT Security Group Rule. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Delete request for security group rule has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public void deleteSecurityGroupRule( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID securityGroupId, + @javax.annotation.Nonnull UUID securityGroupRuleId) + throws ApiException { + deleteSecurityGroupRuleWithHttpInfo( + projectId, region, securityGroupId, securityGroupRuleId); + } + + /** + * Delete security group rule. Delete a security group rule. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security Group. (required) + * @param securityGroupRuleId The identifier (ID) of a STACKIT Security Group Rule. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Delete request for security group rule has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse deleteSecurityGroupRuleWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID securityGroupId, + @javax.annotation.Nonnull UUID securityGroupRuleId) + throws ApiException { + okhttp3.Call localVarCall = + deleteSecurityGroupRuleValidateBeforeCall( + projectId, region, securityGroupId, securityGroupRuleId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete security group rule. (asynchronously) Delete a security group rule. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security Group. (required) + * @param securityGroupRuleId The identifier (ID) of a STACKIT Security Group Rule. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Delete request for security group rule has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call deleteSecurityGroupRuleAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID securityGroupId, + @javax.annotation.Nonnull UUID securityGroupRuleId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + deleteSecurityGroupRuleValidateBeforeCall( + projectId, region, securityGroupId, securityGroupRuleId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for deleteServer + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Delete request for server accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call deleteServerCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "DELETE", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteServerValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'projectId' is set + if (projectId == null) { + throw new ApiException( + "Missing the required parameter 'projectId' when calling deleteServer(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling deleteServer(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling deleteServer(Async)"); + } + + return deleteServerCall(projectId, region, serverId, _callback); + } + + /** + * Delete a server. Delete a server. Volumes won't be deleted. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Delete request for server accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public void deleteServer( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId) + throws ApiException { + deleteServerWithHttpInfo(projectId, region, serverId); + } + + /** + * Delete a server. Delete a server. Volumes won't be deleted. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Delete request for server accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse deleteServerWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId) + throws ApiException { + okhttp3.Call localVarCall = + deleteServerValidateBeforeCall(projectId, region, serverId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete a server. (asynchronously) Delete a server. Volumes won't be deleted. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Delete request for server accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call deleteServerAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + deleteServerValidateBeforeCall(projectId, region, serverId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for deleteVolume + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @param cascade Cascade action. (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
204 Volume delete request has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call deleteVolumeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID volumeId, + @javax.annotation.Nullable Boolean cascade, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/volumes/{volumeId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "volumeId" + "}", + localVarApiClient.escapeString(volumeId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (cascade != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("cascade", cascade)); + } + + 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 deleteVolumeValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID volumeId, + @javax.annotation.Nullable Boolean cascade, + 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 deleteVolume(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling deleteVolume(Async)"); + } + + // verify the required parameter 'volumeId' is set + if (volumeId == null) { + throw new ApiException( + "Missing the required parameter 'volumeId' when calling deleteVolume(Async)"); + } + + return deleteVolumeCall(projectId, region, volumeId, cascade, _callback); + } + + /** + * Delete a volume. Delete a volume inside a project. The deletion will fail if the volume is + * still in use. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @param cascade Cascade action. (optional, default to false) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Volume delete request has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public void deleteVolume( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID volumeId, + @javax.annotation.Nullable Boolean cascade) + throws ApiException { + deleteVolumeWithHttpInfo(projectId, region, volumeId, cascade); + } + + /** + * Delete a volume. Delete a volume inside a project. The deletion will fail if the volume is + * still in use. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @param cascade Cascade action. (optional, default to false) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Volume delete request has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse deleteVolumeWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID volumeId, + @javax.annotation.Nullable Boolean cascade) + throws ApiException { + okhttp3.Call localVarCall = + deleteVolumeValidateBeforeCall(projectId, region, volumeId, cascade, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete a volume. (asynchronously) Delete a volume inside a project. The deletion will fail if + * the volume is still in use. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @param cascade Cascade action. (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
204 Volume delete request has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call deleteVolumeAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID volumeId, + @javax.annotation.Nullable Boolean cascade, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + deleteVolumeValidateBeforeCall(projectId, region, volumeId, cascade, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for getAffinityGroup + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param affinityGroupId The identifier (ID) of a STACKIT Affinity 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 Show affinity group details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getAffinityGroupCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID affinityGroupId, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/affinity-groups/{affinityGroupId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "affinityGroupId" + "}", + localVarApiClient.escapeString(affinityGroupId.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 getAffinityGroupValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID affinityGroupId, + 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 getAffinityGroup(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling getAffinityGroup(Async)"); + } + + // verify the required parameter 'affinityGroupId' is set + if (affinityGroupId == null) { + throw new ApiException( + "Missing the required parameter 'affinityGroupId' when calling getAffinityGroup(Async)"); + } + + return getAffinityGroupCall(projectId, region, affinityGroupId, _callback); + } + + /** + * Get the affinity group. Get the affinity group created in a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param affinityGroupId The identifier (ID) of a STACKIT Affinity Group. (required) + * @return AffinityGroup + * @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 Show affinity group details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public AffinityGroup getAffinityGroup( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID affinityGroupId) + throws ApiException { + ApiResponse localVarResp = + getAffinityGroupWithHttpInfo(projectId, region, affinityGroupId); + return localVarResp.getData(); + } + + /** + * Get the affinity group. Get the affinity group created in a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param affinityGroupId The identifier (ID) of a STACKIT Affinity Group. (required) + * @return ApiResponse<AffinityGroup> + * @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 Show affinity group details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse getAffinityGroupWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID affinityGroupId) + throws ApiException { + okhttp3.Call localVarCall = + getAffinityGroupValidateBeforeCall(projectId, region, affinityGroupId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get the affinity group. (asynchronously) Get the affinity group created in a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param affinityGroupId The identifier (ID) of a STACKIT Affinity 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 Show affinity group details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getAffinityGroupAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID affinityGroupId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getAffinityGroupValidateBeforeCall(projectId, region, affinityGroupId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getAttachedVolume + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (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 Get details about a volume attachment. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getAttachedVolumeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID volumeId, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/volume-attachments/{volumeId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())) + .replace( + "{" + "volumeId" + "}", + localVarApiClient.escapeString(volumeId.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 getAttachedVolumeValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID volumeId, + 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 getAttachedVolume(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling getAttachedVolume(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling getAttachedVolume(Async)"); + } + + // verify the required parameter 'volumeId' is set + if (volumeId == null) { + throw new ApiException( + "Missing the required parameter 'volumeId' when calling getAttachedVolume(Async)"); + } + + return getAttachedVolumeCall(projectId, region, serverId, volumeId, _callback); + } + + /** + * Get Volume Attachment details. Get the details of an existing Volume Attachment. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @return VolumeAttachment + * @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 Get details about a volume attachment. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public VolumeAttachment getAttachedVolume( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID volumeId) + throws ApiException { + ApiResponse localVarResp = + getAttachedVolumeWithHttpInfo(projectId, region, serverId, volumeId); + return localVarResp.getData(); + } + + /** + * Get Volume Attachment details. Get the details of an existing Volume Attachment. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @return ApiResponse<VolumeAttachment> + * @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 Get details about a volume attachment. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse getAttachedVolumeWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID volumeId) + throws ApiException { + okhttp3.Call localVarCall = + getAttachedVolumeValidateBeforeCall(projectId, region, serverId, volumeId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Volume Attachment details. (asynchronously) Get the details of an existing Volume + * Attachment. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (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 Get details about a volume attachment. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getAttachedVolumeAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID volumeId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getAttachedVolumeValidateBeforeCall( + projectId, region, serverId, volumeId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getBackup + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param backupId The identifier (ID) of a STACKIT Backup. (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 Show backup details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getBackupCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID backupId, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/backups/{backupId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "backupId" + "}", + localVarApiClient.escapeString(backupId.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 getBackupValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID backupId, + 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 getBackup(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling getBackup(Async)"); + } + + // verify the required parameter 'backupId' is set + if (backupId == null) { + throw new ApiException( + "Missing the required parameter 'backupId' when calling getBackup(Async)"); + } + + return getBackupCall(projectId, region, backupId, _callback); + } + + /** + * Get details about a backup. Get details about a block device backup. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param backupId The identifier (ID) of a STACKIT Backup. (required) + * @return Backup + * @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 Show backup details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public Backup getBackup( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID backupId) + throws ApiException { + ApiResponse localVarResp = getBackupWithHttpInfo(projectId, region, backupId); + return localVarResp.getData(); + } + + /** + * Get details about a backup. Get details about a block device backup. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param backupId The identifier (ID) of a STACKIT Backup. (required) + * @return ApiResponse<Backup> + * @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 Show backup details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse getBackupWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID backupId) + throws ApiException { + okhttp3.Call localVarCall = getBackupValidateBeforeCall(projectId, region, backupId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get details about a backup. (asynchronously) Get details about a block device backup. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param backupId The identifier (ID) of a STACKIT Backup. (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 Show backup details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getBackupAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID backupId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getBackupValidateBeforeCall(projectId, region, backupId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getImage + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (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 Show Image details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getImageCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID imageId, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/images/{imageId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "imageId" + "}", + localVarApiClient.escapeString(imageId.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 getImageValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID imageId, + 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 getImage(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling getImage(Async)"); + } + + // verify the required parameter 'imageId' is set + if (imageId == null) { + throw new ApiException( + "Missing the required parameter 'imageId' when calling getImage(Async)"); + } + + return getImageCall(projectId, region, imageId, _callback); + } + + /** + * Get details about an image. Get details about a specific Image inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @return Image + * @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 Show Image details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public Image getImage( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID imageId) + throws ApiException { + ApiResponse localVarResp = getImageWithHttpInfo(projectId, region, imageId); + return localVarResp.getData(); + } + + /** + * Get details about an image. Get details about a specific Image inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @return ApiResponse<Image> + * @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 Show Image details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse getImageWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID imageId) + throws ApiException { + okhttp3.Call localVarCall = getImageValidateBeforeCall(projectId, region, imageId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get details about an image. (asynchronously) Get details about a specific Image inside a + * project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (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 Show Image details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getImageAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID imageId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getImageValidateBeforeCall(projectId, region, imageId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getImageShare + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (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 Show Image share details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getImageShareCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID imageId, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/images/{imageId}/share" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "imageId" + "}", + localVarApiClient.escapeString(imageId.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 getImageShareValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID imageId, + 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 getImageShare(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling getImageShare(Async)"); + } + + // verify the required parameter 'imageId' is set + if (imageId == null) { + throw new ApiException( + "Missing the required parameter 'imageId' when calling getImageShare(Async)"); + } + + return getImageShareCall(projectId, region, imageId, _callback); + } + + /** + * Get share details of an image. Get share details about an shared image. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @return ImageShare + * @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 Show Image share details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ImageShare getImageShare( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID imageId) + throws ApiException { + ApiResponse localVarResp = + getImageShareWithHttpInfo(projectId, region, imageId); + return localVarResp.getData(); + } + + /** + * Get share details of an image. Get share details about an shared image. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @return ApiResponse<ImageShare> + * @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 Show Image share details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse getImageShareWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID imageId) + throws ApiException { + okhttp3.Call localVarCall = + getImageShareValidateBeforeCall(projectId, region, imageId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get share details of an image. (asynchronously) Get share details about an shared image. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (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 Show Image share details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getImageShareAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID imageId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getImageShareValidateBeforeCall(projectId, region, imageId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getImageShareConsumer + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @param consumerProjectId The identifier (ID) of a STACKIT Project that consumes an image + * share. (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 Show Image share consumer details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getImageShareConsumerCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID imageId, + @javax.annotation.Nonnull UUID consumerProjectId, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/images/{imageId}/share/{consumerProjectId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "imageId" + "}", + localVarApiClient.escapeString(imageId.toString())) + .replace( + "{" + "consumerProjectId" + "}", + localVarApiClient.escapeString(consumerProjectId.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 getImageShareConsumerValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID imageId, + @javax.annotation.Nonnull UUID consumerProjectId, + 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 getImageShareConsumer(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling getImageShareConsumer(Async)"); + } + + // verify the required parameter 'imageId' is set + if (imageId == null) { + throw new ApiException( + "Missing the required parameter 'imageId' when calling getImageShareConsumer(Async)"); + } + + // verify the required parameter 'consumerProjectId' is set + if (consumerProjectId == null) { + throw new ApiException( + "Missing the required parameter 'consumerProjectId' when calling getImageShareConsumer(Async)"); + } + + return getImageShareConsumerCall(projectId, region, imageId, consumerProjectId, _callback); + } + + /** + * Get image share consumer. Get details about an image share consumer. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @param consumerProjectId The identifier (ID) of a STACKIT Project that consumes an image + * share. (required) + * @return ImageShareConsumer + * @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 Show Image share consumer details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ImageShareConsumer getImageShareConsumer( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID imageId, + @javax.annotation.Nonnull UUID consumerProjectId) + throws ApiException { + ApiResponse localVarResp = + getImageShareConsumerWithHttpInfo(projectId, region, imageId, consumerProjectId); + return localVarResp.getData(); + } + + /** + * Get image share consumer. Get details about an image share consumer. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @param consumerProjectId The identifier (ID) of a STACKIT Project that consumes an image + * share. (required) + * @return ApiResponse<ImageShareConsumer> + * @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 Show Image share consumer details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse getImageShareConsumerWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID imageId, + @javax.annotation.Nonnull UUID consumerProjectId) + throws ApiException { + okhttp3.Call localVarCall = + getImageShareConsumerValidateBeforeCall( + projectId, region, imageId, consumerProjectId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get image share consumer. (asynchronously) Get details about an image share consumer. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @param consumerProjectId The identifier (ID) of a STACKIT Project that consumes an image + * share. (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 Show Image share consumer details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getImageShareConsumerAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID imageId, + @javax.annotation.Nonnull UUID consumerProjectId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getImageShareConsumerValidateBeforeCall( + projectId, region, imageId, consumerProjectId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getKeyPair + * + * @param keypairName The name of an SSH keypair. (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 Show SSH keypair details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getKeyPairCall( + @javax.annotation.Nonnull String keypairName, 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 = + "/v2beta1/keypairs/{keypairName}" + .replace( + "{" + "keypairName" + "}", + localVarApiClient.escapeString(keypairName.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 getKeyPairValidateBeforeCall( + @javax.annotation.Nonnull String keypairName, final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'keypairName' is set + if (keypairName == null) { + throw new ApiException( + "Missing the required parameter 'keypairName' when calling getKeyPair(Async)"); + } + + return getKeyPairCall(keypairName, _callback); + } + + /** + * Get SSH keypair details. Get details about an SSH keypair. + * + * @param keypairName The name of an SSH keypair. (required) + * @return Keypair + * @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 Show SSH keypair details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public Keypair getKeyPair(@javax.annotation.Nonnull String keypairName) throws ApiException { + ApiResponse localVarResp = getKeyPairWithHttpInfo(keypairName); + return localVarResp.getData(); + } + + /** + * Get SSH keypair details. Get details about an SSH keypair. + * + * @param keypairName The name of an SSH keypair. (required) + * @return ApiResponse<Keypair> + * @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 Show SSH keypair details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse getKeyPairWithHttpInfo(@javax.annotation.Nonnull String keypairName) + throws ApiException { + okhttp3.Call localVarCall = getKeyPairValidateBeforeCall(keypairName, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get SSH keypair details. (asynchronously) Get details about an SSH keypair. + * + * @param keypairName The name of an SSH keypair. (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 Show SSH keypair details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getKeyPairAsync( + @javax.annotation.Nonnull String keypairName, final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = getKeyPairValidateBeforeCall(keypairName, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getMachineType + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param machineType STACKIT machine type Name. (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 Show machine type details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getMachineTypeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull String machineType, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/machine-types/{machineType}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "machineType" + "}", + localVarApiClient.escapeString(machineType.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 getMachineTypeValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull String machineType, + 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 getMachineType(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling getMachineType(Async)"); + } + + // verify the required parameter 'machineType' is set + if (machineType == null) { + throw new ApiException( + "Missing the required parameter 'machineType' when calling getMachineType(Async)"); + } + + return getMachineTypeCall(projectId, region, machineType, _callback); + } + + /** + * Get details about a machine type. Get details about a specific machine type. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param machineType STACKIT machine type Name. (required) + * @return MachineType + * @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 Show machine type details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public MachineType getMachineType( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull String machineType) + throws ApiException { + ApiResponse localVarResp = + getMachineTypeWithHttpInfo(projectId, region, machineType); + return localVarResp.getData(); + } + + /** + * Get details about a machine type. Get details about a specific machine type. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param machineType STACKIT machine type Name. (required) + * @return ApiResponse<MachineType> + * @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 Show machine type details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse getMachineTypeWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull String machineType) + throws ApiException { + okhttp3.Call localVarCall = + getMachineTypeValidateBeforeCall(projectId, region, machineType, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get details about a machine type. (asynchronously) Get details about a specific machine type. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param machineType STACKIT machine type Name. (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 Show machine type details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getMachineTypeAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull String machineType, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getMachineTypeValidateBeforeCall(projectId, region, machineType, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getNetwork + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (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 Show network details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getNetworkCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/networks/{networkId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "networkId" + "}", + localVarApiClient.escapeString(networkId.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 getNetworkValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId, + 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 getNetwork(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling getNetwork(Async)"); + } + + // verify the required parameter 'networkId' is set + if (networkId == null) { + throw new ApiException( + "Missing the required parameter 'networkId' when calling getNetwork(Async)"); + } + + return getNetworkCall(projectId, region, networkId, _callback); + } + + /** + * Get network details. Get details about a network of a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @return Network + * @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 Show network details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public Network getNetwork( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId) + throws ApiException { + ApiResponse localVarResp = getNetworkWithHttpInfo(projectId, region, networkId); + return localVarResp.getData(); + } + + /** + * Get network details. Get details about a network of a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @return ApiResponse<Network> + * @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 Show network details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse getNetworkWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId) + throws ApiException { + okhttp3.Call localVarCall = + getNetworkValidateBeforeCall(projectId, region, networkId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get network details. (asynchronously) Get details about a network of a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (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 Show network details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getNetworkAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getNetworkValidateBeforeCall(projectId, region, networkId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getNetworkArea + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (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 Show network area details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getNetworkAreaCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + 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 = + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "areaId" + "}", + localVarApiClient.escapeString(areaId.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 getNetworkAreaValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling getNetworkArea(Async)"); + } + + // verify the required parameter 'areaId' is set + if (areaId == null) { + throw new ApiException( + "Missing the required parameter 'areaId' when calling getNetworkArea(Async)"); + } + + return getNetworkAreaCall(organizationId, areaId, _callback); + } + + /** + * Get details about a network area. Get details about a network area in an organization. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @return NetworkArea + * @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 Show network area details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public NetworkArea getNetworkArea( + @javax.annotation.Nonnull UUID organizationId, @javax.annotation.Nonnull UUID areaId) + throws ApiException { + ApiResponse localVarResp = getNetworkAreaWithHttpInfo(organizationId, areaId); + return localVarResp.getData(); + } + + /** + * Get details about a network area. Get details about a network area in an organization. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @return ApiResponse<NetworkArea> + * @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 Show network area details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse getNetworkAreaWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, @javax.annotation.Nonnull UUID areaId) + throws ApiException { + okhttp3.Call localVarCall = getNetworkAreaValidateBeforeCall(organizationId, areaId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get details about a network area. (asynchronously) Get details about a network area in an + * organization. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (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 Show network area details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getNetworkAreaAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getNetworkAreaValidateBeforeCall(organizationId, areaId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getNetworkAreaRange + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param networkRangeId The identifier (ID) of a STACKIT Network Range. (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 Show network range details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getNetworkAreaRangeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkRangeId, + 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 = + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/network-ranges/{networkRangeId}" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "areaId" + "}", + localVarApiClient.escapeString(areaId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "networkRangeId" + "}", + localVarApiClient.escapeString(networkRangeId.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 getNetworkAreaRangeValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkRangeId, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling getNetworkAreaRange(Async)"); + } + + // verify the required parameter 'areaId' is set + if (areaId == null) { + throw new ApiException( + "Missing the required parameter 'areaId' when calling getNetworkAreaRange(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling getNetworkAreaRange(Async)"); + } + + // verify the required parameter 'networkRangeId' is set + if (networkRangeId == null) { + throw new ApiException( + "Missing the required parameter 'networkRangeId' when calling getNetworkAreaRange(Async)"); + } + + return getNetworkAreaRangeCall(organizationId, areaId, region, networkRangeId, _callback); + } + + /** + * Get details about a network range. Get details about a network range in a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param networkRangeId The identifier (ID) of a STACKIT Network Range. (required) + * @return NetworkRange + * @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 Show network range details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public NetworkRange getNetworkAreaRange( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkRangeId) + throws ApiException { + ApiResponse localVarResp = + getNetworkAreaRangeWithHttpInfo(organizationId, areaId, region, networkRangeId); + return localVarResp.getData(); + } + + /** + * Get details about a network range. Get details about a network range in a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param networkRangeId The identifier (ID) of a STACKIT Network Range. (required) + * @return ApiResponse<NetworkRange> + * @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 Show network range details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse getNetworkAreaRangeWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkRangeId) + throws ApiException { + okhttp3.Call localVarCall = + getNetworkAreaRangeValidateBeforeCall( + organizationId, areaId, region, networkRangeId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get details about a network range. (asynchronously) Get details about a network range in a + * network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param networkRangeId The identifier (ID) of a STACKIT Network Range. (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 Show network range details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getNetworkAreaRangeAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkRangeId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getNetworkAreaRangeValidateBeforeCall( + organizationId, areaId, region, networkRangeId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getNetworkAreaRoute + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routeId The identifier (ID) of a STACKIT Route. (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 Show route details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getNetworkAreaRouteCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routeId, + 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 = + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routes/{routeId}" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "areaId" + "}", + localVarApiClient.escapeString(areaId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "routeId" + "}", + localVarApiClient.escapeString(routeId.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 getNetworkAreaRouteValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routeId, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling getNetworkAreaRoute(Async)"); + } + + // verify the required parameter 'areaId' is set + if (areaId == null) { + throw new ApiException( + "Missing the required parameter 'areaId' when calling getNetworkAreaRoute(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling getNetworkAreaRoute(Async)"); + } + + // verify the required parameter 'routeId' is set + if (routeId == null) { + throw new ApiException( + "Missing the required parameter 'routeId' when calling getNetworkAreaRoute(Async)"); + } + + return getNetworkAreaRouteCall(organizationId, areaId, region, routeId, _callback); + } + + /** + * Get details about a network route. Get details about a network route defined in a network + * area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routeId The identifier (ID) of a STACKIT Route. (required) + * @return Route + * @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 Show route details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public Route getNetworkAreaRoute( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routeId) + throws ApiException { + ApiResponse localVarResp = + getNetworkAreaRouteWithHttpInfo(organizationId, areaId, region, routeId); + return localVarResp.getData(); + } + + /** + * Get details about a network route. Get details about a network route defined in a network + * area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routeId The identifier (ID) of a STACKIT Route. (required) + * @return ApiResponse<Route> + * @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 Show route details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse getNetworkAreaRouteWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routeId) + throws ApiException { + okhttp3.Call localVarCall = + getNetworkAreaRouteValidateBeforeCall( + organizationId, areaId, region, routeId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get details about a network route. (asynchronously) Get details about a network route defined + * in a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routeId The identifier (ID) of a STACKIT Route. (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 Show route details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getNetworkAreaRouteAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routeId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getNetworkAreaRouteValidateBeforeCall( + organizationId, areaId, region, routeId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getNic + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param nicId The identifier (ID) of a network interface. (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 Show network interface details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getNicCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull UUID nicId, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/networks/{networkId}/nics/{nicId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "networkId" + "}", + localVarApiClient.escapeString(networkId.toString())) + .replace( + "{" + "nicId" + "}", + localVarApiClient.escapeString(nicId.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 getNicValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull UUID nicId, + 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 getNic(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling getNic(Async)"); + } + + // verify the required parameter 'networkId' is set + if (networkId == null) { + throw new ApiException( + "Missing the required parameter 'networkId' when calling getNic(Async)"); + } + + // verify the required parameter 'nicId' is set + if (nicId == null) { + throw new ApiException( + "Missing the required parameter 'nicId' when calling getNic(Async)"); + } + + return getNicCall(projectId, region, networkId, nicId, _callback); + } + + /** + * Get details about a network interface. Get details about a network interface inside a + * network. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param nicId The identifier (ID) of a network interface. (required) + * @return NIC + * @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 Show network interface details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public NIC getNic( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull UUID nicId) + throws ApiException { + ApiResponse localVarResp = getNicWithHttpInfo(projectId, region, networkId, nicId); + return localVarResp.getData(); + } + + /** + * Get details about a network interface. Get details about a network interface inside a + * network. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param nicId The identifier (ID) of a network interface. (required) + * @return ApiResponse<NIC> + * @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 Show network interface details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse getNicWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull UUID nicId) + throws ApiException { + okhttp3.Call localVarCall = + getNicValidateBeforeCall(projectId, region, networkId, nicId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get details about a network interface. (asynchronously) Get details about a network interface + * inside a network. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param nicId The identifier (ID) of a network interface. (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 Show network interface details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getNicAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull UUID nicId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getNicValidateBeforeCall(projectId, region, networkId, nicId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getOrganizationRequest + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param requestId The identifier (ID) of a STACKIT Request. (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 Show organization request details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getOrganizationRequestCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull String requestId, + 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 = + "/v2beta1/organizations/{organizationId}/requests/{requestId}" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "requestId" + "}", + localVarApiClient.escapeString(requestId.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 getOrganizationRequestValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull String requestId, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling getOrganizationRequest(Async)"); + } + + // verify the required parameter 'requestId' is set + if (requestId == null) { + throw new ApiException( + "Missing the required parameter 'requestId' when calling getOrganizationRequest(Async)"); + } + + return getOrganizationRequestCall(organizationId, requestId, _callback); + } + + /** + * Lookup an organization request ID. Lookup an organization request ID from a previous request. + * This allows to find resource IDs of resources generated during a organization request. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param requestId The identifier (ID) of a STACKIT Request. (required) + * @return Request + * @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 Show organization request details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public Request getOrganizationRequest( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull String requestId) + throws ApiException { + ApiResponse localVarResp = + getOrganizationRequestWithHttpInfo(organizationId, requestId); + return localVarResp.getData(); + } + + /** + * Lookup an organization request ID. Lookup an organization request ID from a previous request. + * This allows to find resource IDs of resources generated during a organization request. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param requestId The identifier (ID) of a STACKIT Request. (required) + * @return ApiResponse<Request> + * @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 Show organization request details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse getOrganizationRequestWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull String requestId) + throws ApiException { + okhttp3.Call localVarCall = + getOrganizationRequestValidateBeforeCall(organizationId, requestId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Lookup an organization request ID. (asynchronously) Lookup an organization request ID from a + * previous request. This allows to find resource IDs of resources generated during a + * organization request. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param requestId The identifier (ID) of a STACKIT Request. (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 Show organization request details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getOrganizationRequestAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull String requestId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getOrganizationRequestValidateBeforeCall(organizationId, requestId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getProjectDetails + * + * @param projectId The identifier (ID) of a STACKIT Project. (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 Show project details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getProjectDetailsCall( + @javax.annotation.Nonnull UUID 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 = + "/v2beta1/projects/{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 getProjectDetailsValidateBeforeCall( + @javax.annotation.Nonnull UUID 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 getProjectDetails(Async)"); + } + + return getProjectDetailsCall(projectId, _callback); + } + + /** + * Get project details. Get details about a STACKIT project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @return Project + * @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 Show project details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public Project getProjectDetails(@javax.annotation.Nonnull UUID projectId) throws ApiException { + ApiResponse localVarResp = getProjectDetailsWithHttpInfo(projectId); + return localVarResp.getData(); + } + + /** + * Get project details. Get details about a STACKIT project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @return ApiResponse<Project> + * @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 Show project details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse getProjectDetailsWithHttpInfo( + @javax.annotation.Nonnull UUID projectId) throws ApiException { + okhttp3.Call localVarCall = getProjectDetailsValidateBeforeCall(projectId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get project details. (asynchronously) Get details about a STACKIT project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (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 Show project details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getProjectDetailsAsync( + @javax.annotation.Nonnull UUID projectId, final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = getProjectDetailsValidateBeforeCall(projectId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getProjectNIC + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param nicId The identifier (ID) of a network interface. (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 Show details of network interface. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getProjectNICCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID nicId, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/nics/{nicId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "nicId" + "}", + localVarApiClient.escapeString(nicId.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 getProjectNICValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID nicId, + 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 getProjectNIC(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling getProjectNIC(Async)"); + } + + // verify the required parameter 'nicId' is set + if (nicId == null) { + throw new ApiException( + "Missing the required parameter 'nicId' when calling getProjectNIC(Async)"); + } + + return getProjectNICCall(projectId, region, nicId, _callback); + } + + /** + * Get details about a network interface of a project. Get details about a network interface + * inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param nicId The identifier (ID) of a network interface. (required) + * @return NIC + * @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 Show details of network interface. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public NIC getProjectNIC( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID nicId) + throws ApiException { + ApiResponse localVarResp = getProjectNICWithHttpInfo(projectId, region, nicId); + return localVarResp.getData(); + } + + /** + * Get details about a network interface of a project. Get details about a network interface + * inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param nicId The identifier (ID) of a network interface. (required) + * @return ApiResponse<NIC> + * @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 Show details of network interface. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse getProjectNICWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID nicId) + throws ApiException { + okhttp3.Call localVarCall = getProjectNICValidateBeforeCall(projectId, region, nicId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get details about a network interface of a project. (asynchronously) Get details about a + * network interface inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param nicId The identifier (ID) of a network interface. (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 Show details of network interface. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getProjectNICAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID nicId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getProjectNICValidateBeforeCall(projectId, region, nicId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getProjectRequest + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param requestId The identifier (ID) of a STACKIT Request. (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 Show project request details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getProjectRequestCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull String requestId, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/requests/{requestId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "requestId" + "}", + localVarApiClient.escapeString(requestId.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 getProjectRequestValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull String requestId, + 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 getProjectRequest(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling getProjectRequest(Async)"); + } + + // verify the required parameter 'requestId' is set + if (requestId == null) { + throw new ApiException( + "Missing the required parameter 'requestId' when calling getProjectRequest(Async)"); + } + + return getProjectRequestCall(projectId, region, requestId, _callback); + } + + /** + * Lookup a project request ID. Lookup a project request ID from a previous request. This allows + * to find resource IDs of resources generated during a projects request. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param requestId The identifier (ID) of a STACKIT Request. (required) + * @return Request + * @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 Show project request details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public Request getProjectRequest( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull String requestId) + throws ApiException { + ApiResponse localVarResp = + getProjectRequestWithHttpInfo(projectId, region, requestId); + return localVarResp.getData(); + } + + /** + * Lookup a project request ID. Lookup a project request ID from a previous request. This allows + * to find resource IDs of resources generated during a projects request. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param requestId The identifier (ID) of a STACKIT Request. (required) + * @return ApiResponse<Request> + * @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 Show project request details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse getProjectRequestWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull String requestId) + throws ApiException { + okhttp3.Call localVarCall = + getProjectRequestValidateBeforeCall(projectId, region, requestId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Lookup a project request ID. (asynchronously) Lookup a project request ID from a previous + * request. This allows to find resource IDs of resources generated during a projects request. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param requestId The identifier (ID) of a STACKIT Request. (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 Show project request details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getProjectRequestAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull String requestId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getProjectRequestValidateBeforeCall(projectId, region, requestId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getPublicIP + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param publicIpId The identifier (ID) of a Public IP. (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 Show public IP details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getPublicIPCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID publicIpId, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/public-ips/{publicIpId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "publicIpId" + "}", + localVarApiClient.escapeString(publicIpId.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 getPublicIPValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID publicIpId, + 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 getPublicIP(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling getPublicIP(Async)"); + } + + // verify the required parameter 'publicIpId' is set + if (publicIpId == null) { + throw new ApiException( + "Missing the required parameter 'publicIpId' when calling getPublicIP(Async)"); + } + + return getPublicIPCall(projectId, region, publicIpId, _callback); + } + + /** + * Get details about a public IP. Get details about a public IP inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param publicIpId The identifier (ID) of a Public IP. (required) + * @return PublicIp + * @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 Show public IP details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public PublicIp getPublicIP( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID publicIpId) + throws ApiException { + ApiResponse localVarResp = getPublicIPWithHttpInfo(projectId, region, publicIpId); + return localVarResp.getData(); + } + + /** + * Get details about a public IP. Get details about a public IP inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param publicIpId The identifier (ID) of a Public IP. (required) + * @return ApiResponse<PublicIp> + * @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 Show public IP details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse getPublicIPWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID publicIpId) + throws ApiException { + okhttp3.Call localVarCall = + getPublicIPValidateBeforeCall(projectId, region, publicIpId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get details about a public IP. (asynchronously) Get details about a public IP inside a + * project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param publicIpId The identifier (ID) of a Public IP. (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 Show public IP details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getPublicIPAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID publicIpId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getPublicIPValidateBeforeCall(projectId, region, publicIpId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getRouteOfRoutingTable + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @param routeId The identifier (ID) of a STACKIT Route. (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 Show the details of a route in a routing table. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getRouteOfRoutingTableCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nonnull UUID routeId, + 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 = + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}/routes/{routeId}" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "areaId" + "}", + localVarApiClient.escapeString(areaId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "routingTableId" + "}", + localVarApiClient.escapeString(routingTableId.toString())) + .replace( + "{" + "routeId" + "}", + localVarApiClient.escapeString(routeId.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 getRouteOfRoutingTableValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nonnull UUID routeId, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling getRouteOfRoutingTable(Async)"); + } + + // verify the required parameter 'areaId' is set + if (areaId == null) { + throw new ApiException( + "Missing the required parameter 'areaId' when calling getRouteOfRoutingTable(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling getRouteOfRoutingTable(Async)"); + } + + // verify the required parameter 'routingTableId' is set + if (routingTableId == null) { + throw new ApiException( + "Missing the required parameter 'routingTableId' when calling getRouteOfRoutingTable(Async)"); + } + + // verify the required parameter 'routeId' is set + if (routeId == null) { + throw new ApiException( + "Missing the required parameter 'routeId' when calling getRouteOfRoutingTable(Async)"); + } + + return getRouteOfRoutingTableCall( + organizationId, areaId, region, routingTableId, routeId, _callback); + } + + /** + * Get details about a route of a routing table. Get details about a route defined in a routing + * table. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @param routeId The identifier (ID) of a STACKIT Route. (required) + * @return Route + * @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 Show the details of a route in a routing table. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public Route getRouteOfRoutingTable( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nonnull UUID routeId) + throws ApiException { + ApiResponse localVarResp = + getRouteOfRoutingTableWithHttpInfo( + organizationId, areaId, region, routingTableId, routeId); + return localVarResp.getData(); + } + + /** + * Get details about a route of a routing table. Get details about a route defined in a routing + * table. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @param routeId The identifier (ID) of a STACKIT Route. (required) + * @return ApiResponse<Route> + * @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 Show the details of a route in a routing table. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse getRouteOfRoutingTableWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nonnull UUID routeId) + throws ApiException { + okhttp3.Call localVarCall = + getRouteOfRoutingTableValidateBeforeCall( + organizationId, areaId, region, routingTableId, routeId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get details about a route of a routing table. (asynchronously) Get details about a route + * defined in a routing table. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @param routeId The identifier (ID) of a STACKIT Route. (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 Show the details of a route in a routing table. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getRouteOfRoutingTableAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nonnull UUID routeId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getRouteOfRoutingTableValidateBeforeCall( + organizationId, areaId, region, routingTableId, routeId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getRoutingTableOfArea + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (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 Show routing table details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getRoutingTableOfAreaCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + 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 = + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "areaId" + "}", + localVarApiClient.escapeString(areaId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "routingTableId" + "}", + localVarApiClient.escapeString(routingTableId.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 getRoutingTableOfAreaValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling getRoutingTableOfArea(Async)"); + } + + // verify the required parameter 'areaId' is set + if (areaId == null) { + throw new ApiException( + "Missing the required parameter 'areaId' when calling getRoutingTableOfArea(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling getRoutingTableOfArea(Async)"); + } + + // verify the required parameter 'routingTableId' is set + if (routingTableId == null) { + throw new ApiException( + "Missing the required parameter 'routingTableId' when calling getRoutingTableOfArea(Async)"); + } + + return getRoutingTableOfAreaCall(organizationId, areaId, region, routingTableId, _callback); + } + + /** + * Get details about a routing table. Get details about a routing table defined in a network + * area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @return RoutingTable + * @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 Show routing table details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public RoutingTable getRoutingTableOfArea( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId) + throws ApiException { + ApiResponse localVarResp = + getRoutingTableOfAreaWithHttpInfo(organizationId, areaId, region, routingTableId); + return localVarResp.getData(); + } + + /** + * Get details about a routing table. Get details about a routing table defined in a network + * area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @return ApiResponse<RoutingTable> + * @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 Show routing table details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse getRoutingTableOfAreaWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId) + throws ApiException { + okhttp3.Call localVarCall = + getRoutingTableOfAreaValidateBeforeCall( + organizationId, areaId, region, routingTableId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get details about a routing table. (asynchronously) Get details about a routing table defined + * in a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (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 Show routing table details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getRoutingTableOfAreaAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getRoutingTableOfAreaValidateBeforeCall( + organizationId, areaId, region, routingTableId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getSecurityGroup + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security 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 Show security group details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getSecurityGroupCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID securityGroupId, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/security-groups/{securityGroupId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "securityGroupId" + "}", + localVarApiClient.escapeString(securityGroupId.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 getSecurityGroupValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID securityGroupId, + 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 getSecurityGroup(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling getSecurityGroup(Async)"); + } + + // verify the required parameter 'securityGroupId' is set + if (securityGroupId == null) { + throw new ApiException( + "Missing the required parameter 'securityGroupId' when calling getSecurityGroup(Async)"); + } + + return getSecurityGroupCall(projectId, region, securityGroupId, _callback); + } + + /** + * Get security group details. Get details about a security group of a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security Group. (required) + * @return SecurityGroup + * @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 Show security group details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public SecurityGroup getSecurityGroup( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID securityGroupId) + throws ApiException { + ApiResponse localVarResp = + getSecurityGroupWithHttpInfo(projectId, region, securityGroupId); + return localVarResp.getData(); + } + + /** + * Get security group details. Get details about a security group of a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security Group. (required) + * @return ApiResponse<SecurityGroup> + * @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 Show security group details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse getSecurityGroupWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID securityGroupId) + throws ApiException { + okhttp3.Call localVarCall = + getSecurityGroupValidateBeforeCall(projectId, region, securityGroupId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get security group details. (asynchronously) Get details about a security group of a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security 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 Show security group details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getSecurityGroupAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID securityGroupId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getSecurityGroupValidateBeforeCall(projectId, region, securityGroupId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getSecurityGroupRule + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security Group. (required) + * @param securityGroupRuleId The identifier (ID) of a STACKIT Security Group Rule. (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 Show security group rule details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getSecurityGroupRuleCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID securityGroupId, + @javax.annotation.Nonnull UUID securityGroupRuleId, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/security-groups/{securityGroupId}/rules/{securityGroupRuleId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "securityGroupId" + "}", + localVarApiClient.escapeString(securityGroupId.toString())) + .replace( + "{" + "securityGroupRuleId" + "}", + localVarApiClient.escapeString(securityGroupRuleId.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 getSecurityGroupRuleValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID securityGroupId, + @javax.annotation.Nonnull UUID securityGroupRuleId, + 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 getSecurityGroupRule(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling getSecurityGroupRule(Async)"); + } + + // verify the required parameter 'securityGroupId' is set + if (securityGroupId == null) { + throw new ApiException( + "Missing the required parameter 'securityGroupId' when calling getSecurityGroupRule(Async)"); + } + + // verify the required parameter 'securityGroupRuleId' is set + if (securityGroupRuleId == null) { + throw new ApiException( + "Missing the required parameter 'securityGroupRuleId' when calling getSecurityGroupRule(Async)"); + } + + return getSecurityGroupRuleCall( + projectId, region, securityGroupId, securityGroupRuleId, _callback); + } + + /** + * Get security group rule details. Get details about a security group rule of a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security Group. (required) + * @param securityGroupRuleId The identifier (ID) of a STACKIT Security Group Rule. (required) + * @return SecurityGroupRule + * @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 Show security group rule details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public SecurityGroupRule getSecurityGroupRule( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID securityGroupId, + @javax.annotation.Nonnull UUID securityGroupRuleId) + throws ApiException { + ApiResponse localVarResp = + getSecurityGroupRuleWithHttpInfo( + projectId, region, securityGroupId, securityGroupRuleId); + return localVarResp.getData(); + } + + /** + * Get security group rule details. Get details about a security group rule of a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security Group. (required) + * @param securityGroupRuleId The identifier (ID) of a STACKIT Security Group Rule. (required) + * @return ApiResponse<SecurityGroupRule> + * @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 Show security group rule details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse getSecurityGroupRuleWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID securityGroupId, + @javax.annotation.Nonnull UUID securityGroupRuleId) + throws ApiException { + okhttp3.Call localVarCall = + getSecurityGroupRuleValidateBeforeCall( + projectId, region, securityGroupId, securityGroupRuleId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get security group rule details. (asynchronously) Get details about a security group rule of + * a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security Group. (required) + * @param securityGroupRuleId The identifier (ID) of a STACKIT Security Group Rule. (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 Show security group rule details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getSecurityGroupRuleAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID securityGroupId, + @javax.annotation.Nonnull UUID securityGroupRuleId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getSecurityGroupRuleValidateBeforeCall( + projectId, region, securityGroupId, securityGroupRuleId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getServer + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param details Show detailed information about server. (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
200 Show server details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getServerCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nullable Boolean details, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (details != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("details", details)); + } + + 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 getServerValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nullable Boolean details, + 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 getServer(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling getServer(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling getServer(Async)"); + } + + return getServerCall(projectId, region, serverId, details, _callback); + } + + /** + * Get server details. Get details about a server by its ID. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param details Show detailed information about server. (optional, default to false) + * @return Server + * @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 Show server details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public Server getServer( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nullable Boolean details) + throws ApiException { + ApiResponse localVarResp = + getServerWithHttpInfo(projectId, region, serverId, details); + return localVarResp.getData(); + } + + /** + * Get server details. Get details about a server by its ID. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param details Show detailed information about server. (optional, default to false) + * @return ApiResponse<Server> + * @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 Show server details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse getServerWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nullable Boolean details) + throws ApiException { + okhttp3.Call localVarCall = + getServerValidateBeforeCall(projectId, region, serverId, details, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get server details. (asynchronously) Get details about a server by its ID. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param details Show detailed information about server. (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
200 Show server details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getServerAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nullable Boolean details, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getServerValidateBeforeCall(projectId, region, serverId, details, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getServerConsole + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (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 Show server console URL. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getServerConsoleCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/console" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getServerConsoleValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'projectId' is set + if (projectId == null) { + throw new ApiException( + "Missing the required parameter 'projectId' when calling getServerConsole(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling getServerConsole(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling getServerConsole(Async)"); + } + + return getServerConsoleCall(projectId, region, serverId, _callback); + } + + /** + * Get server console. Get a URL for server remote console. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @return ServerConsoleUrl + * @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 Show server console URL. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ServerConsoleUrl getServerConsole( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId) + throws ApiException { + ApiResponse localVarResp = + getServerConsoleWithHttpInfo(projectId, region, serverId); + return localVarResp.getData(); + } + + /** + * Get server console. Get a URL for server remote console. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @return ApiResponse<ServerConsoleUrl> + * @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 Show server console URL. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse getServerConsoleWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId) + throws ApiException { + okhttp3.Call localVarCall = + getServerConsoleValidateBeforeCall(projectId, region, serverId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get server console. (asynchronously) Get a URL for server remote console. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (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 Show server console URL. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getServerConsoleAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getServerConsoleValidateBeforeCall(projectId, region, serverId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getServerLog + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param length Request the server log. By default the length is limited to 2000 lines. Set to + * 0 to retrieve the complete log. (optional, default to 2000) + * @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 Show server console log. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getServerLogCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nullable Long length, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/log" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (length != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("length", length)); + } + + 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 getServerLogValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nullable Long length, + 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 getServerLog(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling getServerLog(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling getServerLog(Async)"); + } + + return getServerLogCall(projectId, region, serverId, length, _callback); + } + + /** + * Get server log. Get server console log. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param length Request the server log. By default the length is limited to 2000 lines. Set to + * 0 to retrieve the complete log. (optional, default to 2000) + * @return GetServerLog200Response + * @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 Show server console log. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public GetServerLog200Response getServerLog( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nullable Long length) + throws ApiException { + ApiResponse localVarResp = + getServerLogWithHttpInfo(projectId, region, serverId, length); + return localVarResp.getData(); + } + + /** + * Get server log. Get server console log. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param length Request the server log. By default the length is limited to 2000 lines. Set to + * 0 to retrieve the complete log. (optional, default to 2000) + * @return ApiResponse<GetServerLog200Response> + * @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 Show server console log. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse getServerLogWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nullable Long length) + throws ApiException { + okhttp3.Call localVarCall = + getServerLogValidateBeforeCall(projectId, region, serverId, length, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get server log. (asynchronously) Get server console log. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param length Request the server log. By default the length is limited to 2000 lines. Set to + * 0 to retrieve the complete log. (optional, default to 2000) + * @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 Show server console log. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getServerLogAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nullable Long length, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getServerLogValidateBeforeCall(projectId, region, serverId, length, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getVolume + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (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 Show volume details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getVolumeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID volumeId, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/volumes/{volumeId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "volumeId" + "}", + localVarApiClient.escapeString(volumeId.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 getVolumeValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID volumeId, + 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 getVolume(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling getVolume(Async)"); + } + + // verify the required parameter 'volumeId' is set + if (volumeId == null) { + throw new ApiException( + "Missing the required parameter 'volumeId' when calling getVolume(Async)"); + } + + return getVolumeCall(projectId, region, volumeId, _callback); + } + + /** + * Get details about a volume. Get details about a block device volume. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @return Volume + * @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 Show volume details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public Volume getVolume( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID volumeId) + throws ApiException { + ApiResponse localVarResp = getVolumeWithHttpInfo(projectId, region, volumeId); + return localVarResp.getData(); + } + + /** + * Get details about a volume. Get details about a block device volume. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @return ApiResponse<Volume> + * @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 Show volume details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse getVolumeWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID volumeId) + throws ApiException { + okhttp3.Call localVarCall = getVolumeValidateBeforeCall(projectId, region, volumeId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get details about a volume. (asynchronously) Get details about a block device volume. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (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 Show volume details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getVolumeAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID volumeId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getVolumeValidateBeforeCall(projectId, region, volumeId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for getVolumePerformanceClass + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param volumePerformanceClass The name of a STACKIT Volume performance class. (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 Show volume performance class details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getVolumePerformanceClassCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull String volumePerformanceClass, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/volume-performance-classes/{volumePerformanceClass}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "volumePerformanceClass" + "}", + localVarApiClient.escapeString(volumePerformanceClass.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 getVolumePerformanceClassValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull String volumePerformanceClass, + 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 getVolumePerformanceClass(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling getVolumePerformanceClass(Async)"); + } + + // verify the required parameter 'volumePerformanceClass' is set + if (volumePerformanceClass == null) { + throw new ApiException( + "Missing the required parameter 'volumePerformanceClass' when calling getVolumePerformanceClass(Async)"); + } + + return getVolumePerformanceClassCall(projectId, region, volumePerformanceClass, _callback); + } + + /** + * Get details about a volume performance class. Get details about a specific volume performance + * class. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param volumePerformanceClass The name of a STACKIT Volume performance class. (required) + * @return VolumePerformanceClass + * @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 Show volume performance class details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public VolumePerformanceClass getVolumePerformanceClass( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull String volumePerformanceClass) + throws ApiException { + ApiResponse localVarResp = + getVolumePerformanceClassWithHttpInfo(projectId, region, volumePerformanceClass); + return localVarResp.getData(); + } + + /** + * Get details about a volume performance class. Get details about a specific volume performance + * class. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param volumePerformanceClass The name of a STACKIT Volume performance class. (required) + * @return ApiResponse<VolumePerformanceClass> + * @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 Show volume performance class details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse getVolumePerformanceClassWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull String volumePerformanceClass) + throws ApiException { + okhttp3.Call localVarCall = + getVolumePerformanceClassValidateBeforeCall( + projectId, region, volumePerformanceClass, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get details about a volume performance class. (asynchronously) Get details about a specific + * volume performance class. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param volumePerformanceClass The name of a STACKIT Volume performance class. (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 Show volume performance class details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call getVolumePerformanceClassAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull String volumePerformanceClass, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + getVolumePerformanceClassValidateBeforeCall( + projectId, region, volumePerformanceClass, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listAffinityGroups + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (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 List affinity groups. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listAffinityGroupsCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/affinity-groups" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {}; + 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 listAffinityGroupsValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + 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 listAffinityGroups(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling listAffinityGroups(Async)"); + } + + return listAffinityGroupsCall(projectId, region, _callback); + } + + /** + * Get the affinity groups setup for a project. Get the affinity groups created in a project. + * Affinity groups are an indication of locality of a server relative to another group of + * servers. They can be either running on the same host (affinity) or on different ones + * (anti-affinity). + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @return AffinityGroupListResponse + * @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 List affinity groups. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public AffinityGroupListResponse listAffinityGroups( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull String region) + throws ApiException { + ApiResponse localVarResp = + listAffinityGroupsWithHttpInfo(projectId, region); + return localVarResp.getData(); + } + + /** + * Get the affinity groups setup for a project. Get the affinity groups created in a project. + * Affinity groups are an indication of locality of a server relative to another group of + * servers. They can be either running on the same host (affinity) or on different ones + * (anti-affinity). + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @return ApiResponse<AffinityGroupListResponse> + * @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 List affinity groups. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse listAffinityGroupsWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull String region) + throws ApiException { + okhttp3.Call localVarCall = listAffinityGroupsValidateBeforeCall(projectId, region, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get the affinity groups setup for a project. (asynchronously) Get the affinity groups created + * in a project. Affinity groups are an indication of locality of a server relative to another + * group of servers. They can be either running on the same host (affinity) or on different ones + * (anti-affinity). + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (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 List affinity groups. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listAffinityGroupsAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listAffinityGroupsValidateBeforeCall(projectId, region, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listAttachedVolumes + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (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 List volume attachments. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listAttachedVolumesCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/volume-attachments" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call listAttachedVolumesValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'projectId' is set + if (projectId == null) { + throw new ApiException( + "Missing the required parameter 'projectId' when calling listAttachedVolumes(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling listAttachedVolumes(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling listAttachedVolumes(Async)"); + } + + return listAttachedVolumesCall(projectId, region, serverId, _callback); + } + + /** + * List all volume attachments of a server. Get a list of all volume attachments of a server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @return VolumeAttachmentListResponse + * @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 List volume attachments. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public VolumeAttachmentListResponse listAttachedVolumes( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId) + throws ApiException { + ApiResponse localVarResp = + listAttachedVolumesWithHttpInfo(projectId, region, serverId); + return localVarResp.getData(); + } + + /** + * List all volume attachments of a server. Get a list of all volume attachments of a server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @return ApiResponse<VolumeAttachmentListResponse> + * @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 List volume attachments. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse listAttachedVolumesWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId) + throws ApiException { + okhttp3.Call localVarCall = + listAttachedVolumesValidateBeforeCall(projectId, region, serverId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List all volume attachments of a server. (asynchronously) Get a list of all volume + * attachments of a server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (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 List volume attachments. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listAttachedVolumesAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listAttachedVolumesValidateBeforeCall(projectId, region, serverId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listAvailabilityZones + * + * @param region The STACKIT Region of the resources. (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 Get a list of availability zones. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listAvailabilityZonesCall( + @javax.annotation.Nonnull String region, 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 = + "/v2beta1/regions/{region}/availability-zones" + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {}; + 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 listAvailabilityZonesValidateBeforeCall( + @javax.annotation.Nonnull String region, final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling listAvailabilityZones(Async)"); + } + + return listAvailabilityZonesCall(region, _callback); + } + + /** + * List all availability zones. Get a list of all availability zones. + * + * @param region The STACKIT Region of the resources. (required) + * @return AvailabilityZoneListResponse + * @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 Get a list of availability zones. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public AvailabilityZoneListResponse listAvailabilityZones( + @javax.annotation.Nonnull String region) throws ApiException { + ApiResponse localVarResp = + listAvailabilityZonesWithHttpInfo(region); + return localVarResp.getData(); + } + + /** + * List all availability zones. Get a list of all availability zones. + * + * @param region The STACKIT Region of the resources. (required) + * @return ApiResponse<AvailabilityZoneListResponse> + * @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 Get a list of availability zones. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse listAvailabilityZonesWithHttpInfo( + @javax.annotation.Nonnull String region) throws ApiException { + okhttp3.Call localVarCall = listAvailabilityZonesValidateBeforeCall(region, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List all availability zones. (asynchronously) Get a list of all availability zones. + * + * @param region The STACKIT Region of the resources. (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 Get a list of availability zones. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listAvailabilityZonesAsync( + @javax.annotation.Nonnull String region, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = listAvailabilityZonesValidateBeforeCall(region, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listBackups + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param labelSelector Filter resources by labels. (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 List project backups. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listBackupsCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/backups" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (labelSelector != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("label_selector", labelSelector)); + } + + 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 listBackupsValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector, + 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 listBackups(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling listBackups(Async)"); + } + + return listBackupsCall(projectId, region, labelSelector, _callback); + } + + /** + * List all backups inside a project. Get a list of all backups inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return BackupListResponse + * @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 List project backups. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public BackupListResponse listBackups( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + ApiResponse localVarResp = + listBackupsWithHttpInfo(projectId, region, labelSelector); + return localVarResp.getData(); + } + + /** + * List all backups inside a project. Get a list of all backups inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return ApiResponse<BackupListResponse> + * @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 List project backups. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse listBackupsWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + okhttp3.Call localVarCall = + listBackupsValidateBeforeCall(projectId, region, labelSelector, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List all backups inside a project. (asynchronously) Get a list of all backups inside a + * project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param labelSelector Filter resources by labels. (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 List project backups. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listBackupsAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listBackupsValidateBeforeCall(projectId, region, labelSelector, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listImages + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param all List all Images. (optional, default to false) + * @param labelSelector Filter resources by labels. (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 List project images. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listImagesCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable Boolean all, + @javax.annotation.Nullable String labelSelector, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/images" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (all != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("all", all)); + } + + if (labelSelector != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("label_selector", labelSelector)); + } + + 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 listImagesValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable Boolean all, + @javax.annotation.Nullable String labelSelector, + 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 listImages(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling listImages(Async)"); + } + + return listImagesCall(projectId, region, all, labelSelector, _callback); + } + + /** + * List all Images inside a project. Get a list of all images inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param all List all Images. (optional, default to false) + * @param labelSelector Filter resources by labels. (optional) + * @return ImageListResponse + * @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 List project images. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ImageListResponse listImages( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable Boolean all, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + ApiResponse localVarResp = + listImagesWithHttpInfo(projectId, region, all, labelSelector); + return localVarResp.getData(); + } + + /** + * List all Images inside a project. Get a list of all images inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param all List all Images. (optional, default to false) + * @param labelSelector Filter resources by labels. (optional) + * @return ApiResponse<ImageListResponse> + * @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 List project images. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse listImagesWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable Boolean all, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + okhttp3.Call localVarCall = + listImagesValidateBeforeCall(projectId, region, all, labelSelector, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List all Images inside a project. (asynchronously) Get a list of all images inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param all List all Images. (optional, default to false) + * @param labelSelector Filter resources by labels. (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 List project images. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listImagesAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable Boolean all, + @javax.annotation.Nullable String labelSelector, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listImagesValidateBeforeCall(projectId, region, all, labelSelector, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listKeyPairs + * + * @param labelSelector Filter resources by labels. (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 List SSH keypairs. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listKeyPairsCall( + @javax.annotation.Nullable String labelSelector, 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 = "/v2beta1/keypairs"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (labelSelector != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("label_selector", labelSelector)); + } + + 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 listKeyPairsValidateBeforeCall( + @javax.annotation.Nullable String labelSelector, final ApiCallback _callback) + throws ApiException { + return listKeyPairsCall(labelSelector, _callback); + } + + /** + * List all SSH keypairs for the requesting user. Get a list of all SSH keypairs assigned to the + * requesting user. + * + * @param labelSelector Filter resources by labels. (optional) + * @return KeyPairListResponse + * @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 List SSH keypairs. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public KeyPairListResponse listKeyPairs(@javax.annotation.Nullable String labelSelector) + throws ApiException { + ApiResponse localVarResp = listKeyPairsWithHttpInfo(labelSelector); + return localVarResp.getData(); + } + + /** + * List all SSH keypairs for the requesting user. Get a list of all SSH keypairs assigned to the + * requesting user. + * + * @param labelSelector Filter resources by labels. (optional) + * @return ApiResponse<KeyPairListResponse> + * @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 List SSH keypairs. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse listKeyPairsWithHttpInfo( + @javax.annotation.Nullable String labelSelector) throws ApiException { + okhttp3.Call localVarCall = listKeyPairsValidateBeforeCall(labelSelector, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List all SSH keypairs for the requesting user. (asynchronously) Get a list of all SSH + * keypairs assigned to the requesting user. + * + * @param labelSelector Filter resources by labels. (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 List SSH keypairs. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listKeyPairsAsync( + @javax.annotation.Nullable String labelSelector, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = listKeyPairsValidateBeforeCall(labelSelector, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listMachineTypes + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param filter Filter resources by fields. A subset of expr-lang is supported. See + * https://expr-lang.org/docs/language-definition for usage details. (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 List of machine types. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listMachineTypesCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String filter, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/machine-types" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (filter != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("filter", filter)); + } + + 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 listMachineTypesValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String filter, + 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 listMachineTypes(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling listMachineTypes(Async)"); + } + + return listMachineTypesCall(projectId, region, filter, _callback); + } + + /** + * List all machine types available for a project. Get a list of all machine type available in a + * project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param filter Filter resources by fields. A subset of expr-lang is supported. See + * https://expr-lang.org/docs/language-definition for usage details. (optional) + * @return MachineTypeListResponse + * @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 List of machine types. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public MachineTypeListResponse listMachineTypes( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String filter) + throws ApiException { + ApiResponse localVarResp = + listMachineTypesWithHttpInfo(projectId, region, filter); + return localVarResp.getData(); + } + + /** + * List all machine types available for a project. Get a list of all machine type available in a + * project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param filter Filter resources by fields. A subset of expr-lang is supported. See + * https://expr-lang.org/docs/language-definition for usage details. (optional) + * @return ApiResponse<MachineTypeListResponse> + * @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 List of machine types. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse listMachineTypesWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String filter) + throws ApiException { + okhttp3.Call localVarCall = + listMachineTypesValidateBeforeCall(projectId, region, filter, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List all machine types available for a project. (asynchronously) Get a list of all machine + * type available in a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param filter Filter resources by fields. A subset of expr-lang is supported. See + * https://expr-lang.org/docs/language-definition for usage details. (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 List of machine types. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listMachineTypesAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String filter, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listMachineTypesValidateBeforeCall(projectId, region, filter, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listNetworkAreaProjects + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (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 List projects for a network area. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listNetworkAreaProjectsCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + 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 = + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/projects" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "areaId" + "}", + localVarApiClient.escapeString(areaId.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 listNetworkAreaProjectsValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling listNetworkAreaProjects(Async)"); + } + + // verify the required parameter 'areaId' is set + if (areaId == null) { + throw new ApiException( + "Missing the required parameter 'areaId' when calling listNetworkAreaProjects(Async)"); + } + + return listNetworkAreaProjectsCall(organizationId, areaId, _callback); + } + + /** + * List all projects using a network area. Get a list of all projects using a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @return ProjectListResponse + * @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 List projects for a network area. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ProjectListResponse listNetworkAreaProjects( + @javax.annotation.Nonnull UUID organizationId, @javax.annotation.Nonnull UUID areaId) + throws ApiException { + ApiResponse localVarResp = + listNetworkAreaProjectsWithHttpInfo(organizationId, areaId); + return localVarResp.getData(); + } + + /** + * List all projects using a network area. Get a list of all projects using a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @return ApiResponse<ProjectListResponse> + * @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 List projects for a network area. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse listNetworkAreaProjectsWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, @javax.annotation.Nonnull UUID areaId) + throws ApiException { + okhttp3.Call localVarCall = + listNetworkAreaProjectsValidateBeforeCall(organizationId, areaId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List all projects using a network area. (asynchronously) Get a list of all projects using a + * network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (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 List projects for a network area. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listNetworkAreaProjectsAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listNetworkAreaProjectsValidateBeforeCall(organizationId, areaId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listNetworkAreaRanges + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (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 List all network ranges. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listNetworkAreaRangesCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + 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 = + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/network-ranges" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "areaId" + "}", + localVarApiClient.escapeString(areaId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {}; + 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 listNetworkAreaRangesValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling listNetworkAreaRanges(Async)"); + } + + // verify the required parameter 'areaId' is set + if (areaId == null) { + throw new ApiException( + "Missing the required parameter 'areaId' when calling listNetworkAreaRanges(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling listNetworkAreaRanges(Async)"); + } + + return listNetworkAreaRangesCall(organizationId, areaId, region, _callback); + } + + /** + * List all network ranges in a network area. Get a list of all network ranges in a network + * area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @return NetworkRangeListResponse + * @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 List all network ranges. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public NetworkRangeListResponse listNetworkAreaRanges( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region) + throws ApiException { + ApiResponse localVarResp = + listNetworkAreaRangesWithHttpInfo(organizationId, areaId, region); + return localVarResp.getData(); + } + + /** + * List all network ranges in a network area. Get a list of all network ranges in a network + * area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @return ApiResponse<NetworkRangeListResponse> + * @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 List all network ranges. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse listNetworkAreaRangesWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region) + throws ApiException { + okhttp3.Call localVarCall = + listNetworkAreaRangesValidateBeforeCall(organizationId, areaId, region, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List all network ranges in a network area. (asynchronously) Get a list of all network ranges + * in a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (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 List all network ranges. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listNetworkAreaRangesAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listNetworkAreaRangesValidateBeforeCall(organizationId, areaId, region, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listNetworkAreaRoutes + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param labelSelector Filter resources by labels. (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 List network routes. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listNetworkAreaRoutesCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector, + 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 = + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routes" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "areaId" + "}", + localVarApiClient.escapeString(areaId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (labelSelector != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("label_selector", labelSelector)); + } + + 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 listNetworkAreaRoutesValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling listNetworkAreaRoutes(Async)"); + } + + // verify the required parameter 'areaId' is set + if (areaId == null) { + throw new ApiException( + "Missing the required parameter 'areaId' when calling listNetworkAreaRoutes(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling listNetworkAreaRoutes(Async)"); + } + + return listNetworkAreaRoutesCall(organizationId, areaId, region, labelSelector, _callback); + } + + /** + * List all network routes in a network area. Get a list of all network routes defined in a + * network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return RouteListResponse + * @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 List network routes. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public RouteListResponse listNetworkAreaRoutes( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + ApiResponse localVarResp = + listNetworkAreaRoutesWithHttpInfo(organizationId, areaId, region, labelSelector); + return localVarResp.getData(); + } + + /** + * List all network routes in a network area. Get a list of all network routes defined in a + * network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return ApiResponse<RouteListResponse> + * @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 List network routes. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse listNetworkAreaRoutesWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + okhttp3.Call localVarCall = + listNetworkAreaRoutesValidateBeforeCall( + organizationId, areaId, region, labelSelector, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List all network routes in a network area. (asynchronously) Get a list of all network routes + * defined in a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param labelSelector Filter resources by labels. (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 List network routes. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listNetworkAreaRoutesAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listNetworkAreaRoutesValidateBeforeCall( + organizationId, areaId, region, labelSelector, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listNetworkAreas + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param labelSelector Filter resources by labels. (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 Get a list of all network areas. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listNetworkAreasCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nullable String labelSelector, + 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 = + "/v2beta1/organizations/{organizationId}/network-areas" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (labelSelector != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("label_selector", labelSelector)); + } + + 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 listNetworkAreasValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nullable String labelSelector, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling listNetworkAreas(Async)"); + } + + return listNetworkAreasCall(organizationId, labelSelector, _callback); + } + + /** + * List all network areas in an organization. Get a list of all visible network areas defined in + * an organization. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return NetworkAreaListResponse + * @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 Get a list of all network areas. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public NetworkAreaListResponse listNetworkAreas( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + ApiResponse localVarResp = + listNetworkAreasWithHttpInfo(organizationId, labelSelector); + return localVarResp.getData(); + } + + /** + * List all network areas in an organization. Get a list of all visible network areas defined in + * an organization. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return ApiResponse<NetworkAreaListResponse> + * @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 Get a list of all network areas. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse listNetworkAreasWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + okhttp3.Call localVarCall = + listNetworkAreasValidateBeforeCall(organizationId, labelSelector, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List all network areas in an organization. (asynchronously) Get a list of all visible network + * areas defined in an organization. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param labelSelector Filter resources by labels. (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 Get a list of all network areas. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listNetworkAreasAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nullable String labelSelector, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listNetworkAreasValidateBeforeCall(organizationId, labelSelector, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listNetworks + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param labelSelector Filter resources by labels. (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 List all networks of a project. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listNetworksCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/networks" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (labelSelector != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("label_selector", labelSelector)); + } + + 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 listNetworksValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector, + 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 listNetworks(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling listNetworks(Async)"); + } + + return listNetworksCall(projectId, region, labelSelector, _callback); + } + + /** + * List all networks inside a project. Get a list of all networks inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return NetworkListResponse + * @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 List all networks of a project. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public NetworkListResponse listNetworks( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + ApiResponse localVarResp = + listNetworksWithHttpInfo(projectId, region, labelSelector); + return localVarResp.getData(); + } + + /** + * List all networks inside a project. Get a list of all networks inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return ApiResponse<NetworkListResponse> + * @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 List all networks of a project. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse listNetworksWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + okhttp3.Call localVarCall = + listNetworksValidateBeforeCall(projectId, region, labelSelector, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List all networks inside a project. (asynchronously) Get a list of all networks inside a + * project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param labelSelector Filter resources by labels. (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 List all networks of a project. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listNetworksAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listNetworksValidateBeforeCall(projectId, region, labelSelector, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listNics + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param labelSelector Filter resources by labels. (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 List project network interfaces. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listNicsCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nullable String labelSelector, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/networks/{networkId}/nics" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "networkId" + "}", + localVarApiClient.escapeString(networkId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (labelSelector != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("label_selector", labelSelector)); + } + + 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 listNicsValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nullable String labelSelector, + 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 listNics(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling listNics(Async)"); + } + + // verify the required parameter 'networkId' is set + if (networkId == null) { + throw new ApiException( + "Missing the required parameter 'networkId' when calling listNics(Async)"); + } + + return listNicsCall(projectId, region, networkId, labelSelector, _callback); + } + + /** + * List all network interfaces inside a network. Get a list of all network interfaces inside a + * network. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return NICListResponse + * @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 List project network interfaces. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public NICListResponse listNics( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + ApiResponse localVarResp = + listNicsWithHttpInfo(projectId, region, networkId, labelSelector); + return localVarResp.getData(); + } + + /** + * List all network interfaces inside a network. Get a list of all network interfaces inside a + * network. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return ApiResponse<NICListResponse> + * @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 List project network interfaces. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse listNicsWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + okhttp3.Call localVarCall = + listNicsValidateBeforeCall(projectId, region, networkId, labelSelector, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List all network interfaces inside a network. (asynchronously) Get a list of all network + * interfaces inside a network. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param labelSelector Filter resources by labels. (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 List project network interfaces. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listNicsAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nullable String labelSelector, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listNicsValidateBeforeCall(projectId, region, networkId, labelSelector, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listProjectNICs + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param labelSelector Filter resources by labels. (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 List network interfaces of the project. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listProjectNICsCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/nics" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (labelSelector != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("label_selector", labelSelector)); + } + + 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 listProjectNICsValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector, + 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 listProjectNICs(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling listProjectNICs(Async)"); + } + + return listProjectNICsCall(projectId, region, labelSelector, _callback); + } + + /** + * List all network interfaces inside a project. Get a list of all network interfaces inside a + * project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return NICListResponse + * @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 List network interfaces of the project. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public NICListResponse listProjectNICs( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + ApiResponse localVarResp = + listProjectNICsWithHttpInfo(projectId, region, labelSelector); + return localVarResp.getData(); + } + + /** + * List all network interfaces inside a project. Get a list of all network interfaces inside a + * project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return ApiResponse<NICListResponse> + * @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 List network interfaces of the project. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse listProjectNICsWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + okhttp3.Call localVarCall = + listProjectNICsValidateBeforeCall(projectId, region, labelSelector, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List all network interfaces inside a project. (asynchronously) Get a list of all network + * interfaces inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param labelSelector Filter resources by labels. (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 List network interfaces of the project. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listProjectNICsAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listProjectNICsValidateBeforeCall(projectId, region, labelSelector, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listPublicIPRanges + * + * @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 List public IP ranges. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listPublicIPRangesCall(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 = "/v2beta1/networks/public-ip-ranges"; + + 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 listPublicIPRangesValidateBeforeCall(final ApiCallback _callback) + throws ApiException { + return listPublicIPRangesCall(_callback); + } + + /** + * List all public IP ranges. Get a list of all public IP ranges that STACKIT uses. + * + * @return PublicNetworkListResponse + * @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 List public IP ranges. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public PublicNetworkListResponse listPublicIPRanges() throws ApiException { + ApiResponse localVarResp = listPublicIPRangesWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * List all public IP ranges. Get a list of all public IP ranges that STACKIT uses. + * + * @return ApiResponse<PublicNetworkListResponse> + * @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 List public IP ranges. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse listPublicIPRangesWithHttpInfo() + throws ApiException { + okhttp3.Call localVarCall = listPublicIPRangesValidateBeforeCall(null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List all public IP ranges. (asynchronously) Get a list of all public IP ranges that STACKIT + * uses. + * + * @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 List public IP ranges. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listPublicIPRangesAsync( + final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = listPublicIPRangesValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listPublicIPs + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param labelSelector Filter resources by labels. (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 List project public IPs. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listPublicIPsCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/public-ips" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (labelSelector != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("label_selector", labelSelector)); + } + + 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 listPublicIPsValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector, + 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 listPublicIPs(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling listPublicIPs(Async)"); + } + + return listPublicIPsCall(projectId, region, labelSelector, _callback); + } + + /** + * List all public IPs inside a project. Get a list of all public IPs inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return PublicIpListResponse + * @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 List project public IPs. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public PublicIpListResponse listPublicIPs( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + ApiResponse localVarResp = + listPublicIPsWithHttpInfo(projectId, region, labelSelector); + return localVarResp.getData(); + } + + /** + * List all public IPs inside a project. Get a list of all public IPs inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return ApiResponse<PublicIpListResponse> + * @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 List project public IPs. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse listPublicIPsWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + okhttp3.Call localVarCall = + listPublicIPsValidateBeforeCall(projectId, region, labelSelector, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List all public IPs inside a project. (asynchronously) Get a list of all public IPs inside a + * project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param labelSelector Filter resources by labels. (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 List project public IPs. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listPublicIPsAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listPublicIPsValidateBeforeCall(projectId, region, labelSelector, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listQuotas + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (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 List quotas. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listQuotasCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/quotas" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {}; + 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 listQuotasValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + 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 listQuotas(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling listQuotas(Async)"); + } + + return listQuotasCall(projectId, region, _callback); + } + + /** + * List project quotas. List quota limits and usage for project resources. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @return QuotaListResponse + * @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 List quotas. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public QuotaListResponse listQuotas( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull String region) + throws ApiException { + ApiResponse localVarResp = listQuotasWithHttpInfo(projectId, region); + return localVarResp.getData(); + } + + /** + * List project quotas. List quota limits and usage for project resources. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @return ApiResponse<QuotaListResponse> + * @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 List quotas. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse listQuotasWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, @javax.annotation.Nonnull String region) + throws ApiException { + okhttp3.Call localVarCall = listQuotasValidateBeforeCall(projectId, region, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List project quotas. (asynchronously) List quota limits and usage for project resources. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (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 List quotas. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listQuotasAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = listQuotasValidateBeforeCall(projectId, region, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listRoutesOfRoutingTable + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @param labelSelector Filter resources by labels. (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 List all routing table routes. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listRoutesOfRoutingTableCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nullable String labelSelector, + 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 = + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}/routes" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "areaId" + "}", + localVarApiClient.escapeString(areaId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "routingTableId" + "}", + localVarApiClient.escapeString(routingTableId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (labelSelector != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("label_selector", labelSelector)); + } + + 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 listRoutesOfRoutingTableValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nullable String labelSelector, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling listRoutesOfRoutingTable(Async)"); + } + + // verify the required parameter 'areaId' is set + if (areaId == null) { + throw new ApiException( + "Missing the required parameter 'areaId' when calling listRoutesOfRoutingTable(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling listRoutesOfRoutingTable(Async)"); + } + + // verify the required parameter 'routingTableId' is set + if (routingTableId == null) { + throw new ApiException( + "Missing the required parameter 'routingTableId' when calling listRoutesOfRoutingTable(Async)"); + } + + return listRoutesOfRoutingTableCall( + organizationId, areaId, region, routingTableId, labelSelector, _callback); + } + + /** + * List all routes in a routing table. Get a list of all routes in a routing table. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return RouteListResponse + * @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 List all routing table routes. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public RouteListResponse listRoutesOfRoutingTable( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + ApiResponse localVarResp = + listRoutesOfRoutingTableWithHttpInfo( + organizationId, areaId, region, routingTableId, labelSelector); + return localVarResp.getData(); + } + + /** + * List all routes in a routing table. Get a list of all routes in a routing table. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return ApiResponse<RouteListResponse> + * @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 List all routing table routes. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse listRoutesOfRoutingTableWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + okhttp3.Call localVarCall = + listRoutesOfRoutingTableValidateBeforeCall( + organizationId, areaId, region, routingTableId, labelSelector, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List all routes in a routing table. (asynchronously) Get a list of all routes in a routing + * table. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @param labelSelector Filter resources by labels. (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 List all routing table routes. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listRoutesOfRoutingTableAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nullable String labelSelector, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listRoutesOfRoutingTableValidateBeforeCall( + organizationId, areaId, region, routingTableId, labelSelector, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listRoutingTablesOfArea + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param labelSelector Filter resources by labels. (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 List all routing tables. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listRoutingTablesOfAreaCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector, + 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 = + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "areaId" + "}", + localVarApiClient.escapeString(areaId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (labelSelector != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("label_selector", labelSelector)); + } + + 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 listRoutingTablesOfAreaValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling listRoutingTablesOfArea(Async)"); + } + + // verify the required parameter 'areaId' is set + if (areaId == null) { + throw new ApiException( + "Missing the required parameter 'areaId' when calling listRoutingTablesOfArea(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling listRoutingTablesOfArea(Async)"); + } + + return listRoutingTablesOfAreaCall( + organizationId, areaId, region, labelSelector, _callback); + } + + /** + * List all routing tables in a network area. Get a list of all routing tables in a network + * area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return RoutingTableListResponse + * @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 List all routing tables. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public RoutingTableListResponse listRoutingTablesOfArea( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + ApiResponse localVarResp = + listRoutingTablesOfAreaWithHttpInfo(organizationId, areaId, region, labelSelector); + return localVarResp.getData(); + } + + /** + * List all routing tables in a network area. Get a list of all routing tables in a network + * area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return ApiResponse<RoutingTableListResponse> + * @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 List all routing tables. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse listRoutingTablesOfAreaWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + okhttp3.Call localVarCall = + listRoutingTablesOfAreaValidateBeforeCall( + organizationId, areaId, region, labelSelector, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List all routing tables in a network area. (asynchronously) Get a list of all routing tables + * in a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param labelSelector Filter resources by labels. (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 List all routing tables. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listRoutingTablesOfAreaAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listRoutingTablesOfAreaValidateBeforeCall( + organizationId, areaId, region, labelSelector, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listSecurityGroupRules + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security 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 List all rules of a security group. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listSecurityGroupRulesCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID securityGroupId, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/security-groups/{securityGroupId}/rules" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "securityGroupId" + "}", + localVarApiClient.escapeString(securityGroupId.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 listSecurityGroupRulesValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID securityGroupId, + 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 listSecurityGroupRules(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling listSecurityGroupRules(Async)"); + } + + // verify the required parameter 'securityGroupId' is set + if (securityGroupId == null) { + throw new ApiException( + "Missing the required parameter 'securityGroupId' when calling listSecurityGroupRules(Async)"); + } + + return listSecurityGroupRulesCall(projectId, region, securityGroupId, _callback); + } + + /** + * List all rules for a security group. Get a list of all rules inside a security group. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security Group. (required) + * @return SecurityGroupRuleListResponse + * @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 List all rules of a security group. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public SecurityGroupRuleListResponse listSecurityGroupRules( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID securityGroupId) + throws ApiException { + ApiResponse localVarResp = + listSecurityGroupRulesWithHttpInfo(projectId, region, securityGroupId); + return localVarResp.getData(); + } + + /** + * List all rules for a security group. Get a list of all rules inside a security group. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security Group. (required) + * @return ApiResponse<SecurityGroupRuleListResponse> + * @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 List all rules of a security group. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse listSecurityGroupRulesWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID securityGroupId) + throws ApiException { + okhttp3.Call localVarCall = + listSecurityGroupRulesValidateBeforeCall(projectId, region, securityGroupId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List all rules for a security group. (asynchronously) Get a list of all rules inside a + * security group. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security 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 List all rules of a security group. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listSecurityGroupRulesAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID securityGroupId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listSecurityGroupRulesValidateBeforeCall( + projectId, region, securityGroupId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listSecurityGroups + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param labelSelector Filter resources by labels. (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 List all security groups of a project. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listSecurityGroupsCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/security-groups" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (labelSelector != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("label_selector", labelSelector)); + } + + 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 listSecurityGroupsValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector, + 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 listSecurityGroups(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling listSecurityGroups(Async)"); + } + + return listSecurityGroupsCall(projectId, region, labelSelector, _callback); + } + + /** + * List all security groups inside a project. Get a list of all security groups inside a + * project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return SecurityGroupListResponse + * @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 List all security groups of a project. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public SecurityGroupListResponse listSecurityGroups( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + ApiResponse localVarResp = + listSecurityGroupsWithHttpInfo(projectId, region, labelSelector); + return localVarResp.getData(); + } + + /** + * List all security groups inside a project. Get a list of all security groups inside a + * project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return ApiResponse<SecurityGroupListResponse> + * @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 List all security groups of a project. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse listSecurityGroupsWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + okhttp3.Call localVarCall = + listSecurityGroupsValidateBeforeCall(projectId, region, labelSelector, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List all security groups inside a project. (asynchronously) Get a list of all security groups + * inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param labelSelector Filter resources by labels. (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 List all security groups of a project. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listSecurityGroupsAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listSecurityGroupsValidateBeforeCall(projectId, region, labelSelector, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listServerNICs + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (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 List network interfaces. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listServerNICsCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/nics" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call listServerNICsValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'projectId' is set + if (projectId == null) { + throw new ApiException( + "Missing the required parameter 'projectId' when calling listServerNICs(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling listServerNICs(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling listServerNICs(Async)"); + } + + return listServerNICsCall(projectId, region, serverId, _callback); + } + + /** + * Get all network interfaces. Get all network interfaces attached to the server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @return NICListResponse + * @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 List network interfaces. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public NICListResponse listServerNICs( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId) + throws ApiException { + ApiResponse localVarResp = + listServerNICsWithHttpInfo(projectId, region, serverId); + return localVarResp.getData(); + } + + /** + * Get all network interfaces. Get all network interfaces attached to the server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @return ApiResponse<NICListResponse> + * @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 List network interfaces. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse listServerNICsWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId) + throws ApiException { + okhttp3.Call localVarCall = + listServerNICsValidateBeforeCall(projectId, region, serverId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get all network interfaces. (asynchronously) Get all network interfaces attached to the + * server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (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 List network interfaces. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listServerNICsAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listServerNICsValidateBeforeCall(projectId, region, serverId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listServerServiceAccounts + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (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 List service accounts. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listServerServiceAccountsCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/service-accounts" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call listServerServiceAccountsValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'projectId' is set + if (projectId == null) { + throw new ApiException( + "Missing the required parameter 'projectId' when calling listServerServiceAccounts(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling listServerServiceAccounts(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling listServerServiceAccounts(Async)"); + } + + return listServerServiceAccountsCall(projectId, region, serverId, _callback); + } + + /** + * List all service accounts of the Server. Get the list of the service accounts of the server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @return ServiceAccountMailListResponse + * @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 List service accounts. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ServiceAccountMailListResponse listServerServiceAccounts( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId) + throws ApiException { + ApiResponse localVarResp = + listServerServiceAccountsWithHttpInfo(projectId, region, serverId); + return localVarResp.getData(); + } + + /** + * List all service accounts of the Server. Get the list of the service accounts of the server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @return ApiResponse<ServiceAccountMailListResponse> + * @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 List service accounts. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse listServerServiceAccountsWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId) + throws ApiException { + okhttp3.Call localVarCall = + listServerServiceAccountsValidateBeforeCall(projectId, region, serverId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List all service accounts of the Server. (asynchronously) Get the list of the service + * accounts of the server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (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 List service accounts. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listServerServiceAccountsAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listServerServiceAccountsValidateBeforeCall(projectId, region, serverId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listServers + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param details Show detailed information about server. (optional, default to false) + * @param labelSelector Filter resources by labels. (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 List all servers of a project. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listServersCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable Boolean details, + @javax.annotation.Nullable String labelSelector, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/servers" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (details != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("details", details)); + } + + if (labelSelector != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("label_selector", labelSelector)); + } + + 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 listServersValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable Boolean details, + @javax.annotation.Nullable String labelSelector, + 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 listServers(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling listServers(Async)"); + } + + return listServersCall(projectId, region, details, labelSelector, _callback); + } + + /** + * List all servers inside a project. Get a list of all servers inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param details Show detailed information about server. (optional, default to false) + * @param labelSelector Filter resources by labels. (optional) + * @return ServerListResponse + * @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 List all servers of a project. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ServerListResponse listServers( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable Boolean details, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + ApiResponse localVarResp = + listServersWithHttpInfo(projectId, region, details, labelSelector); + return localVarResp.getData(); + } + + /** + * List all servers inside a project. Get a list of all servers inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param details Show detailed information about server. (optional, default to false) + * @param labelSelector Filter resources by labels. (optional) + * @return ApiResponse<ServerListResponse> + * @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 List all servers of a project. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse listServersWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable Boolean details, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + okhttp3.Call localVarCall = + listServersValidateBeforeCall(projectId, region, details, labelSelector, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List all servers inside a project. (asynchronously) Get a list of all servers inside a + * project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param details Show detailed information about server. (optional, default to false) + * @param labelSelector Filter resources by labels. (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 List all servers of a project. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listServersAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable Boolean details, + @javax.annotation.Nullable String labelSelector, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listServersValidateBeforeCall(projectId, region, details, labelSelector, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listVolumePerformanceClasses + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param labelSelector Filter resources by labels. (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 List volume performance classes. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listVolumePerformanceClassesCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/volume-performance-classes" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (labelSelector != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("label_selector", labelSelector)); + } + + 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 listVolumePerformanceClassesValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector, + 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 listVolumePerformanceClasses(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling listVolumePerformanceClasses(Async)"); + } + + return listVolumePerformanceClassesCall(projectId, region, labelSelector, _callback); + } + + /** + * List all volume performance classes available for a project. Get a list of all volume + * performance classes available inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return VolumePerformanceClassListResponse + * @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 List volume performance classes. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public VolumePerformanceClassListResponse listVolumePerformanceClasses( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + ApiResponse localVarResp = + listVolumePerformanceClassesWithHttpInfo(projectId, region, labelSelector); + return localVarResp.getData(); + } + + /** + * List all volume performance classes available for a project. Get a list of all volume + * performance classes available inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return ApiResponse<VolumePerformanceClassListResponse> + * @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 List volume performance classes. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse listVolumePerformanceClassesWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + okhttp3.Call localVarCall = + listVolumePerformanceClassesValidateBeforeCall( + projectId, region, labelSelector, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List all volume performance classes available for a project. (asynchronously) Get a list of + * all volume performance classes available inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param labelSelector Filter resources by labels. (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 List volume performance classes. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listVolumePerformanceClassesAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listVolumePerformanceClassesValidateBeforeCall( + projectId, region, labelSelector, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for listVolumes + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param labelSelector Filter resources by labels. (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 List project volumes. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listVolumesCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/volumes" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (labelSelector != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("label_selector", labelSelector)); + } + + 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 listVolumesValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector, + 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 listVolumes(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling listVolumes(Async)"); + } + + return listVolumesCall(projectId, region, labelSelector, _callback); + } + + /** + * List all volumes inside a project. Get a list of all volumes inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return VolumeListResponse + * @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 List project volumes. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public VolumeListResponse listVolumes( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + ApiResponse localVarResp = + listVolumesWithHttpInfo(projectId, region, labelSelector); + return localVarResp.getData(); + } + + /** + * List all volumes inside a project. Get a list of all volumes inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return ApiResponse<VolumeListResponse> + * @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 List project volumes. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse listVolumesWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + okhttp3.Call localVarCall = + listVolumesValidateBeforeCall(projectId, region, labelSelector, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List all volumes inside a project. (asynchronously) Get a list of all volumes inside a + * project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param labelSelector Filter resources by labels. (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 List project volumes. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call listVolumesAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + listVolumesValidateBeforeCall(projectId, region, labelSelector, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for partialUpdateNetwork + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param partialUpdateNetworkPayload Request an update of a network. (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
202 An update was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call partialUpdateNetworkCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull PartialUpdateNetworkPayload partialUpdateNetworkPayload, + 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 = partialUpdateNetworkPayload; + + // create path and map variables + String localVarPath = + "/v2beta1/projects/{projectId}/regions/{region}/networks/{networkId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "networkId" + "}", + localVarApiClient.escapeString(networkId.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, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call partialUpdateNetworkValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull PartialUpdateNetworkPayload partialUpdateNetworkPayload, + 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 partialUpdateNetwork(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling partialUpdateNetwork(Async)"); + } + + // verify the required parameter 'networkId' is set + if (networkId == null) { + throw new ApiException( + "Missing the required parameter 'networkId' when calling partialUpdateNetwork(Async)"); + } + + // verify the required parameter 'partialUpdateNetworkPayload' is set + if (partialUpdateNetworkPayload == null) { + throw new ApiException( + "Missing the required parameter 'partialUpdateNetworkPayload' when calling partialUpdateNetwork(Async)"); + } + + return partialUpdateNetworkCall( + projectId, region, networkId, partialUpdateNetworkPayload, _callback); + } + + /** + * Update network settings. Update the settings of a network inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param partialUpdateNetworkPayload Request an update of a network. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 An update was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public void partialUpdateNetwork( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull PartialUpdateNetworkPayload partialUpdateNetworkPayload) + throws ApiException { + partialUpdateNetworkWithHttpInfo(projectId, region, networkId, partialUpdateNetworkPayload); + } + + /** + * Update network settings. Update the settings of a network inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param partialUpdateNetworkPayload Request an update of a network. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 An update was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse partialUpdateNetworkWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull PartialUpdateNetworkPayload partialUpdateNetworkPayload) + throws ApiException { + okhttp3.Call localVarCall = + partialUpdateNetworkValidateBeforeCall( + projectId, region, networkId, partialUpdateNetworkPayload, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Update network settings. (asynchronously) Update the settings of a network inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param partialUpdateNetworkPayload Request an update of a network. (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
202 An update was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call partialUpdateNetworkAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull PartialUpdateNetworkPayload partialUpdateNetworkPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + partialUpdateNetworkValidateBeforeCall( + projectId, region, networkId, partialUpdateNetworkPayload, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for partialUpdateNetworkArea + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param partialUpdateNetworkAreaPayload Request to update an Area. (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 Area has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call partialUpdateNetworkAreaCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull + PartialUpdateNetworkAreaPayload partialUpdateNetworkAreaPayload, + 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 = partialUpdateNetworkAreaPayload; + + // create path and map variables + String localVarPath = + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "areaId" + "}", + localVarApiClient.escapeString(areaId.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, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call partialUpdateNetworkAreaValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull + PartialUpdateNetworkAreaPayload partialUpdateNetworkAreaPayload, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling partialUpdateNetworkArea(Async)"); + } + + // verify the required parameter 'areaId' is set + if (areaId == null) { + throw new ApiException( + "Missing the required parameter 'areaId' when calling partialUpdateNetworkArea(Async)"); + } + + // verify the required parameter 'partialUpdateNetworkAreaPayload' is set + if (partialUpdateNetworkAreaPayload == null) { + throw new ApiException( + "Missing the required parameter 'partialUpdateNetworkAreaPayload' when calling partialUpdateNetworkArea(Async)"); + } + + return partialUpdateNetworkAreaCall( + organizationId, areaId, partialUpdateNetworkAreaPayload, _callback); + } + + /** + * Update network area settings. Update the settings of a network area in an organization. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param partialUpdateNetworkAreaPayload Request to update an Area. (required) + * @return NetworkArea + * @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 Area has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public NetworkArea partialUpdateNetworkArea( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull + PartialUpdateNetworkAreaPayload partialUpdateNetworkAreaPayload) + throws ApiException { + ApiResponse localVarResp = + partialUpdateNetworkAreaWithHttpInfo( + organizationId, areaId, partialUpdateNetworkAreaPayload); + return localVarResp.getData(); + } + + /** + * Update network area settings. Update the settings of a network area in an organization. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param partialUpdateNetworkAreaPayload Request to update an Area. (required) + * @return ApiResponse<NetworkArea> + * @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 Area has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse partialUpdateNetworkAreaWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull + PartialUpdateNetworkAreaPayload partialUpdateNetworkAreaPayload) + throws ApiException { + okhttp3.Call localVarCall = + partialUpdateNetworkAreaValidateBeforeCall( + organizationId, areaId, partialUpdateNetworkAreaPayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update network area settings. (asynchronously) Update the settings of a network area in an + * organization. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param partialUpdateNetworkAreaPayload Request to update an Area. (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 Area has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call partialUpdateNetworkAreaAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull + PartialUpdateNetworkAreaPayload partialUpdateNetworkAreaPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + partialUpdateNetworkAreaValidateBeforeCall( + organizationId, areaId, partialUpdateNetworkAreaPayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for rebootServer + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param action Defines if it is a soft or a hard reboot. (optional, default to soft) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Server reboot request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call rebootServerCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nullable String action, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/reboot" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (action != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("action", action)); + } + + 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 rebootServerValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nullable String action, + 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 rebootServer(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling rebootServer(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling rebootServer(Async)"); + } + + return rebootServerCall(projectId, region, serverId, action, _callback); + } + + /** + * Reboot the server. Reboot the server. A soft reboot will attempt to gracefully shut down the + * server by passing the command to the operating system. A hard reboot will power cycle the + * server without waiting for the operating system to shutdown properly. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param action Defines if it is a soft or a hard reboot. (optional, default to soft) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Server reboot request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public void rebootServer( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nullable String action) + throws ApiException { + rebootServerWithHttpInfo(projectId, region, serverId, action); + } + + /** + * Reboot the server. Reboot the server. A soft reboot will attempt to gracefully shut down the + * server by passing the command to the operating system. A hard reboot will power cycle the + * server without waiting for the operating system to shutdown properly. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param action Defines if it is a soft or a hard reboot. (optional, default to soft) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Server reboot request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse rebootServerWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nullable String action) + throws ApiException { + okhttp3.Call localVarCall = + rebootServerValidateBeforeCall(projectId, region, serverId, action, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Reboot the server. (asynchronously) Reboot the server. A soft reboot will attempt to + * gracefully shut down the server by passing the command to the operating system. A hard reboot + * will power cycle the server without waiting for the operating system to shutdown properly. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param action Defines if it is a soft or a hard reboot. (optional, default to soft) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Server reboot request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call rebootServerAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nullable String action, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + rebootServerValidateBeforeCall(projectId, region, serverId, action, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for removeNetworkFromServer + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Detach and delete network interface was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call removeNetworkFromServerCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID networkId, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/networks/{networkId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())) + .replace( + "{" + "networkId" + "}", + localVarApiClient.escapeString(networkId.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 removeNetworkFromServerValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID networkId, + 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 removeNetworkFromServer(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling removeNetworkFromServer(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling removeNetworkFromServer(Async)"); + } + + // verify the required parameter 'networkId' is set + if (networkId == null) { + throw new ApiException( + "Missing the required parameter 'networkId' when calling removeNetworkFromServer(Async)"); + } + + return removeNetworkFromServerCall(projectId, region, serverId, networkId, _callback); + } + + /** + * Detach and delete all network interfaces associated with the specified network. Detach and + * delete all network interfaces associated with the specified network from the server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Detach and delete network interface was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public void removeNetworkFromServer( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID networkId) + throws ApiException { + removeNetworkFromServerWithHttpInfo(projectId, region, serverId, networkId); + } + + /** + * Detach and delete all network interfaces associated with the specified network. Detach and + * delete all network interfaces associated with the specified network from the server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Detach and delete network interface was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse removeNetworkFromServerWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID networkId) + throws ApiException { + okhttp3.Call localVarCall = + removeNetworkFromServerValidateBeforeCall( + projectId, region, serverId, networkId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Detach and delete all network interfaces associated with the specified network. + * (asynchronously) Detach and delete all network interfaces associated with the specified + * network from the server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Detach and delete network interface was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call removeNetworkFromServerAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID networkId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + removeNetworkFromServerValidateBeforeCall( + projectId, region, serverId, networkId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for removeNicFromServer + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param nicId The identifier (ID) of a network interface. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Network interface detachment request was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call removeNicFromServerCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID nicId, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/nics/{nicId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())) + .replace( + "{" + "nicId" + "}", + localVarApiClient.escapeString(nicId.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 removeNicFromServerValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID nicId, + 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 removeNicFromServer(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling removeNicFromServer(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling removeNicFromServer(Async)"); + } + + // verify the required parameter 'nicId' is set + if (nicId == null) { + throw new ApiException( + "Missing the required parameter 'nicId' when calling removeNicFromServer(Async)"); + } + + return removeNicFromServerCall(projectId, region, serverId, nicId, _callback); + } + + /** + * Detach a network interface. Detach a network interface from a server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param nicId The identifier (ID) of a network interface. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Network interface detachment request was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public void removeNicFromServer( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID nicId) + throws ApiException { + removeNicFromServerWithHttpInfo(projectId, region, serverId, nicId); + } + + /** + * Detach a network interface. Detach a network interface from a server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param nicId The identifier (ID) of a network interface. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Network interface detachment request was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse removeNicFromServerWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID nicId) + throws ApiException { + okhttp3.Call localVarCall = + removeNicFromServerValidateBeforeCall(projectId, region, serverId, nicId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Detach a network interface. (asynchronously) Detach a network interface from a server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param nicId The identifier (ID) of a network interface. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Network interface detachment request was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call removeNicFromServerAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID nicId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + removeNicFromServerValidateBeforeCall( + projectId, region, serverId, nicId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for removePublicIpFromServer + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param publicIpId The identifier (ID) of a Public IP. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Detach Public IP from server was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The server or public IP was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call removePublicIpFromServerCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID publicIpId, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/public-ips/{publicIpId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())) + .replace( + "{" + "publicIpId" + "}", + localVarApiClient.escapeString(publicIpId.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 removePublicIpFromServerValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID publicIpId, + 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 removePublicIpFromServer(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling removePublicIpFromServer(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling removePublicIpFromServer(Async)"); + } + + // verify the required parameter 'publicIpId' is set + if (publicIpId == null) { + throw new ApiException( + "Missing the required parameter 'publicIpId' when calling removePublicIpFromServer(Async)"); + } + + return removePublicIpFromServerCall(projectId, region, serverId, publicIpId, _callback); + } + + /** + * Dissociate a public IP from a server. Dissociate a public IP on an existing server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param publicIpId The identifier (ID) of a Public IP. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Detach Public IP from server was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The server or public IP was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public void removePublicIpFromServer( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID publicIpId) + throws ApiException { + removePublicIpFromServerWithHttpInfo(projectId, region, serverId, publicIpId); + } + + /** + * Dissociate a public IP from a server. Dissociate a public IP on an existing server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param publicIpId The identifier (ID) of a Public IP. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Detach Public IP from server was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The server or public IP was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse removePublicIpFromServerWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID publicIpId) + throws ApiException { + okhttp3.Call localVarCall = + removePublicIpFromServerValidateBeforeCall( + projectId, region, serverId, publicIpId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Dissociate a public IP from a server. (asynchronously) Dissociate a public IP on an existing + * server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param publicIpId The identifier (ID) of a Public IP. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Detach Public IP from server was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The server or public IP was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call removePublicIpFromServerAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID publicIpId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + removePublicIpFromServerValidateBeforeCall( + projectId, region, serverId, publicIpId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for removeSecurityGroupFromServer + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security 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
204 Security group detachment request was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call removeSecurityGroupFromServerCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID securityGroupId, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/security-groups/{securityGroupId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())) + .replace( + "{" + "securityGroupId" + "}", + localVarApiClient.escapeString(securityGroupId.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 removeSecurityGroupFromServerValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID securityGroupId, + 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 removeSecurityGroupFromServer(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling removeSecurityGroupFromServer(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling removeSecurityGroupFromServer(Async)"); + } + + // verify the required parameter 'securityGroupId' is set + if (securityGroupId == null) { + throw new ApiException( + "Missing the required parameter 'securityGroupId' when calling removeSecurityGroupFromServer(Async)"); + } + + return removeSecurityGroupFromServerCall( + projectId, region, serverId, securityGroupId, _callback); + } + + /** + * Remove a server from a security group. Remove a server from a attached security group. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security Group. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Security group detachment request was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public void removeSecurityGroupFromServer( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID securityGroupId) + throws ApiException { + removeSecurityGroupFromServerWithHttpInfo(projectId, region, serverId, securityGroupId); + } + + /** + * Remove a server from a security group. Remove a server from a attached security group. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security Group. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Security group detachment request was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse removeSecurityGroupFromServerWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID securityGroupId) + throws ApiException { + okhttp3.Call localVarCall = + removeSecurityGroupFromServerValidateBeforeCall( + projectId, region, serverId, securityGroupId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Remove a server from a security group. (asynchronously) Remove a server from a attached + * security group. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security 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
204 Security group detachment request was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call removeSecurityGroupFromServerAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID securityGroupId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + removeSecurityGroupFromServerValidateBeforeCall( + projectId, region, serverId, securityGroupId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for removeServiceAccountFromServer + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param serviceAccountMail The e-mail address of a service account. (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 Service account detached from the server. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call removeServiceAccountFromServerCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull String serviceAccountMail, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/service-accounts/{serviceAccountMail}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())) + .replace( + "{" + "serviceAccountMail" + "}", + localVarApiClient.escapeString(serviceAccountMail.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 removeServiceAccountFromServerValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull String serviceAccountMail, + 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 removeServiceAccountFromServer(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling removeServiceAccountFromServer(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling removeServiceAccountFromServer(Async)"); + } + + // verify the required parameter 'serviceAccountMail' is set + if (serviceAccountMail == null) { + throw new ApiException( + "Missing the required parameter 'serviceAccountMail' when calling removeServiceAccountFromServer(Async)"); + } + + return removeServiceAccountFromServerCall( + projectId, region, serverId, serviceAccountMail, _callback); + } + + /** + * Detach a service account from a server. Detach an additional service account from the server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param serviceAccountMail The e-mail address of a service account. (required) + * @return ServiceAccountMailListResponse + * @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 Service account detached from the server. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ServiceAccountMailListResponse removeServiceAccountFromServer( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull String serviceAccountMail) + throws ApiException { + ApiResponse localVarResp = + removeServiceAccountFromServerWithHttpInfo( + projectId, region, serverId, serviceAccountMail); + return localVarResp.getData(); + } + + /** + * Detach a service account from a server. Detach an additional service account from the server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param serviceAccountMail The e-mail address of a service account. (required) + * @return ApiResponse<ServiceAccountMailListResponse> + * @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 Service account detached from the server. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse removeServiceAccountFromServerWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull String serviceAccountMail) + throws ApiException { + okhttp3.Call localVarCall = + removeServiceAccountFromServerValidateBeforeCall( + projectId, region, serverId, serviceAccountMail, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Detach a service account from a server. (asynchronously) Detach an additional service account + * from the server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param serviceAccountMail The e-mail address of a service account. (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 Service account detached from the server. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call removeServiceAccountFromServerAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull String serviceAccountMail, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + removeServiceAccountFromServerValidateBeforeCall( + projectId, region, serverId, serviceAccountMail, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for removeVolumeFromServer + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Volume detachment request was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call removeVolumeFromServerCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID volumeId, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/volume-attachments/{volumeId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())) + .replace( + "{" + "volumeId" + "}", + localVarApiClient.escapeString(volumeId.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 removeVolumeFromServerValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID volumeId, + 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 removeVolumeFromServer(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling removeVolumeFromServer(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling removeVolumeFromServer(Async)"); + } + + // verify the required parameter 'volumeId' is set + if (volumeId == null) { + throw new ApiException( + "Missing the required parameter 'volumeId' when calling removeVolumeFromServer(Async)"); + } + + return removeVolumeFromServerCall(projectId, region, serverId, volumeId, _callback); + } + + /** + * Detach a volume from a server. Detach an existing volume from an existing server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Volume detachment request was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public void removeVolumeFromServer( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID volumeId) + throws ApiException { + removeVolumeFromServerWithHttpInfo(projectId, region, serverId, volumeId); + } + + /** + * Detach a volume from a server. Detach an existing volume from an existing server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Volume detachment request was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse removeVolumeFromServerWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID volumeId) + throws ApiException { + okhttp3.Call localVarCall = + removeVolumeFromServerValidateBeforeCall( + projectId, region, serverId, volumeId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Detach a volume from a server. (asynchronously) Detach an existing volume from an existing + * server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Volume detachment request was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call removeVolumeFromServerAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID volumeId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + removeVolumeFromServerValidateBeforeCall( + projectId, region, serverId, volumeId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for rescueServer + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param rescueServerPayload Request a server rescue. (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
202 Server rescue request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call rescueServerCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull RescueServerPayload rescueServerPayload, + 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 = rescueServerPayload; + + // create path and map variables + String localVarPath = + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/rescue" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/json"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call rescueServerValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull RescueServerPayload rescueServerPayload, + 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 rescueServer(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling rescueServer(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling rescueServer(Async)"); + } + + // verify the required parameter 'rescueServerPayload' is set + if (rescueServerPayload == null) { + throw new ApiException( + "Missing the required parameter 'rescueServerPayload' when calling rescueServer(Async)"); + } + + return rescueServerCall(projectId, region, serverId, rescueServerPayload, _callback); + } + + /** + * Rescue an existing server. Rescue an existing server. It is shutdown and the initial image is + * attached as the boot volume, while the boot volume is attached as secondary volume and the + * server is booted. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param rescueServerPayload Request a server rescue. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Server rescue request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public void rescueServer( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull RescueServerPayload rescueServerPayload) + throws ApiException { + rescueServerWithHttpInfo(projectId, region, serverId, rescueServerPayload); + } + + /** + * Rescue an existing server. Rescue an existing server. It is shutdown and the initial image is + * attached as the boot volume, while the boot volume is attached as secondary volume and the + * server is booted. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param rescueServerPayload Request a server rescue. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Server rescue request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse rescueServerWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull RescueServerPayload rescueServerPayload) + throws ApiException { + okhttp3.Call localVarCall = + rescueServerValidateBeforeCall( + projectId, region, serverId, rescueServerPayload, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Rescue an existing server. (asynchronously) Rescue an existing server. It is shutdown and the + * initial image is attached as the boot volume, while the boot volume is attached as secondary + * volume and the server is booted. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param rescueServerPayload Request a server rescue. (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
202 Server rescue request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call rescueServerAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull RescueServerPayload rescueServerPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + rescueServerValidateBeforeCall( + projectId, region, serverId, rescueServerPayload, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for resizeServer + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param resizeServerPayload Request a resize of a server. (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
202 Server resize request is accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call resizeServerCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull ResizeServerPayload resizeServerPayload, + 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 = resizeServerPayload; + + // create path and map variables + String localVarPath = + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/resize" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/json"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call resizeServerValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull ResizeServerPayload resizeServerPayload, + 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 resizeServer(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling resizeServer(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling resizeServer(Async)"); + } + + // verify the required parameter 'resizeServerPayload' is set + if (resizeServerPayload == null) { + throw new ApiException( + "Missing the required parameter 'resizeServerPayload' when calling resizeServer(Async)"); + } + + return resizeServerCall(projectId, region, serverId, resizeServerPayload, _callback); + } + + /** + * Resize a server. Resize the server to the given machine type. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param resizeServerPayload Request a resize of a server. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Server resize request is accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public void resizeServer( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull ResizeServerPayload resizeServerPayload) + throws ApiException { + resizeServerWithHttpInfo(projectId, region, serverId, resizeServerPayload); + } + + /** + * Resize a server. Resize the server to the given machine type. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param resizeServerPayload Request a resize of a server. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Server resize request is accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse resizeServerWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull ResizeServerPayload resizeServerPayload) + throws ApiException { + okhttp3.Call localVarCall = + resizeServerValidateBeforeCall( + projectId, region, serverId, resizeServerPayload, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Resize a server. (asynchronously) Resize the server to the given machine type. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param resizeServerPayload Request a resize of a server. (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
202 Server resize request is accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call resizeServerAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull ResizeServerPayload resizeServerPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + resizeServerValidateBeforeCall( + projectId, region, serverId, resizeServerPayload, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for resizeVolume + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @param resizeVolumePayload Request a volume resize. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Volume resize request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call resizeVolumeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID volumeId, + @javax.annotation.Nullable ResizeVolumePayload resizeVolumePayload, + 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 = resizeVolumePayload; + + // create path and map variables + String localVarPath = + "/v2beta1/projects/{projectId}/regions/{region}/volumes/{volumeId}/resize" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "volumeId" + "}", + localVarApiClient.escapeString(volumeId.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 resizeVolumeValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID volumeId, + @javax.annotation.Nullable ResizeVolumePayload resizeVolumePayload, + 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 resizeVolume(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling resizeVolume(Async)"); + } + + // verify the required parameter 'volumeId' is set + if (volumeId == null) { + throw new ApiException( + "Missing the required parameter 'volumeId' when calling resizeVolume(Async)"); + } + + return resizeVolumeCall(projectId, region, volumeId, resizeVolumePayload, _callback); + } + + /** + * Update the size of a volume. Update the size of a block device volume. The new volume size + * must be larger than the current size. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @param resizeVolumePayload Request a volume resize. (optional) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Volume resize request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public void resizeVolume( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID volumeId, + @javax.annotation.Nullable ResizeVolumePayload resizeVolumePayload) + throws ApiException { + resizeVolumeWithHttpInfo(projectId, region, volumeId, resizeVolumePayload); + } + + /** + * Update the size of a volume. Update the size of a block device volume. The new volume size + * must be larger than the current size. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @param resizeVolumePayload Request a volume resize. (optional) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Volume resize request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse resizeVolumeWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID volumeId, + @javax.annotation.Nullable ResizeVolumePayload resizeVolumePayload) + throws ApiException { + okhttp3.Call localVarCall = + resizeVolumeValidateBeforeCall( + projectId, region, volumeId, resizeVolumePayload, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Update the size of a volume. (asynchronously) Update the size of a block device volume. The + * new volume size must be larger than the current size. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @param resizeVolumePayload Request a volume resize. (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Volume resize request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call resizeVolumeAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID volumeId, + @javax.annotation.Nullable ResizeVolumePayload resizeVolumePayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + resizeVolumeValidateBeforeCall( + projectId, region, volumeId, resizeVolumePayload, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for restoreBackup + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param backupId The identifier (ID) of a STACKIT Backup. (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
202 Backup restore request has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call restoreBackupCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID backupId, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/backups/{backupId}/restore" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "backupId" + "}", + localVarApiClient.escapeString(backupId.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 restoreBackupValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID backupId, + 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 restoreBackup(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling restoreBackup(Async)"); + } + + // verify the required parameter 'backupId' is set + if (backupId == null) { + throw new ApiException( + "Missing the required parameter 'backupId' when calling restoreBackup(Async)"); + } + + return restoreBackupCall(projectId, region, backupId, _callback); + } + + /** + * Restore Backup to the referenced source Volume. Restores a Backup to the existing Volume it + * references to. The use of this endpoint is disruptive as the volume needs to be detached. If + * a new volume is to be created use the volumes endpoint with the option to create from backup. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param backupId The identifier (ID) of a STACKIT Backup. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Backup restore request has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public void restoreBackup( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID backupId) + throws ApiException { + restoreBackupWithHttpInfo(projectId, region, backupId); + } + + /** + * Restore Backup to the referenced source Volume. Restores a Backup to the existing Volume it + * references to. The use of this endpoint is disruptive as the volume needs to be detached. If + * a new volume is to be created use the volumes endpoint with the option to create from backup. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param backupId The identifier (ID) of a STACKIT Backup. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Backup restore request has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse restoreBackupWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID backupId) + throws ApiException { + okhttp3.Call localVarCall = + restoreBackupValidateBeforeCall(projectId, region, backupId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Restore Backup to the referenced source Volume. (asynchronously) Restores a Backup to the + * existing Volume it references to. The use of this endpoint is disruptive as the volume needs + * to be detached. If a new volume is to be created use the volumes endpoint with the option to + * create from backup. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param backupId The identifier (ID) of a STACKIT Backup. (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
202 Backup restore request has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call restoreBackupAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID backupId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + restoreBackupValidateBeforeCall(projectId, region, backupId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for setImageShare + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @param setImageSharePayload Settings for an Image Share. (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 Setting Image share successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call setImageShareCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID imageId, + @javax.annotation.Nonnull SetImageSharePayload setImageSharePayload, + 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 = setImageSharePayload; + + // create path and map variables + String localVarPath = + "/v2beta1/projects/{projectId}/regions/{region}/images/{imageId}/share" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "imageId" + "}", + localVarApiClient.escapeString(imageId.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 setImageShareValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID imageId, + @javax.annotation.Nonnull SetImageSharePayload setImageSharePayload, + 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 setImageShare(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling setImageShare(Async)"); + } + + // verify the required parameter 'imageId' is set + if (imageId == null) { + throw new ApiException( + "Missing the required parameter 'imageId' when calling setImageShare(Async)"); + } + + // verify the required parameter 'setImageSharePayload' is set + if (setImageSharePayload == null) { + throw new ApiException( + "Missing the required parameter 'setImageSharePayload' when calling setImageShare(Async)"); + } + + return setImageShareCall(projectId, region, imageId, setImageSharePayload, _callback); + } + + /** + * Set image share. Set share of an Image. New Options will replace existing settings. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @param setImageSharePayload Settings for an Image Share. (required) + * @return ImageShare + * @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 Setting Image share successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ImageShare setImageShare( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID imageId, + @javax.annotation.Nonnull SetImageSharePayload setImageSharePayload) + throws ApiException { + ApiResponse localVarResp = + setImageShareWithHttpInfo(projectId, region, imageId, setImageSharePayload); + return localVarResp.getData(); + } + + /** + * Set image share. Set share of an Image. New Options will replace existing settings. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @param setImageSharePayload Settings for an Image Share. (required) + * @return ApiResponse<ImageShare> + * @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 Setting Image share successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse setImageShareWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID imageId, + @javax.annotation.Nonnull SetImageSharePayload setImageSharePayload) + throws ApiException { + okhttp3.Call localVarCall = + setImageShareValidateBeforeCall( + projectId, region, imageId, setImageSharePayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Set image share. (asynchronously) Set share of an Image. New Options will replace existing + * settings. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @param setImageSharePayload Settings for an Image Share. (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 Setting Image share successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call setImageShareAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID imageId, + @javax.annotation.Nonnull SetImageSharePayload setImageSharePayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + setImageShareValidateBeforeCall( + projectId, region, imageId, setImageSharePayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for startServer + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (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
202 Server start request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call startServerCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/start" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call startServerValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'projectId' is set + if (projectId == null) { + throw new ApiException( + "Missing the required parameter 'projectId' when calling startServer(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling startServer(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling startServer(Async)"); + } + + return startServerCall(projectId, region, serverId, _callback); + } + + /** + * Boot up a server. Start an existing server or allocates the server if deallocated. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Server start request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public void startServer( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId) + throws ApiException { + startServerWithHttpInfo(projectId, region, serverId); + } + + /** + * Boot up a server. Start an existing server or allocates the server if deallocated. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Server start request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse startServerWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId) + throws ApiException { + okhttp3.Call localVarCall = + startServerValidateBeforeCall(projectId, region, serverId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Boot up a server. (asynchronously) Start an existing server or allocates the server if + * deallocated. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (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
202 Server start request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call startServerAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + startServerValidateBeforeCall(projectId, region, serverId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for stopServer + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (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
202 Server stop request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call stopServerCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/stop" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call stopServerValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'projectId' is set + if (projectId == null) { + throw new ApiException( + "Missing the required parameter 'projectId' when calling stopServer(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling stopServer(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling stopServer(Async)"); + } + + return stopServerCall(projectId, region, serverId, _callback); + } + + /** + * Stop an existing server. Stops an existing server. The server will remain on the Hypervisor + * and will be charged full price for all resources attached to it. The attached resources will + * remain reserved. Useful particularly for vGPU servers. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Server stop request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public void stopServer( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId) + throws ApiException { + stopServerWithHttpInfo(projectId, region, serverId); + } + + /** + * Stop an existing server. Stops an existing server. The server will remain on the Hypervisor + * and will be charged full price for all resources attached to it. The attached resources will + * remain reserved. Useful particularly for vGPU servers. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Server stop request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse stopServerWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId) + throws ApiException { + okhttp3.Call localVarCall = stopServerValidateBeforeCall(projectId, region, serverId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Stop an existing server. (asynchronously) Stops an existing server. The server will remain on + * the Hypervisor and will be charged full price for all resources attached to it. The attached + * resources will remain reserved. Useful particularly for vGPU servers. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (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
202 Server stop request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call stopServerAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + stopServerValidateBeforeCall(projectId, region, serverId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for unrescueServer + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (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
202 Server unrescue request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call unrescueServerCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] {}; + + // Determine Base Path to Use + if (localCustomBaseUrl != null) { + basePath = localCustomBaseUrl; + } else if (localBasePaths.length > 0) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/unrescue" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call unrescueServerValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'projectId' is set + if (projectId == null) { + throw new ApiException( + "Missing the required parameter 'projectId' when calling unrescueServer(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling unrescueServer(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling unrescueServer(Async)"); + } + + return unrescueServerCall(projectId, region, serverId, _callback); + } + + /** + * Unrescue an existing server. Unrescue an existing server. The original boot volume is + * attached as boot volume of the server and the server is booted up. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Server unrescue request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public void unrescueServer( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId) + throws ApiException { + unrescueServerWithHttpInfo(projectId, region, serverId); + } + + /** + * Unrescue an existing server. Unrescue an existing server. The original boot volume is + * attached as boot volume of the server and the server is booted up. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Server unrescue request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse unrescueServerWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId) + throws ApiException { + okhttp3.Call localVarCall = + unrescueServerValidateBeforeCall(projectId, region, serverId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Unrescue an existing server. (asynchronously) Unrescue an existing server. The original boot + * volume is attached as boot volume of the server and the server is booted up. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (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
202 Server unrescue request accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call unrescueServerAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + unrescueServerValidateBeforeCall(projectId, region, serverId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for updateAttachedVolume + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @param updateAttachedVolumePayload Request a volume attachment update. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Response to update call. Provide the updated volume attachment object. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call updateAttachedVolumeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID volumeId, + @javax.annotation.Nonnull UpdateAttachedVolumePayload updateAttachedVolumePayload, + 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 = updateAttachedVolumePayload; + + // create path and map variables + String localVarPath = + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/volume-attachments/{volumeId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())) + .replace( + "{" + "volumeId" + "}", + localVarApiClient.escapeString(volumeId.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, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateAttachedVolumeValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID volumeId, + @javax.annotation.Nonnull UpdateAttachedVolumePayload updateAttachedVolumePayload, + 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 updateAttachedVolume(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling updateAttachedVolume(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling updateAttachedVolume(Async)"); + } + + // verify the required parameter 'volumeId' is set + if (volumeId == null) { + throw new ApiException( + "Missing the required parameter 'volumeId' when calling updateAttachedVolume(Async)"); + } + + // verify the required parameter 'updateAttachedVolumePayload' is set + if (updateAttachedVolumePayload == null) { + throw new ApiException( + "Missing the required parameter 'updateAttachedVolumePayload' when calling updateAttachedVolume(Async)"); + } + + return updateAttachedVolumeCall( + projectId, region, serverId, volumeId, updateAttachedVolumePayload, _callback); + } + + /** + * Update Volume Attachment Parameters. Update the properties of an existing Volume Attachment. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @param updateAttachedVolumePayload Request a volume attachment update. (required) + * @return VolumeAttachment + * @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 Response to update call. Provide the updated volume attachment object. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public VolumeAttachment updateAttachedVolume( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID volumeId, + @javax.annotation.Nonnull UpdateAttachedVolumePayload updateAttachedVolumePayload) + throws ApiException { + ApiResponse localVarResp = + updateAttachedVolumeWithHttpInfo( + projectId, region, serverId, volumeId, updateAttachedVolumePayload); + return localVarResp.getData(); + } + + /** + * Update Volume Attachment Parameters. Update the properties of an existing Volume Attachment. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @param updateAttachedVolumePayload Request a volume attachment update. (required) + * @return ApiResponse<VolumeAttachment> + * @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 Response to update call. Provide the updated volume attachment object. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse updateAttachedVolumeWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID volumeId, + @javax.annotation.Nonnull UpdateAttachedVolumePayload updateAttachedVolumePayload) + throws ApiException { + okhttp3.Call localVarCall = + updateAttachedVolumeValidateBeforeCall( + projectId, region, serverId, volumeId, updateAttachedVolumePayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update Volume Attachment Parameters. (asynchronously) Update the properties of an existing + * Volume Attachment. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @param updateAttachedVolumePayload Request a volume attachment update. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Response to update call. Provide the updated volume attachment object. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call updateAttachedVolumeAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UUID volumeId, + @javax.annotation.Nonnull UpdateAttachedVolumePayload updateAttachedVolumePayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + updateAttachedVolumeValidateBeforeCall( + projectId, + region, + serverId, + volumeId, + updateAttachedVolumePayload, + _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for updateImage + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @param updateImagePayload Request an update of an Image. (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 Response to update call. Provide the updated image object. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call updateImageCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID imageId, + @javax.annotation.Nonnull UpdateImagePayload updateImagePayload, + 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 = updateImagePayload; + + // create path and map variables + String localVarPath = + "/v2beta1/projects/{projectId}/regions/{region}/images/{imageId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "imageId" + "}", + localVarApiClient.escapeString(imageId.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, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateImageValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID imageId, + @javax.annotation.Nonnull UpdateImagePayload updateImagePayload, + 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 updateImage(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling updateImage(Async)"); + } + + // verify the required parameter 'imageId' is set + if (imageId == null) { + throw new ApiException( + "Missing the required parameter 'imageId' when calling updateImage(Async)"); + } + + // verify the required parameter 'updateImagePayload' is set + if (updateImagePayload == null) { + throw new ApiException( + "Missing the required parameter 'updateImagePayload' when calling updateImage(Async)"); + } + + return updateImageCall(projectId, region, imageId, updateImagePayload, _callback); + } + + /** + * Update Image Parameters. Update the properties of an existing Image inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @param updateImagePayload Request an update of an Image. (required) + * @return Image + * @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 Response to update call. Provide the updated image object. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public Image updateImage( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID imageId, + @javax.annotation.Nonnull UpdateImagePayload updateImagePayload) + throws ApiException { + ApiResponse localVarResp = + updateImageWithHttpInfo(projectId, region, imageId, updateImagePayload); + return localVarResp.getData(); + } + + /** + * Update Image Parameters. Update the properties of an existing Image inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @param updateImagePayload Request an update of an Image. (required) + * @return ApiResponse<Image> + * @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 Response to update call. Provide the updated image object. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse updateImageWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID imageId, + @javax.annotation.Nonnull UpdateImagePayload updateImagePayload) + throws ApiException { + okhttp3.Call localVarCall = + updateImageValidateBeforeCall(projectId, region, imageId, updateImagePayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update Image Parameters. (asynchronously) Update the properties of an existing Image inside a + * project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @param updateImagePayload Request an update of an Image. (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 Response to update call. Provide the updated image object. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call updateImageAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID imageId, + @javax.annotation.Nonnull UpdateImagePayload updateImagePayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + updateImageValidateBeforeCall( + projectId, region, imageId, updateImagePayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for updateImageShare + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @param updateImageSharePayload Update an Image Share. (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 Updating Image share successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call updateImageShareCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID imageId, + @javax.annotation.Nonnull UpdateImageSharePayload updateImageSharePayload, + 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 = updateImageSharePayload; + + // create path and map variables + String localVarPath = + "/v2beta1/projects/{projectId}/regions/{region}/images/{imageId}/share" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "imageId" + "}", + localVarApiClient.escapeString(imageId.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, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateImageShareValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID imageId, + @javax.annotation.Nonnull UpdateImageSharePayload updateImageSharePayload, + 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 updateImageShare(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling updateImageShare(Async)"); + } + + // verify the required parameter 'imageId' is set + if (imageId == null) { + throw new ApiException( + "Missing the required parameter 'imageId' when calling updateImageShare(Async)"); + } + + // verify the required parameter 'updateImageSharePayload' is set + if (updateImageSharePayload == null) { + throw new ApiException( + "Missing the required parameter 'updateImageSharePayload' when calling updateImageShare(Async)"); + } + + return updateImageShareCall(projectId, region, imageId, updateImageSharePayload, _callback); + } + + /** + * Update image share. Update share of an Image. Projects will be appended to existing list. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @param updateImageSharePayload Update an Image Share. (required) + * @return ImageShare + * @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 Updating Image share successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ImageShare updateImageShare( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID imageId, + @javax.annotation.Nonnull UpdateImageSharePayload updateImageSharePayload) + throws ApiException { + ApiResponse localVarResp = + updateImageShareWithHttpInfo(projectId, region, imageId, updateImageSharePayload); + return localVarResp.getData(); + } + + /** + * Update image share. Update share of an Image. Projects will be appended to existing list. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @param updateImageSharePayload Update an Image Share. (required) + * @return ApiResponse<ImageShare> + * @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 Updating Image share successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse updateImageShareWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID imageId, + @javax.annotation.Nonnull UpdateImageSharePayload updateImageSharePayload) + throws ApiException { + okhttp3.Call localVarCall = + updateImageShareValidateBeforeCall( + projectId, region, imageId, updateImageSharePayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update image share. (asynchronously) Update share of an Image. Projects will be appended to + * existing list. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param imageId The identifier (ID) of a STACKIT Image. (required) + * @param updateImageSharePayload Update an Image Share. (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 Updating Image share successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call updateImageShareAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID imageId, + @javax.annotation.Nonnull UpdateImageSharePayload updateImageSharePayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + updateImageShareValidateBeforeCall( + projectId, region, imageId, updateImageSharePayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for updateKeyPair + * + * @param keypairName The name of an SSH keypair. (required) + * @param updateKeyPairPayload Request an update of an SSH keypair. (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 SSH keypair has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call updateKeyPairCall( + @javax.annotation.Nonnull String keypairName, + @javax.annotation.Nonnull UpdateKeyPairPayload updateKeyPairPayload, + 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 = updateKeyPairPayload; + + // create path and map variables + String localVarPath = + "/v2beta1/keypairs/{keypairName}" + .replace( + "{" + "keypairName" + "}", + localVarApiClient.escapeString(keypairName.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, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateKeyPairValidateBeforeCall( + @javax.annotation.Nonnull String keypairName, + @javax.annotation.Nonnull UpdateKeyPairPayload updateKeyPairPayload, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'keypairName' is set + if (keypairName == null) { + throw new ApiException( + "Missing the required parameter 'keypairName' when calling updateKeyPair(Async)"); + } + + // verify the required parameter 'updateKeyPairPayload' is set + if (updateKeyPairPayload == null) { + throw new ApiException( + "Missing the required parameter 'updateKeyPairPayload' when calling updateKeyPair(Async)"); + } + + return updateKeyPairCall(keypairName, updateKeyPairPayload, _callback); + } + + /** + * Update information of an SSH keypair. Update labels of the SSH keypair. + * + * @param keypairName The name of an SSH keypair. (required) + * @param updateKeyPairPayload Request an update of an SSH keypair. (required) + * @return Keypair + * @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 SSH keypair has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public Keypair updateKeyPair( + @javax.annotation.Nonnull String keypairName, + @javax.annotation.Nonnull UpdateKeyPairPayload updateKeyPairPayload) + throws ApiException { + ApiResponse localVarResp = + updateKeyPairWithHttpInfo(keypairName, updateKeyPairPayload); + return localVarResp.getData(); + } + + /** + * Update information of an SSH keypair. Update labels of the SSH keypair. + * + * @param keypairName The name of an SSH keypair. (required) + * @param updateKeyPairPayload Request an update of an SSH keypair. (required) + * @return ApiResponse<Keypair> + * @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 SSH keypair has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse updateKeyPairWithHttpInfo( + @javax.annotation.Nonnull String keypairName, + @javax.annotation.Nonnull UpdateKeyPairPayload updateKeyPairPayload) + throws ApiException { + okhttp3.Call localVarCall = + updateKeyPairValidateBeforeCall(keypairName, updateKeyPairPayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update information of an SSH keypair. (asynchronously) Update labels of the SSH keypair. + * + * @param keypairName The name of an SSH keypair. (required) + * @param updateKeyPairPayload Request an update of an SSH keypair. (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 SSH keypair has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call updateKeyPairAsync( + @javax.annotation.Nonnull String keypairName, + @javax.annotation.Nonnull UpdateKeyPairPayload updateKeyPairPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + updateKeyPairValidateBeforeCall(keypairName, updateKeyPairPayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for updateNic + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param nicId The identifier (ID) of a network interface. (required) + * @param updateNicPayload Request an update of a network interface. (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 Network interface has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call updateNicCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull UUID nicId, + @javax.annotation.Nonnull UpdateNicPayload updateNicPayload, + 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 = updateNicPayload; + + // create path and map variables + String localVarPath = + "/v2beta1/projects/{projectId}/regions/{region}/networks/{networkId}/nics/{nicId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "networkId" + "}", + localVarApiClient.escapeString(networkId.toString())) + .replace( + "{" + "nicId" + "}", + localVarApiClient.escapeString(nicId.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, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateNicValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull UUID nicId, + @javax.annotation.Nonnull UpdateNicPayload updateNicPayload, + 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 updateNic(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling updateNic(Async)"); + } + + // verify the required parameter 'networkId' is set + if (networkId == null) { + throw new ApiException( + "Missing the required parameter 'networkId' when calling updateNic(Async)"); + } + + // verify the required parameter 'nicId' is set + if (nicId == null) { + throw new ApiException( + "Missing the required parameter 'nicId' when calling updateNic(Async)"); + } + + // verify the required parameter 'updateNicPayload' is set + if (updateNicPayload == null) { + throw new ApiException( + "Missing the required parameter 'updateNicPayload' when calling updateNic(Async)"); + } + + return updateNicCall(projectId, region, networkId, nicId, updateNicPayload, _callback); + } + + /** + * Update a network interface. Update the properties of an existing network interface inside a + * network. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param nicId The identifier (ID) of a network interface. (required) + * @param updateNicPayload Request an update of a network interface. (required) + * @return NIC + * @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 Network interface has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public NIC updateNic( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull UUID nicId, + @javax.annotation.Nonnull UpdateNicPayload updateNicPayload) + throws ApiException { + ApiResponse localVarResp = + updateNicWithHttpInfo(projectId, region, networkId, nicId, updateNicPayload); + return localVarResp.getData(); + } + + /** + * Update a network interface. Update the properties of an existing network interface inside a + * network. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param nicId The identifier (ID) of a network interface. (required) + * @param updateNicPayload Request an update of a network interface. (required) + * @return ApiResponse<NIC> + * @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 Network interface has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse updateNicWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull UUID nicId, + @javax.annotation.Nonnull UpdateNicPayload updateNicPayload) + throws ApiException { + okhttp3.Call localVarCall = + updateNicValidateBeforeCall( + projectId, region, networkId, nicId, updateNicPayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update a network interface. (asynchronously) Update the properties of an existing network + * interface inside a network. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param networkId The identifier (ID) of a STACKIT Network. (required) + * @param nicId The identifier (ID) of a network interface. (required) + * @param updateNicPayload Request an update of a network interface. (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 Network interface has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call updateNicAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID networkId, + @javax.annotation.Nonnull UUID nicId, + @javax.annotation.Nonnull UpdateNicPayload updateNicPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + updateNicValidateBeforeCall( + projectId, region, networkId, nicId, updateNicPayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for updatePublicIP + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param publicIpId The identifier (ID) of a Public IP. (required) + * @param updatePublicIPPayload Request an update of a public IP. (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 Public IP has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call updatePublicIPCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID publicIpId, + @javax.annotation.Nonnull UpdatePublicIPPayload updatePublicIPPayload, + 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 = updatePublicIPPayload; + + // create path and map variables + String localVarPath = + "/v2beta1/projects/{projectId}/regions/{region}/public-ips/{publicIpId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "publicIpId" + "}", + localVarApiClient.escapeString(publicIpId.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, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updatePublicIPValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID publicIpId, + @javax.annotation.Nonnull UpdatePublicIPPayload updatePublicIPPayload, + 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 updatePublicIP(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling updatePublicIP(Async)"); + } + + // verify the required parameter 'publicIpId' is set + if (publicIpId == null) { + throw new ApiException( + "Missing the required parameter 'publicIpId' when calling updatePublicIP(Async)"); + } + + // verify the required parameter 'updatePublicIPPayload' is set + if (updatePublicIPPayload == null) { + throw new ApiException( + "Missing the required parameter 'updatePublicIPPayload' when calling updatePublicIP(Async)"); + } + + return updatePublicIPCall(projectId, region, publicIpId, updatePublicIPPayload, _callback); + } + + /** + * Update a public IP. Update the properties of an existing public IP inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param publicIpId The identifier (ID) of a Public IP. (required) + * @param updatePublicIPPayload Request an update of a public IP. (required) + * @return PublicIp + * @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 Public IP has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public PublicIp updatePublicIP( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID publicIpId, + @javax.annotation.Nonnull UpdatePublicIPPayload updatePublicIPPayload) + throws ApiException { + ApiResponse localVarResp = + updatePublicIPWithHttpInfo(projectId, region, publicIpId, updatePublicIPPayload); + return localVarResp.getData(); + } + + /** + * Update a public IP. Update the properties of an existing public IP inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param publicIpId The identifier (ID) of a Public IP. (required) + * @param updatePublicIPPayload Request an update of a public IP. (required) + * @return ApiResponse<PublicIp> + * @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 Public IP has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse updatePublicIPWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID publicIpId, + @javax.annotation.Nonnull UpdatePublicIPPayload updatePublicIPPayload) + throws ApiException { + okhttp3.Call localVarCall = + updatePublicIPValidateBeforeCall( + projectId, region, publicIpId, updatePublicIPPayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update a public IP. (asynchronously) Update the properties of an existing public IP inside a + * project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param publicIpId The identifier (ID) of a Public IP. (required) + * @param updatePublicIPPayload Request an update of a public IP. (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 Public IP has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call updatePublicIPAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID publicIpId, + @javax.annotation.Nonnull UpdatePublicIPPayload updatePublicIPPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + updatePublicIPValidateBeforeCall( + projectId, region, publicIpId, updatePublicIPPayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for updateRouteOfRoutingTable + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @param routeId The identifier (ID) of a STACKIT Route. (required) + * @param updateRouteOfRoutingTablePayload Request an update of a route in a routing table. + * (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Update request for route successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call updateRouteOfRoutingTableCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nonnull UUID routeId, + @javax.annotation.Nonnull + UpdateRouteOfRoutingTablePayload updateRouteOfRoutingTablePayload, + 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 = updateRouteOfRoutingTablePayload; + + // create path and map variables + String localVarPath = + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}/routes/{routeId}" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "areaId" + "}", + localVarApiClient.escapeString(areaId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "routingTableId" + "}", + localVarApiClient.escapeString(routingTableId.toString())) + .replace( + "{" + "routeId" + "}", + localVarApiClient.escapeString(routeId.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, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateRouteOfRoutingTableValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nonnull UUID routeId, + @javax.annotation.Nonnull + UpdateRouteOfRoutingTablePayload updateRouteOfRoutingTablePayload, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling updateRouteOfRoutingTable(Async)"); + } + + // verify the required parameter 'areaId' is set + if (areaId == null) { + throw new ApiException( + "Missing the required parameter 'areaId' when calling updateRouteOfRoutingTable(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling updateRouteOfRoutingTable(Async)"); + } + + // verify the required parameter 'routingTableId' is set + if (routingTableId == null) { + throw new ApiException( + "Missing the required parameter 'routingTableId' when calling updateRouteOfRoutingTable(Async)"); + } + + // verify the required parameter 'routeId' is set + if (routeId == null) { + throw new ApiException( + "Missing the required parameter 'routeId' when calling updateRouteOfRoutingTable(Async)"); + } + + // verify the required parameter 'updateRouteOfRoutingTablePayload' is set + if (updateRouteOfRoutingTablePayload == null) { + throw new ApiException( + "Missing the required parameter 'updateRouteOfRoutingTablePayload' when calling updateRouteOfRoutingTable(Async)"); + } + + return updateRouteOfRoutingTableCall( + organizationId, + areaId, + region, + routingTableId, + routeId, + updateRouteOfRoutingTablePayload, + _callback); + } + + /** + * Update a route of a routing table. Update a route defined in a routing table. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @param routeId The identifier (ID) of a STACKIT Route. (required) + * @param updateRouteOfRoutingTablePayload Request an update of a route in a routing table. + * (required) + * @return Route + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Update request for route successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public Route updateRouteOfRoutingTable( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nonnull UUID routeId, + @javax.annotation.Nonnull + UpdateRouteOfRoutingTablePayload updateRouteOfRoutingTablePayload) + throws ApiException { + ApiResponse localVarResp = + updateRouteOfRoutingTableWithHttpInfo( + organizationId, + areaId, + region, + routingTableId, + routeId, + updateRouteOfRoutingTablePayload); + return localVarResp.getData(); + } + + /** + * Update a route of a routing table. Update a route defined in a routing table. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @param routeId The identifier (ID) of a STACKIT Route. (required) + * @param updateRouteOfRoutingTablePayload Request an update of a route in a routing table. + * (required) + * @return ApiResponse<Route> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Update request for route successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse updateRouteOfRoutingTableWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nonnull UUID routeId, + @javax.annotation.Nonnull + UpdateRouteOfRoutingTablePayload updateRouteOfRoutingTablePayload) + throws ApiException { + okhttp3.Call localVarCall = + updateRouteOfRoutingTableValidateBeforeCall( + organizationId, + areaId, + region, + routingTableId, + routeId, + updateRouteOfRoutingTablePayload, + null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update a route of a routing table. (asynchronously) Update a route defined in a routing + * table. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @param routeId The identifier (ID) of a STACKIT Route. (required) + * @param updateRouteOfRoutingTablePayload Request an update of a route in a routing table. + * (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Update request for route successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call updateRouteOfRoutingTableAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nonnull UUID routeId, + @javax.annotation.Nonnull + UpdateRouteOfRoutingTablePayload updateRouteOfRoutingTablePayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + updateRouteOfRoutingTableValidateBeforeCall( + organizationId, + areaId, + region, + routingTableId, + routeId, + updateRouteOfRoutingTablePayload, + _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for updateRoutingTableOfArea + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @param updateRoutingTableOfAreaPayload Request an update of a routing table. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Update request for routing table successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call updateRoutingTableOfAreaCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nonnull + UpdateRoutingTableOfAreaPayload updateRoutingTableOfAreaPayload, + 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 = updateRoutingTableOfAreaPayload; + + // create path and map variables + String localVarPath = + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "areaId" + "}", + localVarApiClient.escapeString(areaId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "routingTableId" + "}", + localVarApiClient.escapeString(routingTableId.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, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateRoutingTableOfAreaValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nonnull + UpdateRoutingTableOfAreaPayload updateRoutingTableOfAreaPayload, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling updateRoutingTableOfArea(Async)"); + } + + // verify the required parameter 'areaId' is set + if (areaId == null) { + throw new ApiException( + "Missing the required parameter 'areaId' when calling updateRoutingTableOfArea(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling updateRoutingTableOfArea(Async)"); + } + + // verify the required parameter 'routingTableId' is set + if (routingTableId == null) { + throw new ApiException( + "Missing the required parameter 'routingTableId' when calling updateRoutingTableOfArea(Async)"); + } + + // verify the required parameter 'updateRoutingTableOfAreaPayload' is set + if (updateRoutingTableOfAreaPayload == null) { + throw new ApiException( + "Missing the required parameter 'updateRoutingTableOfAreaPayload' when calling updateRoutingTableOfArea(Async)"); + } + + return updateRoutingTableOfAreaCall( + organizationId, + areaId, + region, + routingTableId, + updateRoutingTableOfAreaPayload, + _callback); + } + + /** + * Update a routing table. Update a routing table defined in a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @param updateRoutingTableOfAreaPayload Request an update of a routing table. (required) + * @return RoutingTable + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Update request for routing table successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public RoutingTable updateRoutingTableOfArea( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nonnull + UpdateRoutingTableOfAreaPayload updateRoutingTableOfAreaPayload) + throws ApiException { + ApiResponse localVarResp = + updateRoutingTableOfAreaWithHttpInfo( + organizationId, + areaId, + region, + routingTableId, + updateRoutingTableOfAreaPayload); + return localVarResp.getData(); + } + + /** + * Update a routing table. Update a routing table defined in a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @param updateRoutingTableOfAreaPayload Request an update of a routing table. (required) + * @return ApiResponse<RoutingTable> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Update request for routing table successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse updateRoutingTableOfAreaWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nonnull + UpdateRoutingTableOfAreaPayload updateRoutingTableOfAreaPayload) + throws ApiException { + okhttp3.Call localVarCall = + updateRoutingTableOfAreaValidateBeforeCall( + organizationId, + areaId, + region, + routingTableId, + updateRoutingTableOfAreaPayload, + null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update a routing table. (asynchronously) Update a routing table defined in a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routingTableId The identifier (ID) of a STACKIT Routing Table. (required) + * @param updateRoutingTableOfAreaPayload Request an update of a routing table. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Update request for routing table successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call updateRoutingTableOfAreaAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routingTableId, + @javax.annotation.Nonnull + UpdateRoutingTableOfAreaPayload updateRoutingTableOfAreaPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + updateRoutingTableOfAreaValidateBeforeCall( + organizationId, + areaId, + region, + routingTableId, + updateRoutingTableOfAreaPayload, + _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for updateServer + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param updateServerPayload Request an update of a server. (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 Server has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call updateServerCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UpdateServerPayload updateServerPayload, + 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 = updateServerPayload; + + // create path and map variables + String localVarPath = + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "serverId" + "}", + localVarApiClient.escapeString(serverId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/json"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateServerValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UpdateServerPayload updateServerPayload, + 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 updateServer(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling updateServer(Async)"); + } + + // verify the required parameter 'serverId' is set + if (serverId == null) { + throw new ApiException( + "Missing the required parameter 'serverId' when calling updateServer(Async)"); + } + + // verify the required parameter 'updateServerPayload' is set + if (updateServerPayload == null) { + throw new ApiException( + "Missing the required parameter 'updateServerPayload' when calling updateServer(Async)"); + } + + return updateServerCall(projectId, region, serverId, updateServerPayload, _callback); + } + + /** + * Update information of a server. Update name or labels of the server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param updateServerPayload Request an update of a server. (required) + * @return Server + * @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 Server has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public Server updateServer( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UpdateServerPayload updateServerPayload) + throws ApiException { + ApiResponse localVarResp = + updateServerWithHttpInfo(projectId, region, serverId, updateServerPayload); + return localVarResp.getData(); + } + + /** + * Update information of a server. Update name or labels of the server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param updateServerPayload Request an update of a server. (required) + * @return ApiResponse<Server> + * @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 Server has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse updateServerWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UpdateServerPayload updateServerPayload) + throws ApiException { + okhttp3.Call localVarCall = + updateServerValidateBeforeCall( + projectId, region, serverId, updateServerPayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update information of a server. (asynchronously) Update name or labels of the server. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param serverId The identifier (ID) of a STACKIT Server. (required) + * @param updateServerPayload Request an update of a server. (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 Server has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call updateServerAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID serverId, + @javax.annotation.Nonnull UpdateServerPayload updateServerPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + updateServerValidateBeforeCall( + projectId, region, serverId, updateServerPayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for updateVolume + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @param updateVolumePayload Request an update of a volume. (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 Volume has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call updateVolumeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID volumeId, + @javax.annotation.Nonnull UpdateVolumePayload updateVolumePayload, + 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 = updateVolumePayload; + + // create path and map variables + String localVarPath = + "/v2beta1/projects/{projectId}/regions/{region}/volumes/{volumeId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "volumeId" + "}", + localVarApiClient.escapeString(volumeId.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, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateVolumeValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID volumeId, + @javax.annotation.Nonnull UpdateVolumePayload updateVolumePayload, + 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 updateVolume(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling updateVolume(Async)"); + } + + // verify the required parameter 'volumeId' is set + if (volumeId == null) { + throw new ApiException( + "Missing the required parameter 'volumeId' when calling updateVolume(Async)"); + } + + // verify the required parameter 'updateVolumePayload' is set + if (updateVolumePayload == null) { + throw new ApiException( + "Missing the required parameter 'updateVolumePayload' when calling updateVolume(Async)"); + } + + return updateVolumeCall(projectId, region, volumeId, updateVolumePayload, _callback); + } + + /** + * Update information of a volume. Update name, description or labels of the volume. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @param updateVolumePayload Request an update of a volume. (required) + * @return Volume + * @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 Volume has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public Volume updateVolume( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID volumeId, + @javax.annotation.Nonnull UpdateVolumePayload updateVolumePayload) + throws ApiException { + ApiResponse localVarResp = + updateVolumeWithHttpInfo(projectId, region, volumeId, updateVolumePayload); + return localVarResp.getData(); + } + + /** + * Update information of a volume. Update name, description or labels of the volume. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @param updateVolumePayload Request an update of a volume. (required) + * @return ApiResponse<Volume> + * @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 Volume has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse updateVolumeWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID volumeId, + @javax.annotation.Nonnull UpdateVolumePayload updateVolumePayload) + throws ApiException { + okhttp3.Call localVarCall = + updateVolumeValidateBeforeCall( + projectId, region, volumeId, updateVolumePayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update information of a volume. (asynchronously) Update name, description or labels of the + * volume. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param volumeId The identifier (ID) of a STACKIT Volume. (required) + * @param updateVolumePayload Request an update of a volume. (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 Volume has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call updateVolumeAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID volumeId, + @javax.annotation.Nonnull UpdateVolumePayload updateVolumePayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + updateVolumeValidateBeforeCall( + projectId, region, volumeId, updateVolumePayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for v2beta1ConfigureNetworkAreaRegion + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param v2beta1ConfigureNetworkAreaRegionPayload Request to add a new regional network area + * configuration. (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
202 Configure network area in a new region was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call v2beta1ConfigureNetworkAreaRegionCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull + V2beta1ConfigureNetworkAreaRegionPayload + v2beta1ConfigureNetworkAreaRegionPayload, + 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 = v2beta1ConfigureNetworkAreaRegionPayload; + + // create path and map variables + String localVarPath = + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "areaId" + "}", + localVarApiClient.escapeString(areaId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/json"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "PUT", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call v2beta1ConfigureNetworkAreaRegionValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull + V2beta1ConfigureNetworkAreaRegionPayload + v2beta1ConfigureNetworkAreaRegionPayload, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling v2beta1ConfigureNetworkAreaRegion(Async)"); + } + + // verify the required parameter 'areaId' is set + if (areaId == null) { + throw new ApiException( + "Missing the required parameter 'areaId' when calling v2beta1ConfigureNetworkAreaRegion(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling v2beta1ConfigureNetworkAreaRegion(Async)"); + } + + // verify the required parameter 'v2beta1ConfigureNetworkAreaRegionPayload' is set + if (v2beta1ConfigureNetworkAreaRegionPayload == null) { + throw new ApiException( + "Missing the required parameter 'v2beta1ConfigureNetworkAreaRegionPayload' when calling v2beta1ConfigureNetworkAreaRegion(Async)"); + } + + return v2beta1ConfigureNetworkAreaRegionCall( + organizationId, + areaId, + region, + v2beta1ConfigureNetworkAreaRegionPayload, + _callback); + } + + /** + * Configure a region for a network area. Configure a new region for a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param v2beta1ConfigureNetworkAreaRegionPayload Request to add a new regional network area + * configuration. (required) + * @return RegionalArea + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Configure network area in a new region was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public RegionalArea v2beta1ConfigureNetworkAreaRegion( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull + V2beta1ConfigureNetworkAreaRegionPayload + v2beta1ConfigureNetworkAreaRegionPayload) + throws ApiException { + ApiResponse localVarResp = + v2beta1ConfigureNetworkAreaRegionWithHttpInfo( + organizationId, areaId, region, v2beta1ConfigureNetworkAreaRegionPayload); + return localVarResp.getData(); + } + + /** + * Configure a region for a network area. Configure a new region for a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param v2beta1ConfigureNetworkAreaRegionPayload Request to add a new regional network area + * configuration. (required) + * @return ApiResponse<RegionalArea> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Configure network area in a new region was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse v2beta1ConfigureNetworkAreaRegionWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull + V2beta1ConfigureNetworkAreaRegionPayload + v2beta1ConfigureNetworkAreaRegionPayload) + throws ApiException { + okhttp3.Call localVarCall = + v2beta1ConfigureNetworkAreaRegionValidateBeforeCall( + organizationId, + areaId, + region, + v2beta1ConfigureNetworkAreaRegionPayload, + null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Configure a region for a network area. (asynchronously) Configure a new region for a network + * area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param v2beta1ConfigureNetworkAreaRegionPayload Request to add a new regional network area + * configuration. (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
202 Configure network area in a new region was accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call v2beta1ConfigureNetworkAreaRegionAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull + V2beta1ConfigureNetworkAreaRegionPayload + v2beta1ConfigureNetworkAreaRegionPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + v2beta1ConfigureNetworkAreaRegionValidateBeforeCall( + organizationId, + areaId, + region, + v2beta1ConfigureNetworkAreaRegionPayload, + _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for v2beta1CreateSnapshot + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param v2beta1CreateSnapshotPayload Request a snapshot creation. (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 Create request for Snapshot accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call v2beta1CreateSnapshotCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull V2beta1CreateSnapshotPayload v2beta1CreateSnapshotPayload, + 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 = v2beta1CreateSnapshotPayload; + + // create path and map variables + String localVarPath = + "/v2beta1/projects/{projectId}/regions/{region}/snapshots" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/json"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "POST", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call v2beta1CreateSnapshotValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull V2beta1CreateSnapshotPayload v2beta1CreateSnapshotPayload, + 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 v2beta1CreateSnapshot(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling v2beta1CreateSnapshot(Async)"); + } + + // verify the required parameter 'v2beta1CreateSnapshotPayload' is set + if (v2beta1CreateSnapshotPayload == null) { + throw new ApiException( + "Missing the required parameter 'v2beta1CreateSnapshotPayload' when calling v2beta1CreateSnapshot(Async)"); + } + + return v2beta1CreateSnapshotCall( + projectId, region, v2beta1CreateSnapshotPayload, _callback); + } + + /** + * Create new Snapshot. Create a new Snapshot from a Volume in a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param v2beta1CreateSnapshotPayload Request a snapshot creation. (required) + * @return Snapshot + * @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 Create request for Snapshot accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public Snapshot v2beta1CreateSnapshot( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull V2beta1CreateSnapshotPayload v2beta1CreateSnapshotPayload) + throws ApiException { + ApiResponse localVarResp = + v2beta1CreateSnapshotWithHttpInfo(projectId, region, v2beta1CreateSnapshotPayload); + return localVarResp.getData(); + } + + /** + * Create new Snapshot. Create a new Snapshot from a Volume in a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param v2beta1CreateSnapshotPayload Request a snapshot creation. (required) + * @return ApiResponse<Snapshot> + * @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 Create request for Snapshot accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse v2beta1CreateSnapshotWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull V2beta1CreateSnapshotPayload v2beta1CreateSnapshotPayload) + throws ApiException { + okhttp3.Call localVarCall = + v2beta1CreateSnapshotValidateBeforeCall( + projectId, region, v2beta1CreateSnapshotPayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create new Snapshot. (asynchronously) Create a new Snapshot from a Volume in a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param v2beta1CreateSnapshotPayload Request a snapshot creation. (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 Create request for Snapshot accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call v2beta1CreateSnapshotAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull V2beta1CreateSnapshotPayload v2beta1CreateSnapshotPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + v2beta1CreateSnapshotValidateBeforeCall( + projectId, region, v2beta1CreateSnapshotPayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for v2beta1DeleteNetworkAreaRegion + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (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
202 Regional configuration has been deleted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call v2beta1DeleteNetworkAreaRegionCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + 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 = + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "areaId" + "}", + localVarApiClient.escapeString(areaId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {}; + 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 v2beta1DeleteNetworkAreaRegionValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling v2beta1DeleteNetworkAreaRegion(Async)"); + } + + // verify the required parameter 'areaId' is set + if (areaId == null) { + throw new ApiException( + "Missing the required parameter 'areaId' when calling v2beta1DeleteNetworkAreaRegion(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling v2beta1DeleteNetworkAreaRegion(Async)"); + } + + return v2beta1DeleteNetworkAreaRegionCall(organizationId, areaId, region, _callback); + } + + /** + * Delete a configuration of region for a network area. Delete a current configuration of region + * for a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Regional configuration has been deleted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public void v2beta1DeleteNetworkAreaRegion( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region) + throws ApiException { + v2beta1DeleteNetworkAreaRegionWithHttpInfo(organizationId, areaId, region); + } + + /** + * Delete a configuration of region for a network area. Delete a current configuration of region + * for a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
202 Regional configuration has been deleted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse v2beta1DeleteNetworkAreaRegionWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region) + throws ApiException { + okhttp3.Call localVarCall = + v2beta1DeleteNetworkAreaRegionValidateBeforeCall( + organizationId, areaId, region, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete a configuration of region for a network area. (asynchronously) Delete a current + * configuration of region for a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (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
202 Regional configuration has been deleted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call v2beta1DeleteNetworkAreaRegionAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + v2beta1DeleteNetworkAreaRegionValidateBeforeCall( + organizationId, areaId, region, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for v2beta1DeleteSnapshot + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param snapshotId The identifier (ID) of a STACKIT Snapshot. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Snapshot delete request has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call v2beta1DeleteSnapshotCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID snapshotId, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/snapshots/{snapshotId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "snapshotId" + "}", + localVarApiClient.escapeString(snapshotId.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 v2beta1DeleteSnapshotValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID snapshotId, + 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 v2beta1DeleteSnapshot(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling v2beta1DeleteSnapshot(Async)"); + } + + // verify the required parameter 'snapshotId' is set + if (snapshotId == null) { + throw new ApiException( + "Missing the required parameter 'snapshotId' when calling v2beta1DeleteSnapshot(Async)"); + } + + return v2beta1DeleteSnapshotCall(projectId, region, snapshotId, _callback); + } + + /** + * Delete a snapshot. Delete a snapshot that is part of the project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param snapshotId The identifier (ID) of a STACKIT Snapshot. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Snapshot delete request has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public void v2beta1DeleteSnapshot( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID snapshotId) + throws ApiException { + v2beta1DeleteSnapshotWithHttpInfo(projectId, region, snapshotId); + } + + /** + * Delete a snapshot. Delete a snapshot that is part of the project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param snapshotId The identifier (ID) of a STACKIT Snapshot. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Snapshot delete request has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse v2beta1DeleteSnapshotWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID snapshotId) + throws ApiException { + okhttp3.Call localVarCall = + v2beta1DeleteSnapshotValidateBeforeCall(projectId, region, snapshotId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete a snapshot. (asynchronously) Delete a snapshot that is part of the project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param snapshotId The identifier (ID) of a STACKIT Snapshot. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
204 Snapshot delete request has been accepted. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call v2beta1DeleteSnapshotAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID snapshotId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + v2beta1DeleteSnapshotValidateBeforeCall(projectId, region, snapshotId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + /** + * Build call for v2beta1GetAreaRegion + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (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 Show configured region details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call v2beta1GetAreaRegionCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + 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 = + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "areaId" + "}", + localVarApiClient.escapeString(areaId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {}; + 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 v2beta1GetAreaRegionValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling v2beta1GetAreaRegion(Async)"); + } + + // verify the required parameter 'areaId' is set + if (areaId == null) { + throw new ApiException( + "Missing the required parameter 'areaId' when calling v2beta1GetAreaRegion(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling v2beta1GetAreaRegion(Async)"); + } + + return v2beta1GetAreaRegionCall(organizationId, areaId, region, _callback); + } + + /** + * Get details about a configured region. Get details about a configured region in a network + * area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @return RegionalArea + * @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 Show configured region details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public RegionalArea v2beta1GetAreaRegion( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region) + throws ApiException { + ApiResponse localVarResp = + v2beta1GetAreaRegionWithHttpInfo(organizationId, areaId, region); + return localVarResp.getData(); + } + + /** + * Get details about a configured region. Get details about a configured region in a network + * area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @return ApiResponse<RegionalArea> + * @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 Show configured region details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse v2beta1GetAreaRegionWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region) + throws ApiException { + okhttp3.Call localVarCall = + v2beta1GetAreaRegionValidateBeforeCall(organizationId, areaId, region, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get details about a configured region. (asynchronously) Get details about a configured region + * in a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (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 Show configured region details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call v2beta1GetAreaRegionAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + v2beta1GetAreaRegionValidateBeforeCall(organizationId, areaId, region, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for v2beta1GetSnapshot + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param snapshotId The identifier (ID) of a STACKIT Snapshot. (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 Show snapshot details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call v2beta1GetSnapshotCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID snapshotId, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/snapshots/{snapshotId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "snapshotId" + "}", + localVarApiClient.escapeString(snapshotId.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 v2beta1GetSnapshotValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID snapshotId, + 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 v2beta1GetSnapshot(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling v2beta1GetSnapshot(Async)"); + } + + // verify the required parameter 'snapshotId' is set + if (snapshotId == null) { + throw new ApiException( + "Missing the required parameter 'snapshotId' when calling v2beta1GetSnapshot(Async)"); + } + + return v2beta1GetSnapshotCall(projectId, region, snapshotId, _callback); + } + + /** + * Get details about a snapshot. Get details about a block device snapshot. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param snapshotId The identifier (ID) of a STACKIT Snapshot. (required) + * @return Snapshot + * @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 Show snapshot details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public Snapshot v2beta1GetSnapshot( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID snapshotId) + throws ApiException { + ApiResponse localVarResp = + v2beta1GetSnapshotWithHttpInfo(projectId, region, snapshotId); + return localVarResp.getData(); + } + + /** + * Get details about a snapshot. Get details about a block device snapshot. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param snapshotId The identifier (ID) of a STACKIT Snapshot. (required) + * @return ApiResponse<Snapshot> + * @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 Show snapshot details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse v2beta1GetSnapshotWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID snapshotId) + throws ApiException { + okhttp3.Call localVarCall = + v2beta1GetSnapshotValidateBeforeCall(projectId, region, snapshotId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get details about a snapshot. (asynchronously) Get details about a block device snapshot. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param snapshotId The identifier (ID) of a STACKIT Snapshot. (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 Show snapshot details. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call v2beta1GetSnapshotAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID snapshotId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + v2beta1GetSnapshotValidateBeforeCall(projectId, region, snapshotId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for v2beta1ListAreaRegions + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (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 List all configured area regions. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call v2beta1ListAreaRegionsCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + 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 = + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "areaId" + "}", + localVarApiClient.escapeString(areaId.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 v2beta1ListAreaRegionsValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling v2beta1ListAreaRegions(Async)"); + } + + // verify the required parameter 'areaId' is set + if (areaId == null) { + throw new ApiException( + "Missing the required parameter 'areaId' when calling v2beta1ListAreaRegions(Async)"); + } + + return v2beta1ListAreaRegionsCall(organizationId, areaId, _callback); + } + + /** + * List all configured regions in a network area. Get a list of all configured regions. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @return RegionalAreaListResponse + * @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 List all configured area regions. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public RegionalAreaListResponse v2beta1ListAreaRegions( + @javax.annotation.Nonnull UUID organizationId, @javax.annotation.Nonnull UUID areaId) + throws ApiException { + ApiResponse localVarResp = + v2beta1ListAreaRegionsWithHttpInfo(organizationId, areaId); + return localVarResp.getData(); + } + + /** + * List all configured regions in a network area. Get a list of all configured regions. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @return ApiResponse<RegionalAreaListResponse> + * @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 List all configured area regions. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse v2beta1ListAreaRegionsWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, @javax.annotation.Nonnull UUID areaId) + throws ApiException { + okhttp3.Call localVarCall = + v2beta1ListAreaRegionsValidateBeforeCall(organizationId, areaId, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List all configured regions in a network area. (asynchronously) Get a list of all configured + * regions. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (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 List all configured area regions. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call v2beta1ListAreaRegionsAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + v2beta1ListAreaRegionsValidateBeforeCall(organizationId, areaId, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for v2beta1ListSnapshotsInProject + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param labelSelector Filter resources by labels. (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 List project snapshots. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call v2beta1ListSnapshotsInProjectCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector, + 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 = + "/v2beta1/projects/{projectId}/regions/{region}/snapshots" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (labelSelector != null) { + localVarQueryParams.addAll( + localVarApiClient.parameterToPair("label_selector", labelSelector)); + } + + 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 v2beta1ListSnapshotsInProjectValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector, + 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 v2beta1ListSnapshotsInProject(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling v2beta1ListSnapshotsInProject(Async)"); + } + + return v2beta1ListSnapshotsInProjectCall(projectId, region, labelSelector, _callback); + } + + /** + * List all snapshots inside a project. Get a list of all snapshots inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return SnapshotListResponse + * @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 List project snapshots. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public SnapshotListResponse v2beta1ListSnapshotsInProject( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + ApiResponse localVarResp = + v2beta1ListSnapshotsInProjectWithHttpInfo(projectId, region, labelSelector); + return localVarResp.getData(); + } + + /** + * List all snapshots inside a project. Get a list of all snapshots inside a project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param labelSelector Filter resources by labels. (optional) + * @return ApiResponse<SnapshotListResponse> + * @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 List project snapshots. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse v2beta1ListSnapshotsInProjectWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector) + throws ApiException { + okhttp3.Call localVarCall = + v2beta1ListSnapshotsInProjectValidateBeforeCall( + projectId, region, labelSelector, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List all snapshots inside a project. (asynchronously) Get a list of all snapshots inside a + * project. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param labelSelector Filter resources by labels. (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 List project snapshots. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call v2beta1ListSnapshotsInProjectAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nullable String labelSelector, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + v2beta1ListSnapshotsInProjectValidateBeforeCall( + projectId, region, labelSelector, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for v2beta1UpdateBackup + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param backupId The identifier (ID) of a STACKIT Backup. (required) + * @param v2beta1UpdateBackupPayload Request an update of a backup. (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 Backup has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call v2beta1UpdateBackupCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID backupId, + @javax.annotation.Nonnull V2beta1UpdateBackupPayload v2beta1UpdateBackupPayload, + 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 = v2beta1UpdateBackupPayload; + + // create path and map variables + String localVarPath = + "/v2beta1/projects/{projectId}/regions/{region}/backups/{backupId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "backupId" + "}", + localVarApiClient.escapeString(backupId.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, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call v2beta1UpdateBackupValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID backupId, + @javax.annotation.Nonnull V2beta1UpdateBackupPayload v2beta1UpdateBackupPayload, + 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 v2beta1UpdateBackup(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling v2beta1UpdateBackup(Async)"); + } + + // verify the required parameter 'backupId' is set + if (backupId == null) { + throw new ApiException( + "Missing the required parameter 'backupId' when calling v2beta1UpdateBackup(Async)"); + } + + // verify the required parameter 'v2beta1UpdateBackupPayload' is set + if (v2beta1UpdateBackupPayload == null) { + throw new ApiException( + "Missing the required parameter 'v2beta1UpdateBackupPayload' when calling v2beta1UpdateBackup(Async)"); + } + + return v2beta1UpdateBackupCall( + projectId, region, backupId, v2beta1UpdateBackupPayload, _callback); + } + + /** + * Update information of a backup. Update name or labels of the backup. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param backupId The identifier (ID) of a STACKIT Backup. (required) + * @param v2beta1UpdateBackupPayload Request an update of a backup. (required) + * @return Backup + * @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 Backup has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public Backup v2beta1UpdateBackup( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID backupId, + @javax.annotation.Nonnull V2beta1UpdateBackupPayload v2beta1UpdateBackupPayload) + throws ApiException { + ApiResponse localVarResp = + v2beta1UpdateBackupWithHttpInfo( + projectId, region, backupId, v2beta1UpdateBackupPayload); + return localVarResp.getData(); + } + + /** + * Update information of a backup. Update name or labels of the backup. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param backupId The identifier (ID) of a STACKIT Backup. (required) + * @param v2beta1UpdateBackupPayload Request an update of a backup. (required) + * @return ApiResponse<Backup> + * @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 Backup has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse v2beta1UpdateBackupWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID backupId, + @javax.annotation.Nonnull V2beta1UpdateBackupPayload v2beta1UpdateBackupPayload) + throws ApiException { + okhttp3.Call localVarCall = + v2beta1UpdateBackupValidateBeforeCall( + projectId, region, backupId, v2beta1UpdateBackupPayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update information of a backup. (asynchronously) Update name or labels of the backup. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param backupId The identifier (ID) of a STACKIT Backup. (required) + * @param v2beta1UpdateBackupPayload Request an update of a backup. (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 Backup has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call v2beta1UpdateBackupAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID backupId, + @javax.annotation.Nonnull V2beta1UpdateBackupPayload v2beta1UpdateBackupPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + v2beta1UpdateBackupValidateBeforeCall( + projectId, region, backupId, v2beta1UpdateBackupPayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for v2beta1UpdateNetworkAreaRegion + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param v2beta1UpdateNetworkAreaRegionPayload Request an update of a regional network area. + * (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 Regional area has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call v2beta1UpdateNetworkAreaRegionCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull + V2beta1UpdateNetworkAreaRegionPayload v2beta1UpdateNetworkAreaRegionPayload, + 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 = v2beta1UpdateNetworkAreaRegionPayload; + + // create path and map variables + String localVarPath = + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "areaId" + "}", + localVarApiClient.escapeString(areaId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = {"application/json"}; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = {"application/json"}; + final String localVarContentType = + localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] {}; + return localVarApiClient.buildCall( + basePath, + localVarPath, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call v2beta1UpdateNetworkAreaRegionValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull + V2beta1UpdateNetworkAreaRegionPayload v2beta1UpdateNetworkAreaRegionPayload, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling v2beta1UpdateNetworkAreaRegion(Async)"); + } + + // verify the required parameter 'areaId' is set + if (areaId == null) { + throw new ApiException( + "Missing the required parameter 'areaId' when calling v2beta1UpdateNetworkAreaRegion(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling v2beta1UpdateNetworkAreaRegion(Async)"); + } + + // verify the required parameter 'v2beta1UpdateNetworkAreaRegionPayload' is set + if (v2beta1UpdateNetworkAreaRegionPayload == null) { + throw new ApiException( + "Missing the required parameter 'v2beta1UpdateNetworkAreaRegionPayload' when calling v2beta1UpdateNetworkAreaRegion(Async)"); + } + + return v2beta1UpdateNetworkAreaRegionCall( + organizationId, areaId, region, v2beta1UpdateNetworkAreaRegionPayload, _callback); + } + + /** + * Update a region for a network area. Update a new region for a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param v2beta1UpdateNetworkAreaRegionPayload Request an update of a regional network area. + * (required) + * @return RegionalArea + * @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 Regional area has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public RegionalArea v2beta1UpdateNetworkAreaRegion( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull + V2beta1UpdateNetworkAreaRegionPayload v2beta1UpdateNetworkAreaRegionPayload) + throws ApiException { + ApiResponse localVarResp = + v2beta1UpdateNetworkAreaRegionWithHttpInfo( + organizationId, areaId, region, v2beta1UpdateNetworkAreaRegionPayload); + return localVarResp.getData(); + } + + /** + * Update a region for a network area. Update a new region for a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param v2beta1UpdateNetworkAreaRegionPayload Request an update of a regional network area. + * (required) + * @return ApiResponse<RegionalArea> + * @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 Regional area has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse v2beta1UpdateNetworkAreaRegionWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull + V2beta1UpdateNetworkAreaRegionPayload v2beta1UpdateNetworkAreaRegionPayload) + throws ApiException { + okhttp3.Call localVarCall = + v2beta1UpdateNetworkAreaRegionValidateBeforeCall( + organizationId, + areaId, + region, + v2beta1UpdateNetworkAreaRegionPayload, + null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update a region for a network area. (asynchronously) Update a new region for a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param v2beta1UpdateNetworkAreaRegionPayload Request an update of a regional network area. + * (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 Regional area has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
409 A conflict has occurred. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call v2beta1UpdateNetworkAreaRegionAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull + V2beta1UpdateNetworkAreaRegionPayload v2beta1UpdateNetworkAreaRegionPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + v2beta1UpdateNetworkAreaRegionValidateBeforeCall( + organizationId, + areaId, + region, + v2beta1UpdateNetworkAreaRegionPayload, + _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for v2beta1UpdateRouteOfArea + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routeId The identifier (ID) of a STACKIT Route. (required) + * @param v2beta1UpdateRouteOfAreaPayload Request an update of a network route. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Update request for network successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call v2beta1UpdateRouteOfAreaCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routeId, + @javax.annotation.Nonnull + V2beta1UpdateRouteOfAreaPayload v2beta1UpdateRouteOfAreaPayload, + 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 = v2beta1UpdateRouteOfAreaPayload; + + // create path and map variables + String localVarPath = + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routes/{routeId}" + .replace( + "{" + "organizationId" + "}", + localVarApiClient.escapeString(organizationId.toString())) + .replace( + "{" + "areaId" + "}", + localVarApiClient.escapeString(areaId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "routeId" + "}", + localVarApiClient.escapeString(routeId.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, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call v2beta1UpdateRouteOfAreaValidateBeforeCall( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routeId, + @javax.annotation.Nonnull + V2beta1UpdateRouteOfAreaPayload v2beta1UpdateRouteOfAreaPayload, + final ApiCallback _callback) + throws ApiException { + // verify the required parameter 'organizationId' is set + if (organizationId == null) { + throw new ApiException( + "Missing the required parameter 'organizationId' when calling v2beta1UpdateRouteOfArea(Async)"); + } + + // verify the required parameter 'areaId' is set + if (areaId == null) { + throw new ApiException( + "Missing the required parameter 'areaId' when calling v2beta1UpdateRouteOfArea(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling v2beta1UpdateRouteOfArea(Async)"); + } + + // verify the required parameter 'routeId' is set + if (routeId == null) { + throw new ApiException( + "Missing the required parameter 'routeId' when calling v2beta1UpdateRouteOfArea(Async)"); + } + + // verify the required parameter 'v2beta1UpdateRouteOfAreaPayload' is set + if (v2beta1UpdateRouteOfAreaPayload == null) { + throw new ApiException( + "Missing the required parameter 'v2beta1UpdateRouteOfAreaPayload' when calling v2beta1UpdateRouteOfArea(Async)"); + } + + return v2beta1UpdateRouteOfAreaCall( + organizationId, + areaId, + region, + routeId, + v2beta1UpdateRouteOfAreaPayload, + _callback); + } + + /** + * Update a network route. Update a network route defined in a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routeId The identifier (ID) of a STACKIT Route. (required) + * @param v2beta1UpdateRouteOfAreaPayload Request an update of a network route. (required) + * @return Route + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Update request for network successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public Route v2beta1UpdateRouteOfArea( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routeId, + @javax.annotation.Nonnull + V2beta1UpdateRouteOfAreaPayload v2beta1UpdateRouteOfAreaPayload) + throws ApiException { + ApiResponse localVarResp = + v2beta1UpdateRouteOfAreaWithHttpInfo( + organizationId, areaId, region, routeId, v2beta1UpdateRouteOfAreaPayload); + return localVarResp.getData(); + } + + /** + * Update a network route. Update a network route defined in a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routeId The identifier (ID) of a STACKIT Route. (required) + * @param v2beta1UpdateRouteOfAreaPayload Request an update of a network route. (required) + * @return ApiResponse<Route> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the + * response body + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Update request for network successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse v2beta1UpdateRouteOfAreaWithHttpInfo( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routeId, + @javax.annotation.Nonnull + V2beta1UpdateRouteOfAreaPayload v2beta1UpdateRouteOfAreaPayload) + throws ApiException { + okhttp3.Call localVarCall = + v2beta1UpdateRouteOfAreaValidateBeforeCall( + organizationId, + areaId, + region, + routeId, + v2beta1UpdateRouteOfAreaPayload, + null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update a network route. (asynchronously) Update a network route defined in a network area. + * + * @param organizationId The identifier (ID) of a STACKIT Organization. (required) + * @param areaId The identifier (ID) of a STACKIT Network Area. (required) + * @param region The STACKIT Region of the resources. (required) + * @param routeId The identifier (ID) of a STACKIT Route. (required) + * @param v2beta1UpdateRouteOfAreaPayload Request an update of a network route. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body + * object + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response Details
Status Code Description Response Headers
200 Update request for network successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call v2beta1UpdateRouteOfAreaAsync( + @javax.annotation.Nonnull UUID organizationId, + @javax.annotation.Nonnull UUID areaId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID routeId, + @javax.annotation.Nonnull + V2beta1UpdateRouteOfAreaPayload v2beta1UpdateRouteOfAreaPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + v2beta1UpdateRouteOfAreaValidateBeforeCall( + organizationId, + areaId, + region, + routeId, + v2beta1UpdateRouteOfAreaPayload, + _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for v2beta1UpdateSecurityGroup + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security Group. (required) + * @param v2beta1UpdateSecurityGroupPayload Request an update of a security 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 Updating security group successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call v2beta1UpdateSecurityGroupCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID securityGroupId, + @javax.annotation.Nonnull + V2beta1UpdateSecurityGroupPayload v2beta1UpdateSecurityGroupPayload, + 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 = v2beta1UpdateSecurityGroupPayload; + + // create path and map variables + String localVarPath = + "/v2beta1/projects/{projectId}/regions/{region}/security-groups/{securityGroupId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "securityGroupId" + "}", + localVarApiClient.escapeString(securityGroupId.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, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call v2beta1UpdateSecurityGroupValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID securityGroupId, + @javax.annotation.Nonnull + V2beta1UpdateSecurityGroupPayload v2beta1UpdateSecurityGroupPayload, + 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 v2beta1UpdateSecurityGroup(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling v2beta1UpdateSecurityGroup(Async)"); + } + + // verify the required parameter 'securityGroupId' is set + if (securityGroupId == null) { + throw new ApiException( + "Missing the required parameter 'securityGroupId' when calling v2beta1UpdateSecurityGroup(Async)"); + } + + // verify the required parameter 'v2beta1UpdateSecurityGroupPayload' is set + if (v2beta1UpdateSecurityGroupPayload == null) { + throw new ApiException( + "Missing the required parameter 'v2beta1UpdateSecurityGroupPayload' when calling v2beta1UpdateSecurityGroup(Async)"); + } + + return v2beta1UpdateSecurityGroupCall( + projectId, region, securityGroupId, v2beta1UpdateSecurityGroupPayload, _callback); + } + + /** + * Update information of a security group. Update labels of the security group. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security Group. (required) + * @param v2beta1UpdateSecurityGroupPayload Request an update of a security group. (required) + * @return SecurityGroup + * @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 Updating security group successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public SecurityGroup v2beta1UpdateSecurityGroup( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID securityGroupId, + @javax.annotation.Nonnull + V2beta1UpdateSecurityGroupPayload v2beta1UpdateSecurityGroupPayload) + throws ApiException { + ApiResponse localVarResp = + v2beta1UpdateSecurityGroupWithHttpInfo( + projectId, region, securityGroupId, v2beta1UpdateSecurityGroupPayload); + return localVarResp.getData(); + } + + /** + * Update information of a security group. Update labels of the security group. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security Group. (required) + * @param v2beta1UpdateSecurityGroupPayload Request an update of a security group. (required) + * @return ApiResponse<SecurityGroup> + * @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 Updating security group successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse v2beta1UpdateSecurityGroupWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID securityGroupId, + @javax.annotation.Nonnull + V2beta1UpdateSecurityGroupPayload v2beta1UpdateSecurityGroupPayload) + throws ApiException { + okhttp3.Call localVarCall = + v2beta1UpdateSecurityGroupValidateBeforeCall( + projectId, + region, + securityGroupId, + v2beta1UpdateSecurityGroupPayload, + null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update information of a security group. (asynchronously) Update labels of the security group. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param securityGroupId The identifier (ID) of a STACKIT Security Group. (required) + * @param v2beta1UpdateSecurityGroupPayload Request an update of a security 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 Updating security group successful. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call v2beta1UpdateSecurityGroupAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID securityGroupId, + @javax.annotation.Nonnull + V2beta1UpdateSecurityGroupPayload v2beta1UpdateSecurityGroupPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + v2beta1UpdateSecurityGroupValidateBeforeCall( + projectId, + region, + securityGroupId, + v2beta1UpdateSecurityGroupPayload, + _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + /** + * Build call for v2beta1UpdateSnapshot + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param snapshotId The identifier (ID) of a STACKIT Snapshot. (required) + * @param v2beta1UpdateSnapshotPayload Request an update of a snapshot. (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 Snapshot has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call v2beta1UpdateSnapshotCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID snapshotId, + @javax.annotation.Nonnull V2beta1UpdateSnapshotPayload v2beta1UpdateSnapshotPayload, + 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 = v2beta1UpdateSnapshotPayload; + + // create path and map variables + String localVarPath = + "/v2beta1/projects/{projectId}/regions/{region}/snapshots/{snapshotId}" + .replace( + "{" + "projectId" + "}", + localVarApiClient.escapeString(projectId.toString())) + .replace( + "{" + "region" + "}", + localVarApiClient.escapeString(region.toString())) + .replace( + "{" + "snapshotId" + "}", + localVarApiClient.escapeString(snapshotId.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, + "PATCH", + localVarQueryParams, + localVarCollectionQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAuthNames, + _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call v2beta1UpdateSnapshotValidateBeforeCall( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID snapshotId, + @javax.annotation.Nonnull V2beta1UpdateSnapshotPayload v2beta1UpdateSnapshotPayload, + 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 v2beta1UpdateSnapshot(Async)"); + } + + // verify the required parameter 'region' is set + if (region == null) { + throw new ApiException( + "Missing the required parameter 'region' when calling v2beta1UpdateSnapshot(Async)"); + } + + // verify the required parameter 'snapshotId' is set + if (snapshotId == null) { + throw new ApiException( + "Missing the required parameter 'snapshotId' when calling v2beta1UpdateSnapshot(Async)"); + } + + // verify the required parameter 'v2beta1UpdateSnapshotPayload' is set + if (v2beta1UpdateSnapshotPayload == null) { + throw new ApiException( + "Missing the required parameter 'v2beta1UpdateSnapshotPayload' when calling v2beta1UpdateSnapshot(Async)"); + } + + return v2beta1UpdateSnapshotCall( + projectId, region, snapshotId, v2beta1UpdateSnapshotPayload, _callback); + } + + /** + * Update information of the snapshot. Update information like name or labels of the snapshot. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param snapshotId The identifier (ID) of a STACKIT Snapshot. (required) + * @param v2beta1UpdateSnapshotPayload Request an update of a snapshot. (required) + * @return Snapshot + * @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 Snapshot has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public Snapshot v2beta1UpdateSnapshot( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID snapshotId, + @javax.annotation.Nonnull V2beta1UpdateSnapshotPayload v2beta1UpdateSnapshotPayload) + throws ApiException { + ApiResponse localVarResp = + v2beta1UpdateSnapshotWithHttpInfo( + projectId, region, snapshotId, v2beta1UpdateSnapshotPayload); + return localVarResp.getData(); + } + + /** + * Update information of the snapshot. Update information like name or labels of the snapshot. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param snapshotId The identifier (ID) of a STACKIT Snapshot. (required) + * @param v2beta1UpdateSnapshotPayload Request an update of a snapshot. (required) + * @return ApiResponse<Snapshot> + * @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 Snapshot has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public ApiResponse v2beta1UpdateSnapshotWithHttpInfo( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID snapshotId, + @javax.annotation.Nonnull V2beta1UpdateSnapshotPayload v2beta1UpdateSnapshotPayload) + throws ApiException { + okhttp3.Call localVarCall = + v2beta1UpdateSnapshotValidateBeforeCall( + projectId, region, snapshotId, v2beta1UpdateSnapshotPayload, null); + Type localVarReturnType = new TypeToken() {}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update information of the snapshot. (asynchronously) Update information like name or labels + * of the snapshot. + * + * @param projectId The identifier (ID) of a STACKIT Project. (required) + * @param region The STACKIT Region of the resources. (required) + * @param snapshotId The identifier (ID) of a STACKIT Snapshot. (required) + * @param v2beta1UpdateSnapshotPayload Request an update of a snapshot. (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 Snapshot has been updated. -
400 A bad request. -
401 A request which was not authorized. -
403 A request which was forbidden. -
404 The object was not found. -
500 Internal Server Error, returns a 500 if something is broken on IaaS API Side. -
+ */ + public okhttp3.Call v2beta1UpdateSnapshotAsync( + @javax.annotation.Nonnull UUID projectId, + @javax.annotation.Nonnull String region, + @javax.annotation.Nonnull UUID snapshotId, + @javax.annotation.Nonnull V2beta1UpdateSnapshotPayload v2beta1UpdateSnapshotPayload, + final ApiCallback _callback) + throws ApiException { + + okhttp3.Call localVarCall = + v2beta1UpdateSnapshotValidateBeforeCall( + projectId, region, snapshotId, v2beta1UpdateSnapshotPayload, _callback); + Type localVarReturnType = new TypeToken() {}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/api/IaasApi.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/api/IaasApi.java new file mode 100644 index 00000000..461a5bf7 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/api/IaasApi.java @@ -0,0 +1,63 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.api; + +import cloud.stackit.sdk.core.config.CoreConfiguration; +import java.io.IOException; +import okhttp3.OkHttpClient; + +public class IaasApi extends DefaultApi { + /** + * Basic constructor for IaasApi + * + *

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

For production use consider using the constructor with the OkHttpClient parameter. + * + * @param configuration your STACKIT SDK CoreConfiguration + * @throws IOException + */ + public IaasApi(CoreConfiguration configuration) throws IOException { + super(configuration); + } + + /** + * Constructor for IaasApi + * + * @param httpClient OkHttpClient object + * @throws IOException + */ + public IaasApi(OkHttpClient httpClient) throws IOException { + super(httpClient); + } + + /** + * Constructor for IaasApi + * + * @param httpClient OkHttpClient object + * @param configuration your STACKIT SDK CoreConfiguration + * @throws IOException + */ + public IaasApi(OkHttpClient httpClient, CoreConfiguration configuration) throws IOException { + super(httpClient, configuration); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/AbstractOpenApiSchema.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/AbstractOpenApiSchema.java new file mode 100644 index 00000000..20c00851 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/AbstractOpenApiSchema.java @@ -0,0 +1,145 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.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/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/AddRoutesToRoutingTablePayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/AddRoutesToRoutingTablePayload.java new file mode 100644 index 00000000..c177b54a --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/AddRoutesToRoutingTablePayload.java @@ -0,0 +1,334 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** Object represents a request to add network routes. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class AddRoutesToRoutingTablePayload { + public static final String SERIALIZED_NAME_ITEMS = "items"; + + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public AddRoutesToRoutingTablePayload() {} + + public AddRoutesToRoutingTablePayload items(@javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public AddRoutesToRoutingTablePayload addItemsItem(Route itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list of routes. + * + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AddRoutesToRoutingTablePayload instance itself + */ + public AddRoutesToRoutingTablePayload 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; + } + AddRoutesToRoutingTablePayload addRoutesToRoutingTablePayload = + (AddRoutesToRoutingTablePayload) o; + return Objects.equals(this.items, addRoutesToRoutingTablePayload.items) + && Objects.equals( + this.additionalProperties, + addRoutesToRoutingTablePayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AddRoutesToRoutingTablePayload {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("items")); + } + + /** + * 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 + * AddRoutesToRoutingTablePayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AddRoutesToRoutingTablePayload.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 AddRoutesToRoutingTablePayload is not found in the empty JSON string", + AddRoutesToRoutingTablePayload.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AddRoutesToRoutingTablePayload.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("items").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `items` to be an array in the JSON string but got `%s`", + jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + Route.validateJsonElement(jsonArrayitems.get(i)); + } + ; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AddRoutesToRoutingTablePayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AddRoutesToRoutingTablePayload' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(AddRoutesToRoutingTablePayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AddRoutesToRoutingTablePayload 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 AddRoutesToRoutingTablePayload read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AddRoutesToRoutingTablePayload 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 AddRoutesToRoutingTablePayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of AddRoutesToRoutingTablePayload + * @throws IOException if the JSON string is invalid with respect to + * AddRoutesToRoutingTablePayload + */ + public static AddRoutesToRoutingTablePayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AddRoutesToRoutingTablePayload.class); + } + + /** + * Convert an instance of AddRoutesToRoutingTablePayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/AddRoutingTableToAreaPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/AddRoutingTableToAreaPayload.java new file mode 100644 index 00000000..012110aa --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/AddRoutingTableToAreaPayload.java @@ -0,0 +1,536 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; +import java.util.UUID; + +/** An object representing a routing table. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class AddRoutingTableToAreaPayload { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_DEFAULT = "default"; + + @SerializedName(SERIALIZED_NAME_DEFAULT) + @javax.annotation.Nullable private Boolean _default = true; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable private String description; + + public static final String SERIALIZED_NAME_DYNAMIC_ROUTES = "dynamicRoutes"; + + @SerializedName(SERIALIZED_NAME_DYNAMIC_ROUTES) + @javax.annotation.Nullable private Boolean dynamicRoutes = true; + + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_SYSTEM_ROUTES = "systemRoutes"; + + @SerializedName(SERIALIZED_NAME_SYSTEM_ROUTES) + @javax.annotation.Nullable private Boolean systemRoutes = true; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable private OffsetDateTime updatedAt; + + public AddRoutingTableToAreaPayload() {} + + public AddRoutingTableToAreaPayload( + OffsetDateTime createdAt, Boolean _default, UUID id, OffsetDateTime updatedAt) { + this(); + this.createdAt = createdAt; + this._default = _default; + this.id = id; + this.updatedAt = updatedAt; + } + + /** + * Date-time when resource was created. + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * This is the default routing table. It can't be deleted and is used if the user does not + * specify it otherwise. + * + * @return _default + */ + @javax.annotation.Nullable public Boolean getDefault() { + return _default; + } + + public AddRoutingTableToAreaPayload description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Description Object. Allows string up to 255 Characters. + * + * @return description + */ + @javax.annotation.Nullable public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + public AddRoutingTableToAreaPayload dynamicRoutes( + @javax.annotation.Nullable Boolean dynamicRoutes) { + this.dynamicRoutes = dynamicRoutes; + return this; + } + + /** + * A config setting for a routing table which allows propagation of dynamic routes to this + * routing table. + * + * @return dynamicRoutes + */ + @javax.annotation.Nullable public Boolean getDynamicRoutes() { + return dynamicRoutes; + } + + public void setDynamicRoutes(@javax.annotation.Nullable Boolean dynamicRoutes) { + this.dynamicRoutes = dynamicRoutes; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + public AddRoutingTableToAreaPayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public AddRoutingTableToAreaPayload name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + public AddRoutingTableToAreaPayload systemRoutes( + @javax.annotation.Nullable Boolean systemRoutes) { + this.systemRoutes = systemRoutes; + return this; + } + + /** + * A config setting for a routing table which allows installation of automatic system routes for + * connectivity between projects in the same SNA. + * + * @return systemRoutes + */ + @javax.annotation.Nullable public Boolean getSystemRoutes() { + return systemRoutes; + } + + public void setSystemRoutes(@javax.annotation.Nullable Boolean systemRoutes) { + this.systemRoutes = systemRoutes; + } + + /** + * Date-time when resource was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nullable public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * 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 AddRoutingTableToAreaPayload instance itself + */ + public AddRoutingTableToAreaPayload 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; + } + AddRoutingTableToAreaPayload addRoutingTableToAreaPayload = + (AddRoutingTableToAreaPayload) o; + return Objects.equals(this.createdAt, addRoutingTableToAreaPayload.createdAt) + && Objects.equals(this._default, addRoutingTableToAreaPayload._default) + && Objects.equals(this.description, addRoutingTableToAreaPayload.description) + && Objects.equals(this.dynamicRoutes, addRoutingTableToAreaPayload.dynamicRoutes) + && Objects.equals(this.id, addRoutingTableToAreaPayload.id) + && Objects.equals(this.labels, addRoutingTableToAreaPayload.labels) + && Objects.equals(this.name, addRoutingTableToAreaPayload.name) + && Objects.equals(this.systemRoutes, addRoutingTableToAreaPayload.systemRoutes) + && Objects.equals(this.updatedAt, addRoutingTableToAreaPayload.updatedAt) + && Objects.equals( + this.additionalProperties, + addRoutingTableToAreaPayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + createdAt, + _default, + description, + dynamicRoutes, + id, + labels, + name, + systemRoutes, + updatedAt, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AddRoutingTableToAreaPayload {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" _default: ").append(toIndentedString(_default)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" dynamicRoutes: ").append(toIndentedString(dynamicRoutes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" systemRoutes: ").append(toIndentedString(systemRoutes)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).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( + "createdAt", + "default", + "description", + "dynamicRoutes", + "id", + "labels", + "name", + "systemRoutes", + "updatedAt")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name")); + } + + /** + * 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 + * AddRoutingTableToAreaPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AddRoutingTableToAreaPayload.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 AddRoutingTableToAreaPayload is not found in the empty JSON string", + AddRoutingTableToAreaPayload.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AddRoutingTableToAreaPayload.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("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `description` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("description").toString())); + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if (!jsonObj.get("name").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())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AddRoutingTableToAreaPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AddRoutingTableToAreaPayload' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(AddRoutingTableToAreaPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AddRoutingTableToAreaPayload 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 AddRoutingTableToAreaPayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AddRoutingTableToAreaPayload 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 AddRoutingTableToAreaPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of AddRoutingTableToAreaPayload + * @throws IOException if the JSON string is invalid with respect to + * AddRoutingTableToAreaPayload + */ + public static AddRoutingTableToAreaPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AddRoutingTableToAreaPayload.class); + } + + /** + * Convert an instance of AddRoutingTableToAreaPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/AddVolumeToServerPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/AddVolumeToServerPayload.java new file mode 100644 index 00000000..59e4560f --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/AddVolumeToServerPayload.java @@ -0,0 +1,348 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +/** Object that represents a Volume attachment to a server. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class AddVolumeToServerPayload { + public static final String SERIALIZED_NAME_DELETE_ON_TERMINATION = "deleteOnTermination"; + + @SerializedName(SERIALIZED_NAME_DELETE_ON_TERMINATION) + @javax.annotation.Nullable private Boolean deleteOnTermination; + + public static final String SERIALIZED_NAME_SERVER_ID = "serverId"; + + @SerializedName(SERIALIZED_NAME_SERVER_ID) + @javax.annotation.Nullable private UUID serverId; + + public static final String SERIALIZED_NAME_VOLUME_ID = "volumeId"; + + @SerializedName(SERIALIZED_NAME_VOLUME_ID) + @javax.annotation.Nullable private UUID volumeId; + + public AddVolumeToServerPayload() {} + + public AddVolumeToServerPayload(UUID serverId, UUID volumeId) { + this(); + this.serverId = serverId; + this.volumeId = volumeId; + } + + public AddVolumeToServerPayload deleteOnTermination( + @javax.annotation.Nullable Boolean deleteOnTermination) { + this.deleteOnTermination = deleteOnTermination; + return this; + } + + /** + * Delete the volume during the termination of the server. Defaults to false. + * + * @return deleteOnTermination + */ + @javax.annotation.Nullable public Boolean getDeleteOnTermination() { + return deleteOnTermination; + } + + public void setDeleteOnTermination(@javax.annotation.Nullable Boolean deleteOnTermination) { + this.deleteOnTermination = deleteOnTermination; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return serverId + */ + @javax.annotation.Nullable public UUID getServerId() { + return serverId; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return volumeId + */ + @javax.annotation.Nullable public UUID getVolumeId() { + return volumeId; + } + + /** + * 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 AddVolumeToServerPayload instance itself + */ + public AddVolumeToServerPayload 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; + } + AddVolumeToServerPayload addVolumeToServerPayload = (AddVolumeToServerPayload) o; + return Objects.equals( + this.deleteOnTermination, addVolumeToServerPayload.deleteOnTermination) + && Objects.equals(this.serverId, addVolumeToServerPayload.serverId) + && Objects.equals(this.volumeId, addVolumeToServerPayload.volumeId) + && Objects.equals( + this.additionalProperties, addVolumeToServerPayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(deleteOnTermination, serverId, volumeId, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AddVolumeToServerPayload {\n"); + sb.append(" deleteOnTermination: ") + .append(toIndentedString(deleteOnTermination)) + .append("\n"); + sb.append(" serverId: ").append(toIndentedString(serverId)).append("\n"); + sb.append(" volumeId: ").append(toIndentedString(volumeId)).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("deleteOnTermination", "serverId", "volumeId")); + + // 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 AddVolumeToServerPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AddVolumeToServerPayload.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 AddVolumeToServerPayload is not found in the empty JSON string", + AddVolumeToServerPayload.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("serverId") != null && !jsonObj.get("serverId").isJsonNull()) + && !jsonObj.get("serverId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `serverId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("serverId").toString())); + } + if ((jsonObj.get("volumeId") != null && !jsonObj.get("volumeId").isJsonNull()) + && !jsonObj.get("volumeId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `volumeId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("volumeId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AddVolumeToServerPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AddVolumeToServerPayload' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(AddVolumeToServerPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AddVolumeToServerPayload 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 AddVolumeToServerPayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AddVolumeToServerPayload 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 AddVolumeToServerPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of AddVolumeToServerPayload + * @throws IOException if the JSON string is invalid with respect to AddVolumeToServerPayload + */ + public static AddVolumeToServerPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AddVolumeToServerPayload.class); + } + + /** + * Convert an instance of AddVolumeToServerPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/AffinityGroup.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/AffinityGroup.java new file mode 100644 index 00000000..6b1d8e5b --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/AffinityGroup.java @@ -0,0 +1,404 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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.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; +import java.util.UUID; + +/** Definition of an affinity group. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class AffinityGroup { + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_MEMBERS = "members"; + + @SerializedName(SERIALIZED_NAME_MEMBERS) + @javax.annotation.Nullable private List members = new ArrayList<>(); + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_POLICY = "policy"; + + @SerializedName(SERIALIZED_NAME_POLICY) + @javax.annotation.Nonnull + private String policy; + + public AffinityGroup() {} + + public AffinityGroup(UUID id, List members) { + this(); + this.id = id; + this.members = members; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + /** + * The servers that are part of the affinity group. + * + * @return members + */ + @javax.annotation.Nullable public List getMembers() { + return members; + } + + public AffinityGroup name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + public AffinityGroup policy(@javax.annotation.Nonnull String policy) { + this.policy = policy; + return this; + } + + /** + * The affinity group policy. `hard-affinity`: All servers in this group will be + * hosted on the same compute node. `soft-affinity`: All servers in this group will be + * hosted on as few compute nodes as possible. `hard-anti-affinity`: All servers in + * this group will be hosted on different compute nodes. `soft-anti-affinity`: All + * servers in this group will be hosted on as many compute nodes as possible. Possible values: + * `hard-anti-affinity`, `hard-affinity`, `soft-anti-affinity`, + * `soft-affinity`. + * + * @return policy + */ + @javax.annotation.Nonnull + public String getPolicy() { + return policy; + } + + public void setPolicy(@javax.annotation.Nonnull String policy) { + this.policy = policy; + } + + /** + * 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 AffinityGroup instance itself + */ + public AffinityGroup 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; + } + AffinityGroup affinityGroup = (AffinityGroup) o; + return Objects.equals(this.id, affinityGroup.id) + && Objects.equals(this.members, affinityGroup.members) + && Objects.equals(this.name, affinityGroup.name) + && Objects.equals(this.policy, affinityGroup.policy) + && Objects.equals(this.additionalProperties, affinityGroup.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, members, name, policy, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AffinityGroup {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" members: ").append(toIndentedString(members)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" policy: ").append(toIndentedString(policy)).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("id", "members", "name", "policy")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name", "policy")); + } + + /** + * 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 AffinityGroup + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AffinityGroup.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 AffinityGroup is not found in the empty JSON string", + AffinityGroup.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AffinityGroup.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("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("members") != null + && !jsonObj.get("members").isJsonNull() + && !jsonObj.get("members").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `members` to be an array in the JSON string but got `%s`", + jsonObj.get("members").toString())); + } + 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("policy").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `policy` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("policy").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AffinityGroup.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AffinityGroup' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(AffinityGroup.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AffinityGroup 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 AffinityGroup read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AffinityGroup 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 AffinityGroup given an JSON string + * + * @param jsonString JSON string + * @return An instance of AffinityGroup + * @throws IOException if the JSON string is invalid with respect to AffinityGroup + */ + public static AffinityGroup fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AffinityGroup.class); + } + + /** + * Convert an instance of AffinityGroup to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/AffinityGroupListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/AffinityGroupListResponse.java new file mode 100644 index 00000000..8f9e5b6c --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/AffinityGroupListResponse.java @@ -0,0 +1,327 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** Response object for affinity group list request. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class AffinityGroupListResponse { + public static final String SERIALIZED_NAME_ITEMS = "items"; + + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public AffinityGroupListResponse() {} + + public AffinityGroupListResponse items(@javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public AffinityGroupListResponse addItemsItem(AffinityGroup itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list of affinity groups. + * + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AffinityGroupListResponse instance itself + */ + public AffinityGroupListResponse 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; + } + AffinityGroupListResponse affinityGroupListResponse = (AffinityGroupListResponse) o; + return Objects.equals(this.items, affinityGroupListResponse.items) + && Objects.equals( + this.additionalProperties, affinityGroupListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AffinityGroupListResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("items")); + } + + /** + * 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 AffinityGroupListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AffinityGroupListResponse.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 AffinityGroupListResponse is not found in the empty JSON string", + AffinityGroupListResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AffinityGroupListResponse.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("items").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `items` to be an array in the JSON string but got `%s`", + jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + AffinityGroup.validateJsonElement(jsonArrayitems.get(i)); + } + ; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AffinityGroupListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AffinityGroupListResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(AffinityGroupListResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AffinityGroupListResponse 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 AffinityGroupListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AffinityGroupListResponse 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 AffinityGroupListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of AffinityGroupListResponse + * @throws IOException if the JSON string is invalid with respect to AffinityGroupListResponse + */ + public static AffinityGroupListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AffinityGroupListResponse.class); + } + + /** + * Convert an instance of AffinityGroupListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/AllowedAddressesInner.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/AllowedAddressesInner.java new file mode 100644 index 00000000..9862b6c5 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/AllowedAddressesInner.java @@ -0,0 +1,241 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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 AllowedAddressesInner extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(AllowedAddressesInner.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AllowedAddressesInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AllowedAddressesInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterString = + gson.getDelegateAdapter(this, TypeToken.get(String.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AllowedAddressesInner 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; + } + throw new IOException( + "Failed to serialize as the type doesn't match oneOf schemas: String"); + } + + @Override + public AllowedAddressesInner read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + 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; + match++; + log.log(Level.FINER, "Input data matches schema 'String'"); + } 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); + } + + if (match == 1) { + AllowedAddressesInner ret = new AllowedAddressesInner(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException( + String.format( + java.util.Locale.ROOT, + "Failed deserialization for AllowedAddressesInner: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", + match, + errorMessages, + jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public AllowedAddressesInner() { + super("oneOf", Boolean.FALSE); + } + + public AllowedAddressesInner(Object o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("String", String.class); + } + + @Override + public Map> getSchemas() { + return AllowedAddressesInner.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: String + * + *

It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof String) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be String"); + } + + /** + * Get the actual instance, which can be the following: String + * + * @return The actual instance (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(); + } + + /** + * 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 AllowedAddressesInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + 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())); + } + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for String failed with `%s`.", + e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException( + String.format( + java.util.Locale.ROOT, + "The JSON string is invalid for AllowedAddressesInner with oneOf schemas: String. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", + validCount, + errorMessages, + jsonElement.toString())); + } + } + + /** + * Create an instance of AllowedAddressesInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of AllowedAddressesInner + * @throws IOException if the JSON string is invalid with respect to AllowedAddressesInner + */ + public static AllowedAddressesInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AllowedAddressesInner.class); + } + + /** + * Convert an instance of AllowedAddressesInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/AreaId.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/AreaId.java new file mode 100644 index 00000000..d2bc0a83 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/AreaId.java @@ -0,0 +1,281 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +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.UUID; +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 AreaId extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(AreaId.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AreaId.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AreaId' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterUUID = + gson.getDelegateAdapter(this, TypeToken.get(UUID.class)); + final TypeAdapter adapterStaticAreaID = + gson.getDelegateAdapter(this, TypeToken.get(StaticAreaID.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AreaId value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `UUID` + if (value.getActualInstance() instanceof UUID) { + JsonElement element = + adapterUUID.toJsonTree((UUID) value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `StaticAreaID` + if (value.getActualInstance() instanceof StaticAreaID) { + JsonElement element = + adapterStaticAreaID.toJsonTree( + (StaticAreaID) value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException( + "Failed to serialize as the type doesn't match oneOf schemas: StaticAreaID, UUID"); + } + + @Override + public AreaId read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize UUID + try { + // validate the JSON object to see if any exception is thrown + UUID.fromString(jsonElement.getAsString()); + actualAdapter = adapterUUID; + match++; + log.log(Level.FINER, "Input data matches schema 'UUID'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for UUID failed with `%s`.", + e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'UUID'", e); + } + // deserialize StaticAreaID + try { + // validate the JSON object to see if any exception is thrown + StaticAreaID.validateJsonElement(jsonElement); + actualAdapter = adapterStaticAreaID; + match++; + log.log(Level.FINER, "Input data matches schema 'StaticAreaID'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for StaticAreaID failed with `%s`.", + e.getMessage())); + log.log( + Level.FINER, + "Input data does not match schema 'StaticAreaID'", + e); + } + + if (match == 1) { + AreaId ret = new AreaId(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException( + String.format( + java.util.Locale.ROOT, + "Failed deserialization for AreaId: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", + match, + errorMessages, + jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public AreaId() { + super("oneOf", Boolean.FALSE); + } + + public AreaId(Object o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("UUID", UUID.class); + schemas.put("StaticAreaID", StaticAreaID.class); + } + + @Override + public Map> getSchemas() { + return AreaId.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: StaticAreaID, UUID + * + *

It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof UUID) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof StaticAreaID) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be StaticAreaID, UUID"); + } + + /** + * Get the actual instance, which can be the following: StaticAreaID, UUID + * + * @return The actual instance (StaticAreaID, UUID) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `UUID`. If the actual instance is not `UUID`, the + * ClassCastException will be thrown. + * + * @return The actual instance of `UUID` + * @throws ClassCastException if the instance is not `UUID` + */ + public UUID getUUID() throws ClassCastException { + return (UUID) super.getActualInstance(); + } + + /** + * Get the actual instance of `StaticAreaID`. If the actual instance is not `StaticAreaID`, the + * ClassCastException will be thrown. + * + * @return The actual instance of `StaticAreaID` + * @throws ClassCastException if the instance is not `StaticAreaID` + */ + public StaticAreaID getStaticAreaID() throws ClassCastException { + return (StaticAreaID) 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 AreaId + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with UUID + try { + UUID.fromString(jsonElement.getAsString()); + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for UUID failed with `%s`.", + e.getMessage())); + // continue to the next one + } + // validate the json string with StaticAreaID + try { + StaticAreaID.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for StaticAreaID failed with `%s`.", + e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException( + String.format( + java.util.Locale.ROOT, + "The JSON string is invalid for AreaId with oneOf schemas: StaticAreaID, UUID. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", + validCount, + errorMessages, + jsonElement.toString())); + } + } + + /** + * Create an instance of AreaId given an JSON string + * + * @param jsonString JSON string + * @return An instance of AreaId + * @throws IOException if the JSON string is invalid with respect to AreaId + */ + public static AreaId fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AreaId.class); + } + + /** + * Convert an instance of AreaId to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/AvailabilityZoneListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/AvailabilityZoneListResponse.java new file mode 100644 index 00000000..c5776343 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/AvailabilityZoneListResponse.java @@ -0,0 +1,328 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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.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; + +/** Availability Zone list response. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class AvailabilityZoneListResponse { + public static final String SERIALIZED_NAME_ITEMS = "items"; + + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public AvailabilityZoneListResponse() {} + + public AvailabilityZoneListResponse items(@javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public AvailabilityZoneListResponse addItemsItem(String itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list of availability zones. + * + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AvailabilityZoneListResponse instance itself + */ + public AvailabilityZoneListResponse 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; + } + AvailabilityZoneListResponse availabilityZoneListResponse = + (AvailabilityZoneListResponse) o; + return Objects.equals(this.items, availabilityZoneListResponse.items) + && Objects.equals( + this.additionalProperties, + availabilityZoneListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AvailabilityZoneListResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("items")); + } + + /** + * 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 + * AvailabilityZoneListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AvailabilityZoneListResponse.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 AvailabilityZoneListResponse is not found in the empty JSON string", + AvailabilityZoneListResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AvailabilityZoneListResponse.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 required json array is present + if (jsonObj.get("items") == null) { + throw new IllegalArgumentException( + "Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("items").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `items` to be an array in the JSON string but got `%s`", + jsonObj.get("items").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AvailabilityZoneListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AvailabilityZoneListResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(AvailabilityZoneListResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, AvailabilityZoneListResponse 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 AvailabilityZoneListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AvailabilityZoneListResponse 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 AvailabilityZoneListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of AvailabilityZoneListResponse + * @throws IOException if the JSON string is invalid with respect to + * AvailabilityZoneListResponse + */ + public static AvailabilityZoneListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AvailabilityZoneListResponse.class); + } + + /** + * Convert an instance of AvailabilityZoneListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/Backup.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/Backup.java new file mode 100644 index 00000000..5bdcebe2 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/Backup.java @@ -0,0 +1,592 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; +import java.util.UUID; + +/** Object that represents a backup. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class Backup { + public static final String SERIALIZED_NAME_AVAILABILITY_ZONE = "availabilityZone"; + + @SerializedName(SERIALIZED_NAME_AVAILABILITY_ZONE) + @javax.annotation.Nullable private String availabilityZone; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable private String description; + + public static final String SERIALIZED_NAME_ENCRYPTED = "encrypted"; + + @SerializedName(SERIALIZED_NAME_ENCRYPTED) + @javax.annotation.Nullable private Boolean encrypted; + + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; + + public static final String SERIALIZED_NAME_SIZE = "size"; + + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nullable private Long size; + + public static final String SERIALIZED_NAME_SNAPSHOT_ID = "snapshotId"; + + @SerializedName(SERIALIZED_NAME_SNAPSHOT_ID) + @javax.annotation.Nullable private UUID snapshotId; + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable private String status; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable private OffsetDateTime updatedAt; + + public static final String SERIALIZED_NAME_VOLUME_ID = "volumeId"; + + @SerializedName(SERIALIZED_NAME_VOLUME_ID) + @javax.annotation.Nullable private UUID volumeId; + + public Backup() {} + + public Backup( + String availabilityZone, + OffsetDateTime createdAt, + Boolean encrypted, + UUID id, + Long size, + UUID snapshotId, + String status, + OffsetDateTime updatedAt, + UUID volumeId) { + this(); + this.availabilityZone = availabilityZone; + this.createdAt = createdAt; + this.encrypted = encrypted; + this.id = id; + this.size = size; + this.snapshotId = snapshotId; + this.status = status; + this.updatedAt = updatedAt; + this.volumeId = volumeId; + } + + /** + * Object that represents an availability zone. + * + * @return availabilityZone + */ + @javax.annotation.Nullable public String getAvailabilityZone() { + return availabilityZone; + } + + /** + * Date-time when resource was created. + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public Backup description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Description Object. Allows string up to 255 Characters. + * + * @return description + */ + @javax.annotation.Nullable public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + /** + * Indicates if a volume is encrypted. + * + * @return encrypted + */ + @javax.annotation.Nullable public Boolean getEncrypted() { + return encrypted; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + public Backup labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public Backup name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nullable public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * Size in Gigabyte. + * + * @return size + */ + @javax.annotation.Nullable public Long getSize() { + return size; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return snapshotId + */ + @javax.annotation.Nullable public UUID getSnapshotId() { + return snapshotId; + } + + /** + * The status of a backup object. Possible values: `AVAILABLE`, `CREATING`, + * `DELETED`, `DELETING`, `ERROR`, `RESTORING`. + * + * @return status + */ + @javax.annotation.Nullable public String getStatus() { + return status; + } + + /** + * Date-time when resource was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nullable public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return volumeId + */ + @javax.annotation.Nullable public UUID getVolumeId() { + return volumeId; + } + + /** + * 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 Backup instance itself + */ + public Backup 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; + } + Backup backup = (Backup) o; + return Objects.equals(this.availabilityZone, backup.availabilityZone) + && Objects.equals(this.createdAt, backup.createdAt) + && Objects.equals(this.description, backup.description) + && Objects.equals(this.encrypted, backup.encrypted) + && Objects.equals(this.id, backup.id) + && Objects.equals(this.labels, backup.labels) + && Objects.equals(this.name, backup.name) + && Objects.equals(this.size, backup.size) + && Objects.equals(this.snapshotId, backup.snapshotId) + && Objects.equals(this.status, backup.status) + && Objects.equals(this.updatedAt, backup.updatedAt) + && Objects.equals(this.volumeId, backup.volumeId) + && Objects.equals(this.additionalProperties, backup.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + availabilityZone, + createdAt, + description, + encrypted, + id, + labels, + name, + size, + snapshotId, + status, + updatedAt, + volumeId, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Backup {\n"); + sb.append(" availabilityZone: ").append(toIndentedString(availabilityZone)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" encrypted: ").append(toIndentedString(encrypted)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" snapshotId: ").append(toIndentedString(snapshotId)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" volumeId: ").append(toIndentedString(volumeId)).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( + "availabilityZone", + "createdAt", + "description", + "encrypted", + "id", + "labels", + "name", + "size", + "snapshotId", + "status", + "updatedAt", + "volumeId")); + + // 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 Backup + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Backup.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 Backup is not found in the empty JSON string", + Backup.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("availabilityZone") != null + && !jsonObj.get("availabilityZone").isJsonNull()) + && !jsonObj.get("availabilityZone").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `availabilityZone` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("availabilityZone").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `description` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("description").toString())); + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `name` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("name").toString())); + } + if ((jsonObj.get("snapshotId") != null && !jsonObj.get("snapshotId").isJsonNull()) + && !jsonObj.get("snapshotId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `snapshotId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("snapshotId").toString())); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) + && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `status` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("status").toString())); + } + if ((jsonObj.get("volumeId") != null && !jsonObj.get("volumeId").isJsonNull()) + && !jsonObj.get("volumeId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `volumeId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("volumeId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Backup.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Backup' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(Backup.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, Backup 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 Backup read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Backup 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 Backup given an JSON string + * + * @param jsonString JSON string + * @return An instance of Backup + * @throws IOException if the JSON string is invalid with respect to Backup + */ + public static Backup fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Backup.class); + } + + /** + * Convert an instance of Backup to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/BackupListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/BackupListResponse.java new file mode 100644 index 00000000..d7d36a2e --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/BackupListResponse.java @@ -0,0 +1,326 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** Backup list response. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class BackupListResponse { + public static final String SERIALIZED_NAME_ITEMS = "items"; + + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public BackupListResponse() {} + + public BackupListResponse items(@javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public BackupListResponse addItemsItem(Backup itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list containing backup objects. + * + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the BackupListResponse instance itself + */ + public BackupListResponse 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; + } + BackupListResponse backupListResponse = (BackupListResponse) o; + return Objects.equals(this.items, backupListResponse.items) + && Objects.equals( + this.additionalProperties, backupListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BackupListResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("items")); + } + + /** + * 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 BackupListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BackupListResponse.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 BackupListResponse is not found in the empty JSON string", + BackupListResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BackupListResponse.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("items").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `items` to be an array in the JSON string but got `%s`", + jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + Backup.validateJsonElement(jsonArrayitems.get(i)); + } + ; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BackupListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BackupListResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(BackupListResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, BackupListResponse 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 BackupListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + BackupListResponse 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 BackupListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of BackupListResponse + * @throws IOException if the JSON string is invalid with respect to BackupListResponse + */ + public static BackupListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BackupListResponse.class); + } + + /** + * Convert an instance of BackupListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/BackupSource.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/BackupSource.java new file mode 100644 index 00000000..7c0d3dfd --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/BackupSource.java @@ -0,0 +1,341 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +/** The source object of a backup. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class BackupSource { + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private UUID id; + + public static final String SERIALIZED_NAME_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private String type; + + public BackupSource() {} + + public BackupSource id(@javax.annotation.Nonnull UUID id) { + this.id = id; + return this; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nonnull + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull UUID id) { + this.id = id; + } + + public BackupSource type(@javax.annotation.Nonnull String type) { + this.type = type; + return this; + } + + /** + * The source types of a backup. Possible values: `volume`, `snapshot`. + * + * @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 BackupSource instance itself + */ + public BackupSource 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; + } + BackupSource backupSource = (BackupSource) o; + return Objects.equals(this.id, backupSource.id) + && Objects.equals(this.type, backupSource.type) + && Objects.equals(this.additionalProperties, backupSource.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BackupSource {\n"); + sb.append(" id: ").append(toIndentedString(id)).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("id", "type")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("id", "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 BackupSource + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BackupSource.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 BackupSource is not found in the empty JSON string", + BackupSource.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BackupSource.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("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if (!jsonObj.get("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 (!BackupSource.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BackupSource' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(BackupSource.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, BackupSource 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 BackupSource read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + BackupSource 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 BackupSource given an JSON string + * + * @param jsonString JSON string + * @return An instance of BackupSource + * @throws IOException if the JSON string is invalid with respect to BackupSource + */ + public static BackupSource fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BackupSource.class); + } + + /** + * Convert an instance of BackupSource to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/BaseSecurityGroupRule.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/BaseSecurityGroupRule.java new file mode 100644 index 00000000..7c8d4bdd --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/BaseSecurityGroupRule.java @@ -0,0 +1,622 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; +import java.util.UUID; + +/** The base schema for a security group rule. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class BaseSecurityGroupRule { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable private String description; + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + + @SerializedName(SERIALIZED_NAME_DIRECTION) + @javax.annotation.Nonnull + private String direction; + + public static final String SERIALIZED_NAME_ETHERTYPE = "ethertype"; + + @SerializedName(SERIALIZED_NAME_ETHERTYPE) + @javax.annotation.Nullable private String ethertype = "IPv4"; + + public static final String SERIALIZED_NAME_ICMP_PARAMETERS = "icmpParameters"; + + @SerializedName(SERIALIZED_NAME_ICMP_PARAMETERS) + @javax.annotation.Nullable private ICMPParameters icmpParameters; + + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_IP_RANGE = "ipRange"; + + @SerializedName(SERIALIZED_NAME_IP_RANGE) + @javax.annotation.Nullable private String ipRange; + + public static final String SERIALIZED_NAME_PORT_RANGE = "portRange"; + + @SerializedName(SERIALIZED_NAME_PORT_RANGE) + @javax.annotation.Nullable private PortRange portRange; + + public static final String SERIALIZED_NAME_REMOTE_SECURITY_GROUP_ID = "remoteSecurityGroupId"; + + @SerializedName(SERIALIZED_NAME_REMOTE_SECURITY_GROUP_ID) + @javax.annotation.Nullable private UUID remoteSecurityGroupId; + + public static final String SERIALIZED_NAME_SECURITY_GROUP_ID = "securityGroupId"; + + @SerializedName(SERIALIZED_NAME_SECURITY_GROUP_ID) + @javax.annotation.Nullable private UUID securityGroupId; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable private OffsetDateTime updatedAt; + + public BaseSecurityGroupRule() {} + + public BaseSecurityGroupRule( + OffsetDateTime createdAt, UUID id, UUID securityGroupId, OffsetDateTime updatedAt) { + this(); + this.createdAt = createdAt; + this.id = id; + this.securityGroupId = securityGroupId; + this.updatedAt = updatedAt; + } + + /** + * Date-time when resource was created. + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public BaseSecurityGroupRule description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Description Object. Allows string up to 255 Characters. + * + * @return description + */ + @javax.annotation.Nullable public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + public BaseSecurityGroupRule direction(@javax.annotation.Nonnull String direction) { + this.direction = direction; + return this; + } + + /** + * The direction of the traffic which the rule should match. Possible values: + * `ingress`, `egress`. + * + * @return direction + */ + @javax.annotation.Nonnull + public String getDirection() { + return direction; + } + + public void setDirection(@javax.annotation.Nonnull String direction) { + this.direction = direction; + } + + public BaseSecurityGroupRule ethertype(@javax.annotation.Nullable String ethertype) { + this.ethertype = ethertype; + return this; + } + + /** + * The ethertype which the rule should match. Possible values: `IPv4`, + * `IPv6`. + * + * @return ethertype + */ + @javax.annotation.Nullable public String getEthertype() { + return ethertype; + } + + public void setEthertype(@javax.annotation.Nullable String ethertype) { + this.ethertype = ethertype; + } + + public BaseSecurityGroupRule icmpParameters( + @javax.annotation.Nullable ICMPParameters icmpParameters) { + this.icmpParameters = icmpParameters; + return this; + } + + /** + * Get icmpParameters + * + * @return icmpParameters + */ + @javax.annotation.Nullable public ICMPParameters getIcmpParameters() { + return icmpParameters; + } + + public void setIcmpParameters(@javax.annotation.Nullable ICMPParameters icmpParameters) { + this.icmpParameters = icmpParameters; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + public BaseSecurityGroupRule ipRange(@javax.annotation.Nullable String ipRange) { + this.ipRange = ipRange; + return this; + } + + /** + * The remote IP range which the rule should match. + * + * @return ipRange + */ + @javax.annotation.Nullable public String getIpRange() { + return ipRange; + } + + public void setIpRange(@javax.annotation.Nullable String ipRange) { + this.ipRange = ipRange; + } + + public BaseSecurityGroupRule portRange(@javax.annotation.Nullable PortRange portRange) { + this.portRange = portRange; + return this; + } + + /** + * Get portRange + * + * @return portRange + */ + @javax.annotation.Nullable public PortRange getPortRange() { + return portRange; + } + + public void setPortRange(@javax.annotation.Nullable PortRange portRange) { + this.portRange = portRange; + } + + public BaseSecurityGroupRule remoteSecurityGroupId( + @javax.annotation.Nullable UUID remoteSecurityGroupId) { + this.remoteSecurityGroupId = remoteSecurityGroupId; + return this; + } + + /** + * The remote security group which the rule should match. + * + * @return remoteSecurityGroupId + */ + @javax.annotation.Nullable public UUID getRemoteSecurityGroupId() { + return remoteSecurityGroupId; + } + + public void setRemoteSecurityGroupId(@javax.annotation.Nullable UUID remoteSecurityGroupId) { + this.remoteSecurityGroupId = remoteSecurityGroupId; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return securityGroupId + */ + @javax.annotation.Nullable public UUID getSecurityGroupId() { + return securityGroupId; + } + + /** + * Date-time when resource was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nullable public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * 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 BaseSecurityGroupRule instance itself + */ + public BaseSecurityGroupRule 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; + } + BaseSecurityGroupRule baseSecurityGroupRule = (BaseSecurityGroupRule) o; + return Objects.equals(this.createdAt, baseSecurityGroupRule.createdAt) + && Objects.equals(this.description, baseSecurityGroupRule.description) + && Objects.equals(this.direction, baseSecurityGroupRule.direction) + && Objects.equals(this.ethertype, baseSecurityGroupRule.ethertype) + && Objects.equals(this.icmpParameters, baseSecurityGroupRule.icmpParameters) + && Objects.equals(this.id, baseSecurityGroupRule.id) + && Objects.equals(this.ipRange, baseSecurityGroupRule.ipRange) + && Objects.equals(this.portRange, baseSecurityGroupRule.portRange) + && Objects.equals( + this.remoteSecurityGroupId, baseSecurityGroupRule.remoteSecurityGroupId) + && Objects.equals(this.securityGroupId, baseSecurityGroupRule.securityGroupId) + && Objects.equals(this.updatedAt, baseSecurityGroupRule.updatedAt) + && Objects.equals( + this.additionalProperties, baseSecurityGroupRule.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + createdAt, + description, + direction, + ethertype, + icmpParameters, + id, + ipRange, + portRange, + remoteSecurityGroupId, + securityGroupId, + updatedAt, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BaseSecurityGroupRule {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" ethertype: ").append(toIndentedString(ethertype)).append("\n"); + sb.append(" icmpParameters: ").append(toIndentedString(icmpParameters)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" ipRange: ").append(toIndentedString(ipRange)).append("\n"); + sb.append(" portRange: ").append(toIndentedString(portRange)).append("\n"); + sb.append(" remoteSecurityGroupId: ") + .append(toIndentedString(remoteSecurityGroupId)) + .append("\n"); + sb.append(" securityGroupId: ").append(toIndentedString(securityGroupId)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).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( + "createdAt", + "description", + "direction", + "ethertype", + "icmpParameters", + "id", + "ipRange", + "portRange", + "remoteSecurityGroupId", + "securityGroupId", + "updatedAt")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("direction")); + } + + /** + * 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 BaseSecurityGroupRule + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BaseSecurityGroupRule.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 BaseSecurityGroupRule is not found in the empty JSON string", + BaseSecurityGroupRule.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BaseSecurityGroupRule.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("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `description` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("description").toString())); + } + if (!jsonObj.get("direction").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `direction` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("direction").toString())); + } + if ((jsonObj.get("ethertype") != null && !jsonObj.get("ethertype").isJsonNull()) + && !jsonObj.get("ethertype").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `ethertype` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("ethertype").toString())); + } + // validate the optional field `icmpParameters` + if (jsonObj.get("icmpParameters") != null && !jsonObj.get("icmpParameters").isJsonNull()) { + ICMPParameters.validateJsonElement(jsonObj.get("icmpParameters")); + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if ((jsonObj.get("ipRange") != null && !jsonObj.get("ipRange").isJsonNull()) + && !jsonObj.get("ipRange").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `ipRange` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("ipRange").toString())); + } + // validate the optional field `portRange` + if (jsonObj.get("portRange") != null && !jsonObj.get("portRange").isJsonNull()) { + PortRange.validateJsonElement(jsonObj.get("portRange")); + } + if ((jsonObj.get("remoteSecurityGroupId") != null + && !jsonObj.get("remoteSecurityGroupId").isJsonNull()) + && !jsonObj.get("remoteSecurityGroupId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `remoteSecurityGroupId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("remoteSecurityGroupId").toString())); + } + if ((jsonObj.get("securityGroupId") != null && !jsonObj.get("securityGroupId").isJsonNull()) + && !jsonObj.get("securityGroupId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `securityGroupId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("securityGroupId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BaseSecurityGroupRule.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BaseSecurityGroupRule' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(BaseSecurityGroupRule.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, BaseSecurityGroupRule 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 BaseSecurityGroupRule read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + BaseSecurityGroupRule 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 BaseSecurityGroupRule given an JSON string + * + * @param jsonString JSON string + * @return An instance of BaseSecurityGroupRule + * @throws IOException if the JSON string is invalid with respect to BaseSecurityGroupRule + */ + public static BaseSecurityGroupRule fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BaseSecurityGroupRule.class); + } + + /** + * Convert an instance of BaseSecurityGroupRule to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/BootVolume.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/BootVolume.java new file mode 100644 index 00000000..ab432f5e --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/BootVolume.java @@ -0,0 +1,409 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +/** The boot device for the server. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class BootVolume { + public static final String SERIALIZED_NAME_DELETE_ON_TERMINATION = "deleteOnTermination"; + + @SerializedName(SERIALIZED_NAME_DELETE_ON_TERMINATION) + @javax.annotation.Nullable private Boolean deleteOnTermination; + + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_PERFORMANCE_CLASS = "performanceClass"; + + @SerializedName(SERIALIZED_NAME_PERFORMANCE_CLASS) + @javax.annotation.Nullable private String performanceClass; + + public static final String SERIALIZED_NAME_SIZE = "size"; + + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nullable private Long size; + + public static final String SERIALIZED_NAME_SOURCE = "source"; + + @SerializedName(SERIALIZED_NAME_SOURCE) + @javax.annotation.Nullable private BootVolumeSource source; + + public BootVolume() {} + + public BootVolume(UUID id) { + this(); + this.id = id; + } + + public BootVolume deleteOnTermination(@javax.annotation.Nullable Boolean deleteOnTermination) { + this.deleteOnTermination = deleteOnTermination; + return this; + } + + /** + * Delete the volume during the termination of the server. Defaults to false. + * + * @return deleteOnTermination + */ + @javax.annotation.Nullable public Boolean getDeleteOnTermination() { + return deleteOnTermination; + } + + public void setDeleteOnTermination(@javax.annotation.Nullable Boolean deleteOnTermination) { + this.deleteOnTermination = deleteOnTermination; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + public BootVolume performanceClass(@javax.annotation.Nullable String performanceClass) { + this.performanceClass = performanceClass; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return performanceClass + */ + @javax.annotation.Nullable public String getPerformanceClass() { + return performanceClass; + } + + public void setPerformanceClass(@javax.annotation.Nullable String performanceClass) { + this.performanceClass = performanceClass; + } + + public BootVolume size(@javax.annotation.Nullable Long size) { + this.size = size; + return this; + } + + /** + * Size in Gigabyte. + * + * @return size + */ + @javax.annotation.Nullable public Long getSize() { + return size; + } + + public void setSize(@javax.annotation.Nullable Long size) { + this.size = size; + } + + public BootVolume source(@javax.annotation.Nullable BootVolumeSource source) { + this.source = source; + return this; + } + + /** + * Get source + * + * @return source + */ + @javax.annotation.Nullable public BootVolumeSource getSource() { + return source; + } + + public void setSource(@javax.annotation.Nullable BootVolumeSource source) { + this.source = source; + } + + /** + * 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 BootVolume instance itself + */ + public BootVolume 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; + } + BootVolume bootVolume = (BootVolume) o; + return Objects.equals(this.deleteOnTermination, bootVolume.deleteOnTermination) + && Objects.equals(this.id, bootVolume.id) + && Objects.equals(this.performanceClass, bootVolume.performanceClass) + && Objects.equals(this.size, bootVolume.size) + && Objects.equals(this.source, bootVolume.source) + && Objects.equals(this.additionalProperties, bootVolume.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + deleteOnTermination, id, performanceClass, size, source, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BootVolume {\n"); + sb.append(" deleteOnTermination: ") + .append(toIndentedString(deleteOnTermination)) + .append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" performanceClass: ").append(toIndentedString(performanceClass)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" source: ").append(toIndentedString(source)).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( + "deleteOnTermination", "id", "performanceClass", "size", "source")); + + // 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 BootVolume + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BootVolume.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 BootVolume is not found in the empty JSON string", + BootVolume.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if ((jsonObj.get("performanceClass") != null + && !jsonObj.get("performanceClass").isJsonNull()) + && !jsonObj.get("performanceClass").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `performanceClass` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("performanceClass").toString())); + } + // validate the optional field `source` + if (jsonObj.get("source") != null && !jsonObj.get("source").isJsonNull()) { + BootVolumeSource.validateJsonElement(jsonObj.get("source")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BootVolume.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BootVolume' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(BootVolume.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, BootVolume 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 BootVolume read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + BootVolume 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 BootVolume given an JSON string + * + * @param jsonString JSON string + * @return An instance of BootVolume + * @throws IOException if the JSON string is invalid with respect to BootVolume + */ + public static BootVolume fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BootVolume.class); + } + + /** + * Convert an instance of BootVolume to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/BootVolumeSource.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/BootVolumeSource.java new file mode 100644 index 00000000..cfdce2d6 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/BootVolumeSource.java @@ -0,0 +1,342 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +/** The source object of a boot volume. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class BootVolumeSource { + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private UUID id; + + public static final String SERIALIZED_NAME_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private String type; + + public BootVolumeSource() {} + + public BootVolumeSource id(@javax.annotation.Nonnull UUID id) { + this.id = id; + return this; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nonnull + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull UUID id) { + this.id = id; + } + + public BootVolumeSource type(@javax.annotation.Nonnull String type) { + this.type = type; + return this; + } + + /** + * The source types of a boot volume. Possible values: `image`, `volume`. + * + * @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 BootVolumeSource instance itself + */ + public BootVolumeSource 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; + } + BootVolumeSource bootVolumeSource = (BootVolumeSource) o; + return Objects.equals(this.id, bootVolumeSource.id) + && Objects.equals(this.type, bootVolumeSource.type) + && Objects.equals(this.additionalProperties, bootVolumeSource.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BootVolumeSource {\n"); + sb.append(" id: ").append(toIndentedString(id)).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("id", "type")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("id", "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 BootVolumeSource + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BootVolumeSource.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 BootVolumeSource is not found in the empty JSON string", + BootVolumeSource.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BootVolumeSource.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("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if (!jsonObj.get("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 (!BootVolumeSource.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BootVolumeSource' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(BootVolumeSource.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, BootVolumeSource 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 BootVolumeSource read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + BootVolumeSource 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 BootVolumeSource given an JSON string + * + * @param jsonString JSON string + * @return An instance of BootVolumeSource + * @throws IOException if the JSON string is invalid with respect to BootVolumeSource + */ + public static BootVolumeSource fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BootVolumeSource.class); + } + + /** + * Convert an instance of BootVolumeSource to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateAffinityGroupPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateAffinityGroupPayload.java new file mode 100644 index 00000000..c033f09c --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateAffinityGroupPayload.java @@ -0,0 +1,407 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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.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; +import java.util.UUID; + +/** Definition of an affinity group. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateAffinityGroupPayload { + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_MEMBERS = "members"; + + @SerializedName(SERIALIZED_NAME_MEMBERS) + @javax.annotation.Nullable private List members = new ArrayList<>(); + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_POLICY = "policy"; + + @SerializedName(SERIALIZED_NAME_POLICY) + @javax.annotation.Nonnull + private String policy; + + public CreateAffinityGroupPayload() {} + + public CreateAffinityGroupPayload(UUID id, List members) { + this(); + this.id = id; + this.members = members; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + /** + * The servers that are part of the affinity group. + * + * @return members + */ + @javax.annotation.Nullable public List getMembers() { + return members; + } + + public CreateAffinityGroupPayload name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + public CreateAffinityGroupPayload policy(@javax.annotation.Nonnull String policy) { + this.policy = policy; + return this; + } + + /** + * The affinity group policy. `hard-affinity`: All servers in this group will be + * hosted on the same compute node. `soft-affinity`: All servers in this group will be + * hosted on as few compute nodes as possible. `hard-anti-affinity`: All servers in + * this group will be hosted on different compute nodes. `soft-anti-affinity`: All + * servers in this group will be hosted on as many compute nodes as possible. Possible values: + * `hard-anti-affinity`, `hard-affinity`, `soft-anti-affinity`, + * `soft-affinity`. + * + * @return policy + */ + @javax.annotation.Nonnull + public String getPolicy() { + return policy; + } + + public void setPolicy(@javax.annotation.Nonnull String policy) { + this.policy = policy; + } + + /** + * 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 CreateAffinityGroupPayload instance itself + */ + public CreateAffinityGroupPayload 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; + } + CreateAffinityGroupPayload createAffinityGroupPayload = (CreateAffinityGroupPayload) o; + return Objects.equals(this.id, createAffinityGroupPayload.id) + && Objects.equals(this.members, createAffinityGroupPayload.members) + && Objects.equals(this.name, createAffinityGroupPayload.name) + && Objects.equals(this.policy, createAffinityGroupPayload.policy) + && Objects.equals( + this.additionalProperties, createAffinityGroupPayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, members, name, policy, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateAffinityGroupPayload {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" members: ").append(toIndentedString(members)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" policy: ").append(toIndentedString(policy)).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("id", "members", "name", "policy")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name", "policy")); + } + + /** + * 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 CreateAffinityGroupPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateAffinityGroupPayload.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 CreateAffinityGroupPayload is not found in the empty JSON string", + CreateAffinityGroupPayload.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateAffinityGroupPayload.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("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("members") != null + && !jsonObj.get("members").isJsonNull() + && !jsonObj.get("members").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `members` to be an array in the JSON string but got `%s`", + jsonObj.get("members").toString())); + } + 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("policy").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `policy` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("policy").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateAffinityGroupPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateAffinityGroupPayload' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateAffinityGroupPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateAffinityGroupPayload 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 CreateAffinityGroupPayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateAffinityGroupPayload 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 CreateAffinityGroupPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateAffinityGroupPayload + * @throws IOException if the JSON string is invalid with respect to CreateAffinityGroupPayload + */ + public static CreateAffinityGroupPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateAffinityGroupPayload.class); + } + + /** + * Convert an instance of CreateAffinityGroupPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateBackupPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateBackupPayload.java new file mode 100644 index 00000000..3a863a65 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateBackupPayload.java @@ -0,0 +1,399 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** Object that represents a backup create request body. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateBackupPayload { + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable private String description; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; + + public static final String SERIALIZED_NAME_SOURCE = "source"; + + @SerializedName(SERIALIZED_NAME_SOURCE) + @javax.annotation.Nonnull + private BackupSource source; + + public CreateBackupPayload() {} + + public CreateBackupPayload description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Description Object. Allows string up to 255 Characters. + * + * @return description + */ + @javax.annotation.Nullable public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + public CreateBackupPayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public CreateBackupPayload name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nullable public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + public CreateBackupPayload source(@javax.annotation.Nonnull BackupSource source) { + this.source = source; + return this; + } + + /** + * Get source + * + * @return source + */ + @javax.annotation.Nonnull + public BackupSource getSource() { + return source; + } + + public void setSource(@javax.annotation.Nonnull BackupSource source) { + this.source = source; + } + + /** + * 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 CreateBackupPayload instance itself + */ + public CreateBackupPayload 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; + } + CreateBackupPayload createBackupPayload = (CreateBackupPayload) o; + return Objects.equals(this.description, createBackupPayload.description) + && Objects.equals(this.labels, createBackupPayload.labels) + && Objects.equals(this.name, createBackupPayload.name) + && Objects.equals(this.source, createBackupPayload.source) + && Objects.equals( + this.additionalProperties, createBackupPayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(description, labels, name, source, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateBackupPayload {\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" source: ").append(toIndentedString(source)).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("description", "labels", "name", "source")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("source")); + } + + /** + * 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 CreateBackupPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateBackupPayload.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 CreateBackupPayload is not found in the empty JSON string", + CreateBackupPayload.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateBackupPayload.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("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `description` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("description").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `name` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("name").toString())); + } + // validate the required field `source` + BackupSource.validateJsonElement(jsonObj.get("source")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateBackupPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateBackupPayload' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateBackupPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateBackupPayload 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 CreateBackupPayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateBackupPayload 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 CreateBackupPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateBackupPayload + * @throws IOException if the JSON string is invalid with respect to CreateBackupPayload + */ + public static CreateBackupPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateBackupPayload.class); + } + + /** + * Convert an instance of CreateBackupPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateImagePayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateImagePayload.java new file mode 100644 index 00000000..98b72a6c --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateImagePayload.java @@ -0,0 +1,750 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; +import java.util.UUID; + +/** + * Object that represents an Image and its parameters. Used for Creating and returning (get/list). + */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateImagePayload { + public static final String SERIALIZED_NAME_AGENT = "agent"; + + @SerializedName(SERIALIZED_NAME_AGENT) + @javax.annotation.Nullable private ImageAgent agent; + + public static final String SERIALIZED_NAME_CHECKSUM = "checksum"; + + @SerializedName(SERIALIZED_NAME_CHECKSUM) + @javax.annotation.Nullable private ImageChecksum checksum; + + public static final String SERIALIZED_NAME_CONFIG = "config"; + + @SerializedName(SERIALIZED_NAME_CONFIG) + @javax.annotation.Nullable private ImageConfig config; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_DISK_FORMAT = "diskFormat"; + + @SerializedName(SERIALIZED_NAME_DISK_FORMAT) + @javax.annotation.Nonnull + private String diskFormat; + + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_IMPORT_PROGRESS = "importProgress"; + + @SerializedName(SERIALIZED_NAME_IMPORT_PROGRESS) + @javax.annotation.Nullable private Long importProgress; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_MIN_DISK_SIZE = "minDiskSize"; + + @SerializedName(SERIALIZED_NAME_MIN_DISK_SIZE) + @javax.annotation.Nullable private Long minDiskSize; + + public static final String SERIALIZED_NAME_MIN_RAM = "minRam"; + + @SerializedName(SERIALIZED_NAME_MIN_RAM) + @javax.annotation.Nullable private Long minRam; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_OWNER = "owner"; + + @SerializedName(SERIALIZED_NAME_OWNER) + @javax.annotation.Nullable private UUID owner; + + public static final String SERIALIZED_NAME_PROTECTED = "protected"; + + @SerializedName(SERIALIZED_NAME_PROTECTED) + @javax.annotation.Nullable private Boolean _protected; + + public static final String SERIALIZED_NAME_SCOPE = "scope"; + + @SerializedName(SERIALIZED_NAME_SCOPE) + @javax.annotation.Nullable private String scope; + + public static final String SERIALIZED_NAME_SIZE = "size"; + + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nullable private Long size; + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable private String status; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable private OffsetDateTime updatedAt; + + public CreateImagePayload() {} + + public CreateImagePayload( + ImageChecksum checksum, + OffsetDateTime createdAt, + UUID id, + Long importProgress, + UUID owner, + String scope, + Long size, + String status, + OffsetDateTime updatedAt) { + this(); + this.checksum = checksum; + this.createdAt = createdAt; + this.id = id; + this.importProgress = importProgress; + this.owner = owner; + this.scope = scope; + this.size = size; + this.status = status; + this.updatedAt = updatedAt; + } + + public CreateImagePayload agent(@javax.annotation.Nullable ImageAgent agent) { + this.agent = agent; + return this; + } + + /** + * Get agent + * + * @return agent + */ + @javax.annotation.Nullable public ImageAgent getAgent() { + return agent; + } + + public void setAgent(@javax.annotation.Nullable ImageAgent agent) { + this.agent = agent; + } + + /** + * Get checksum + * + * @return checksum + */ + @javax.annotation.Nullable public ImageChecksum getChecksum() { + return checksum; + } + + public CreateImagePayload config(@javax.annotation.Nullable ImageConfig config) { + this.config = config; + return this; + } + + /** + * Get config + * + * @return config + */ + @javax.annotation.Nullable public ImageConfig getConfig() { + return config; + } + + public void setConfig(@javax.annotation.Nullable ImageConfig config) { + this.config = config; + } + + /** + * Date-time when resource was created. + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public CreateImagePayload diskFormat(@javax.annotation.Nonnull String diskFormat) { + this.diskFormat = diskFormat; + return this; + } + + /** + * Object that represents a disk format. Possible values: `raw`, `qcow2`, + * `iso`. + * + * @return diskFormat + */ + @javax.annotation.Nonnull + public String getDiskFormat() { + return diskFormat; + } + + public void setDiskFormat(@javax.annotation.Nonnull String diskFormat) { + this.diskFormat = diskFormat; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + /** + * Indicates Image Import Progress in percent. + * + * @return importProgress + */ + @javax.annotation.Nullable public Long getImportProgress() { + return importProgress; + } + + public CreateImagePayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public CreateImagePayload minDiskSize(@javax.annotation.Nullable Long minDiskSize) { + this.minDiskSize = minDiskSize; + return this; + } + + /** + * Size in Gigabyte. + * + * @return minDiskSize + */ + @javax.annotation.Nullable public Long getMinDiskSize() { + return minDiskSize; + } + + public void setMinDiskSize(@javax.annotation.Nullable Long minDiskSize) { + this.minDiskSize = minDiskSize; + } + + public CreateImagePayload minRam(@javax.annotation.Nullable Long minRam) { + this.minRam = minRam; + return this; + } + + /** + * Size in Megabyte. + * + * @return minRam + */ + @javax.annotation.Nullable public Long getMinRam() { + return minRam; + } + + public void setMinRam(@javax.annotation.Nullable Long minRam) { + this.minRam = minRam; + } + + public CreateImagePayload name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return owner + */ + @javax.annotation.Nullable public UUID getOwner() { + return owner; + } + + public CreateImagePayload _protected(@javax.annotation.Nullable Boolean _protected) { + this._protected = _protected; + return this; + } + + /** + * When true the image is prevented from being deleted. + * + * @return _protected + */ + @javax.annotation.Nullable public Boolean getProtected() { + return _protected; + } + + public void setProtected(@javax.annotation.Nullable Boolean _protected) { + this._protected = _protected; + } + + /** + * Scope of an Image. Possible values: `public`, `local`, + * `projects`, `organization`. + * + * @return scope + */ + @javax.annotation.Nullable public String getScope() { + return scope; + } + + /** + * Size in bytes. + * + * @return size + */ + @javax.annotation.Nullable public Long getSize() { + return size; + } + + /** + * The status of an image object. Possible values: `AVAILABLE`, `CREATING`, + * `DEACTIVATED`, `DELETED`, `DELETING`, `ERROR`. + * + * @return status + */ + @javax.annotation.Nullable public String getStatus() { + return status; + } + + /** + * Date-time when resource was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nullable public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * 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 CreateImagePayload instance itself + */ + public CreateImagePayload 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; + } + CreateImagePayload createImagePayload = (CreateImagePayload) o; + return Objects.equals(this.agent, createImagePayload.agent) + && Objects.equals(this.checksum, createImagePayload.checksum) + && Objects.equals(this.config, createImagePayload.config) + && Objects.equals(this.createdAt, createImagePayload.createdAt) + && Objects.equals(this.diskFormat, createImagePayload.diskFormat) + && Objects.equals(this.id, createImagePayload.id) + && Objects.equals(this.importProgress, createImagePayload.importProgress) + && Objects.equals(this.labels, createImagePayload.labels) + && Objects.equals(this.minDiskSize, createImagePayload.minDiskSize) + && Objects.equals(this.minRam, createImagePayload.minRam) + && Objects.equals(this.name, createImagePayload.name) + && Objects.equals(this.owner, createImagePayload.owner) + && Objects.equals(this._protected, createImagePayload._protected) + && Objects.equals(this.scope, createImagePayload.scope) + && Objects.equals(this.size, createImagePayload.size) + && Objects.equals(this.status, createImagePayload.status) + && Objects.equals(this.updatedAt, createImagePayload.updatedAt) + && Objects.equals( + this.additionalProperties, createImagePayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + agent, + checksum, + config, + createdAt, + diskFormat, + id, + importProgress, + labels, + minDiskSize, + minRam, + name, + owner, + _protected, + scope, + size, + status, + updatedAt, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateImagePayload {\n"); + sb.append(" agent: ").append(toIndentedString(agent)).append("\n"); + sb.append(" checksum: ").append(toIndentedString(checksum)).append("\n"); + sb.append(" config: ").append(toIndentedString(config)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" diskFormat: ").append(toIndentedString(diskFormat)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" importProgress: ").append(toIndentedString(importProgress)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" minDiskSize: ").append(toIndentedString(minDiskSize)).append("\n"); + sb.append(" minRam: ").append(toIndentedString(minRam)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" owner: ").append(toIndentedString(owner)).append("\n"); + sb.append(" _protected: ").append(toIndentedString(_protected)).append("\n"); + sb.append(" scope: ").append(toIndentedString(scope)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).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( + "agent", + "checksum", + "config", + "createdAt", + "diskFormat", + "id", + "importProgress", + "labels", + "minDiskSize", + "minRam", + "name", + "owner", + "protected", + "scope", + "size", + "status", + "updatedAt")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("diskFormat", "name")); + } + + /** + * 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 CreateImagePayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateImagePayload.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 CreateImagePayload is not found in the empty JSON string", + CreateImagePayload.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateImagePayload.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 optional field `agent` + if (jsonObj.get("agent") != null && !jsonObj.get("agent").isJsonNull()) { + ImageAgent.validateJsonElement(jsonObj.get("agent")); + } + // validate the optional field `checksum` + if (jsonObj.get("checksum") != null && !jsonObj.get("checksum").isJsonNull()) { + ImageChecksum.validateJsonElement(jsonObj.get("checksum")); + } + // validate the optional field `config` + if (jsonObj.get("config") != null && !jsonObj.get("config").isJsonNull()) { + ImageConfig.validateJsonElement(jsonObj.get("config")); + } + if (!jsonObj.get("diskFormat").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `diskFormat` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("diskFormat").toString())); + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if (!jsonObj.get("name").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("owner") != null && !jsonObj.get("owner").isJsonNull()) + && !jsonObj.get("owner").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `owner` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("owner").toString())); + } + if ((jsonObj.get("scope") != null && !jsonObj.get("scope").isJsonNull()) + && !jsonObj.get("scope").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `scope` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("scope").toString())); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) + && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `status` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("status").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateImagePayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateImagePayload' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateImagePayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateImagePayload 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 CreateImagePayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateImagePayload 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 CreateImagePayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateImagePayload + * @throws IOException if the JSON string is invalid with respect to CreateImagePayload + */ + public static CreateImagePayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateImagePayload.class); + } + + /** + * Convert an instance of CreateImagePayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateIsolatedNetworkPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateIsolatedNetworkPayload.java new file mode 100644 index 00000000..beaa7548 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateIsolatedNetworkPayload.java @@ -0,0 +1,398 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** Object that represents the request body for a single isolated network create. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateIsolatedNetworkPayload { + public static final String SERIALIZED_NAME_DHCP = "dhcp"; + + @SerializedName(SERIALIZED_NAME_DHCP) + @javax.annotation.Nullable private Boolean dhcp = true; + + public static final String SERIALIZED_NAME_IPV4 = "ipv4"; + + @SerializedName(SERIALIZED_NAME_IPV4) + @javax.annotation.Nullable private CreateNetworkIPv4 ipv4; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public CreateIsolatedNetworkPayload() {} + + public CreateIsolatedNetworkPayload dhcp(@javax.annotation.Nullable Boolean dhcp) { + this.dhcp = dhcp; + return this; + } + + /** + * Enable or disable DHCP for a network. + * + * @return dhcp + */ + @javax.annotation.Nullable public Boolean getDhcp() { + return dhcp; + } + + public void setDhcp(@javax.annotation.Nullable Boolean dhcp) { + this.dhcp = dhcp; + } + + public CreateIsolatedNetworkPayload ipv4(@javax.annotation.Nullable CreateNetworkIPv4 ipv4) { + this.ipv4 = ipv4; + return this; + } + + /** + * Get ipv4 + * + * @return ipv4 + */ + @javax.annotation.Nullable public CreateNetworkIPv4 getIpv4() { + return ipv4; + } + + public void setIpv4(@javax.annotation.Nullable CreateNetworkIPv4 ipv4) { + this.ipv4 = ipv4; + } + + public CreateIsolatedNetworkPayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public CreateIsolatedNetworkPayload name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + /** + * 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 CreateIsolatedNetworkPayload instance itself + */ + public CreateIsolatedNetworkPayload 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; + } + CreateIsolatedNetworkPayload createIsolatedNetworkPayload = + (CreateIsolatedNetworkPayload) o; + return Objects.equals(this.dhcp, createIsolatedNetworkPayload.dhcp) + && Objects.equals(this.ipv4, createIsolatedNetworkPayload.ipv4) + && Objects.equals(this.labels, createIsolatedNetworkPayload.labels) + && Objects.equals(this.name, createIsolatedNetworkPayload.name) + && Objects.equals( + this.additionalProperties, + createIsolatedNetworkPayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(dhcp, ipv4, labels, name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateIsolatedNetworkPayload {\n"); + sb.append(" dhcp: ").append(toIndentedString(dhcp)).append("\n"); + sb.append(" ipv4: ").append(toIndentedString(ipv4)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).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("dhcp", "ipv4", "labels", "name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name")); + } + + /** + * 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 + * CreateIsolatedNetworkPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateIsolatedNetworkPayload.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 CreateIsolatedNetworkPayload is not found in the empty JSON string", + CreateIsolatedNetworkPayload.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateIsolatedNetworkPayload.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 optional field `ipv4` + if (jsonObj.get("ipv4") != null && !jsonObj.get("ipv4").isJsonNull()) { + CreateNetworkIPv4.validateJsonElement(jsonObj.get("ipv4")); + } + 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())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateIsolatedNetworkPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateIsolatedNetworkPayload' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateIsolatedNetworkPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateIsolatedNetworkPayload 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 CreateIsolatedNetworkPayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateIsolatedNetworkPayload 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 CreateIsolatedNetworkPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateIsolatedNetworkPayload + * @throws IOException if the JSON string is invalid with respect to + * CreateIsolatedNetworkPayload + */ + public static CreateIsolatedNetworkPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateIsolatedNetworkPayload.class); + } + + /** + * Convert an instance of CreateIsolatedNetworkPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateKeyPairPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateKeyPairPayload.java new file mode 100644 index 00000000..13b328c6 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateKeyPairPayload.java @@ -0,0 +1,445 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** Object that represents the public key of an SSH keypair and its name. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateKeyPairPayload { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_FINGERPRINT = "fingerprint"; + + @SerializedName(SERIALIZED_NAME_FINGERPRINT) + @javax.annotation.Nullable private String fingerprint; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; + + public static final String SERIALIZED_NAME_PUBLIC_KEY = "publicKey"; + + @SerializedName(SERIALIZED_NAME_PUBLIC_KEY) + @javax.annotation.Nonnull + private String publicKey; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable private OffsetDateTime updatedAt; + + public CreateKeyPairPayload() {} + + public CreateKeyPairPayload( + OffsetDateTime createdAt, String fingerprint, OffsetDateTime updatedAt) { + this(); + this.createdAt = createdAt; + this.fingerprint = fingerprint; + this.updatedAt = updatedAt; + } + + /** + * Date-time when resource was created. + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * Object that represents an SSH keypair MD5 fingerprint. + * + * @return fingerprint + */ + @javax.annotation.Nullable public String getFingerprint() { + return fingerprint; + } + + public CreateKeyPairPayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public CreateKeyPairPayload name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The name of an SSH keypair. Allowed characters are letters [a-zA-Z], digits [0-9] and the + * following special characters: [@._-]. + * + * @return name + */ + @javax.annotation.Nullable public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + public CreateKeyPairPayload publicKey(@javax.annotation.Nonnull String publicKey) { + this.publicKey = publicKey; + return this; + } + + /** + * Object that represents a public SSH key. + * + * @return publicKey + */ + @javax.annotation.Nonnull + public String getPublicKey() { + return publicKey; + } + + public void setPublicKey(@javax.annotation.Nonnull String publicKey) { + this.publicKey = publicKey; + } + + /** + * Date-time when resource was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nullable public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * 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 CreateKeyPairPayload instance itself + */ + public CreateKeyPairPayload 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; + } + CreateKeyPairPayload createKeyPairPayload = (CreateKeyPairPayload) o; + return Objects.equals(this.createdAt, createKeyPairPayload.createdAt) + && Objects.equals(this.fingerprint, createKeyPairPayload.fingerprint) + && Objects.equals(this.labels, createKeyPairPayload.labels) + && Objects.equals(this.name, createKeyPairPayload.name) + && Objects.equals(this.publicKey, createKeyPairPayload.publicKey) + && Objects.equals(this.updatedAt, createKeyPairPayload.updatedAt) + && Objects.equals( + this.additionalProperties, createKeyPairPayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + createdAt, fingerprint, labels, name, publicKey, updatedAt, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateKeyPairPayload {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" fingerprint: ").append(toIndentedString(fingerprint)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" publicKey: ").append(toIndentedString(publicKey)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).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( + "createdAt", + "fingerprint", + "labels", + "name", + "publicKey", + "updatedAt")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("publicKey")); + } + + /** + * 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 CreateKeyPairPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateKeyPairPayload.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 CreateKeyPairPayload is not found in the empty JSON string", + CreateKeyPairPayload.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateKeyPairPayload.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("fingerprint") != null && !jsonObj.get("fingerprint").isJsonNull()) + && !jsonObj.get("fingerprint").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `fingerprint` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("fingerprint").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `name` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("name").toString())); + } + if (!jsonObj.get("publicKey").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `publicKey` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("publicKey").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateKeyPairPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateKeyPairPayload' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateKeyPairPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateKeyPairPayload 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 CreateKeyPairPayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateKeyPairPayload 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 CreateKeyPairPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateKeyPairPayload + * @throws IOException if the JSON string is invalid with respect to CreateKeyPairPayload + */ + public static CreateKeyPairPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateKeyPairPayload.class); + } + + /** + * Convert an instance of CreateKeyPairPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateNetworkAreaPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateNetworkAreaPayload.java new file mode 100644 index 00000000..2f37182d --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateNetworkAreaPayload.java @@ -0,0 +1,338 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** Object that represents the network area create request. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateNetworkAreaPayload { + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public CreateNetworkAreaPayload() {} + + public CreateNetworkAreaPayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public CreateNetworkAreaPayload 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; + } + + /** + * 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 CreateNetworkAreaPayload instance itself + */ + public CreateNetworkAreaPayload 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; + } + CreateNetworkAreaPayload createNetworkAreaPayload = (CreateNetworkAreaPayload) o; + return Objects.equals(this.labels, createNetworkAreaPayload.labels) + && Objects.equals(this.name, createNetworkAreaPayload.name) + && Objects.equals( + this.additionalProperties, createNetworkAreaPayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(labels, name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateNetworkAreaPayload {\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("labels", "name")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name")); + } + + /** + * 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 CreateNetworkAreaPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateNetworkAreaPayload.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 CreateNetworkAreaPayload is not found in the empty JSON string", + CreateNetworkAreaPayload.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateNetworkAreaPayload.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())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateNetworkAreaPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateNetworkAreaPayload' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateNetworkAreaPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateNetworkAreaPayload 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 CreateNetworkAreaPayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateNetworkAreaPayload 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 CreateNetworkAreaPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateNetworkAreaPayload + * @throws IOException if the JSON string is invalid with respect to CreateNetworkAreaPayload + */ + public static CreateNetworkAreaPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateNetworkAreaPayload.class); + } + + /** + * Convert an instance of CreateNetworkAreaPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateNetworkAreaRangePayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateNetworkAreaRangePayload.java new file mode 100644 index 00000000..64f7aec4 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateNetworkAreaRangePayload.java @@ -0,0 +1,324 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** CreateNetworkAreaRangePayload */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateNetworkAreaRangePayload { + public static final String SERIALIZED_NAME_IPV4 = "ipv4"; + + @SerializedName(SERIALIZED_NAME_IPV4) + @javax.annotation.Nullable private List ipv4 = new ArrayList<>(); + + public CreateNetworkAreaRangePayload() {} + + public CreateNetworkAreaRangePayload ipv4(@javax.annotation.Nullable List ipv4) { + this.ipv4 = ipv4; + return this; + } + + public CreateNetworkAreaRangePayload addIpv4Item(NetworkRange ipv4Item) { + if (this.ipv4 == null) { + this.ipv4 = new ArrayList<>(); + } + this.ipv4.add(ipv4Item); + return this; + } + + /** + * A list of network ranges. + * + * @return ipv4 + */ + @javax.annotation.Nullable public List getIpv4() { + return ipv4; + } + + public void setIpv4(@javax.annotation.Nullable List ipv4) { + this.ipv4 = ipv4; + } + + /** + * 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 CreateNetworkAreaRangePayload instance itself + */ + public CreateNetworkAreaRangePayload 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; + } + CreateNetworkAreaRangePayload createNetworkAreaRangePayload = + (CreateNetworkAreaRangePayload) o; + return Objects.equals(this.ipv4, createNetworkAreaRangePayload.ipv4) + && Objects.equals( + this.additionalProperties, + createNetworkAreaRangePayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(ipv4, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateNetworkAreaRangePayload {\n"); + sb.append(" ipv4: ").append(toIndentedString(ipv4)).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("ipv4")); + + // 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 + * CreateNetworkAreaRangePayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateNetworkAreaRangePayload.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 CreateNetworkAreaRangePayload is not found in the empty JSON string", + CreateNetworkAreaRangePayload.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("ipv4") != null && !jsonObj.get("ipv4").isJsonNull()) { + JsonArray jsonArrayipv4 = jsonObj.getAsJsonArray("ipv4"); + if (jsonArrayipv4 != null) { + // ensure the json data is an array + if (!jsonObj.get("ipv4").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `ipv4` to be an array in the JSON string but got `%s`", + jsonObj.get("ipv4").toString())); + } + + // validate the optional field `ipv4` (array) + for (int i = 0; i < jsonArrayipv4.size(); i++) { + NetworkRange.validateJsonElement(jsonArrayipv4.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateNetworkAreaRangePayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateNetworkAreaRangePayload' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateNetworkAreaRangePayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateNetworkAreaRangePayload 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 CreateNetworkAreaRangePayload read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateNetworkAreaRangePayload 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 CreateNetworkAreaRangePayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateNetworkAreaRangePayload + * @throws IOException if the JSON string is invalid with respect to + * CreateNetworkAreaRangePayload + */ + public static CreateNetworkAreaRangePayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateNetworkAreaRangePayload.class); + } + + /** + * Convert an instance of CreateNetworkAreaRangePayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateNetworkAreaRoutePayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateNetworkAreaRoutePayload.java new file mode 100644 index 00000000..eafb8b40 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateNetworkAreaRoutePayload.java @@ -0,0 +1,334 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** Object represents a request to add network routes. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateNetworkAreaRoutePayload { + public static final String SERIALIZED_NAME_ITEMS = "items"; + + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public CreateNetworkAreaRoutePayload() {} + + public CreateNetworkAreaRoutePayload items(@javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public CreateNetworkAreaRoutePayload addItemsItem(Route itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list of routes. + * + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the CreateNetworkAreaRoutePayload instance itself + */ + public CreateNetworkAreaRoutePayload 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; + } + CreateNetworkAreaRoutePayload createNetworkAreaRoutePayload = + (CreateNetworkAreaRoutePayload) o; + return Objects.equals(this.items, createNetworkAreaRoutePayload.items) + && Objects.equals( + this.additionalProperties, + createNetworkAreaRoutePayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateNetworkAreaRoutePayload {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("items")); + } + + /** + * 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 + * CreateNetworkAreaRoutePayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateNetworkAreaRoutePayload.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 CreateNetworkAreaRoutePayload is not found in the empty JSON string", + CreateNetworkAreaRoutePayload.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateNetworkAreaRoutePayload.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("items").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `items` to be an array in the JSON string but got `%s`", + jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + Route.validateJsonElement(jsonArrayitems.get(i)); + } + ; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateNetworkAreaRoutePayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateNetworkAreaRoutePayload' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateNetworkAreaRoutePayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateNetworkAreaRoutePayload 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 CreateNetworkAreaRoutePayload read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateNetworkAreaRoutePayload 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 CreateNetworkAreaRoutePayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateNetworkAreaRoutePayload + * @throws IOException if the JSON string is invalid with respect to + * CreateNetworkAreaRoutePayload + */ + public static CreateNetworkAreaRoutePayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateNetworkAreaRoutePayload.class); + } + + /** + * Convert an instance of CreateNetworkAreaRoutePayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateNetworkIPv4.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateNetworkIPv4.java new file mode 100644 index 00000000..5cd00c91 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateNetworkIPv4.java @@ -0,0 +1,300 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +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 CreateNetworkIPv4 extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(CreateNetworkIPv4.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateNetworkIPv4.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateNetworkIPv4' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterCreateNetworkIPv4WithPrefix = + gson.getDelegateAdapter(this, TypeToken.get(CreateNetworkIPv4WithPrefix.class)); + final TypeAdapter + adapterCreateNetworkIPv4WithPrefixLength = + gson.getDelegateAdapter( + this, TypeToken.get(CreateNetworkIPv4WithPrefixLength.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateNetworkIPv4 value) + throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type + // `CreateNetworkIPv4WithPrefix` + if (value.getActualInstance() instanceof CreateNetworkIPv4WithPrefix) { + JsonElement element = + adapterCreateNetworkIPv4WithPrefix.toJsonTree( + (CreateNetworkIPv4WithPrefix) + value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type + // `CreateNetworkIPv4WithPrefixLength` + if (value.getActualInstance() + instanceof CreateNetworkIPv4WithPrefixLength) { + JsonElement element = + adapterCreateNetworkIPv4WithPrefixLength.toJsonTree( + (CreateNetworkIPv4WithPrefixLength) + value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException( + "Failed to serialize as the type doesn't match oneOf schemas: CreateNetworkIPv4WithPrefix, CreateNetworkIPv4WithPrefixLength"); + } + + @Override + public CreateNetworkIPv4 read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize CreateNetworkIPv4WithPrefix + try { + // validate the JSON object to see if any exception is thrown + CreateNetworkIPv4WithPrefix.validateJsonElement(jsonElement); + actualAdapter = adapterCreateNetworkIPv4WithPrefix; + match++; + log.log( + Level.FINER, + "Input data matches schema 'CreateNetworkIPv4WithPrefix'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for CreateNetworkIPv4WithPrefix failed with `%s`.", + e.getMessage())); + log.log( + Level.FINER, + "Input data does not match schema 'CreateNetworkIPv4WithPrefix'", + e); + } + // deserialize CreateNetworkIPv4WithPrefixLength + try { + // validate the JSON object to see if any exception is thrown + CreateNetworkIPv4WithPrefixLength.validateJsonElement(jsonElement); + actualAdapter = adapterCreateNetworkIPv4WithPrefixLength; + match++; + log.log( + Level.FINER, + "Input data matches schema 'CreateNetworkIPv4WithPrefixLength'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for CreateNetworkIPv4WithPrefixLength failed with `%s`.", + e.getMessage())); + log.log( + Level.FINER, + "Input data does not match schema 'CreateNetworkIPv4WithPrefixLength'", + e); + } + + if (match == 1) { + CreateNetworkIPv4 ret = new CreateNetworkIPv4(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException( + String.format( + java.util.Locale.ROOT, + "Failed deserialization for CreateNetworkIPv4: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", + match, + errorMessages, + jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public CreateNetworkIPv4() { + super("oneOf", Boolean.FALSE); + } + + public CreateNetworkIPv4(Object o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("CreateNetworkIPv4WithPrefix", CreateNetworkIPv4WithPrefix.class); + schemas.put("CreateNetworkIPv4WithPrefixLength", CreateNetworkIPv4WithPrefixLength.class); + } + + @Override + public Map> getSchemas() { + return CreateNetworkIPv4.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: CreateNetworkIPv4WithPrefix, + * CreateNetworkIPv4WithPrefixLength + * + *

It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof CreateNetworkIPv4WithPrefix) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof CreateNetworkIPv4WithPrefixLength) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException( + "Invalid instance type. Must be CreateNetworkIPv4WithPrefix, CreateNetworkIPv4WithPrefixLength"); + } + + /** + * Get the actual instance, which can be the following: CreateNetworkIPv4WithPrefix, + * CreateNetworkIPv4WithPrefixLength + * + * @return The actual instance (CreateNetworkIPv4WithPrefix, CreateNetworkIPv4WithPrefixLength) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `CreateNetworkIPv4WithPrefix`. If the actual instance is not + * `CreateNetworkIPv4WithPrefix`, the ClassCastException will be thrown. + * + * @return The actual instance of `CreateNetworkIPv4WithPrefix` + * @throws ClassCastException if the instance is not `CreateNetworkIPv4WithPrefix` + */ + public CreateNetworkIPv4WithPrefix getCreateNetworkIPv4WithPrefix() throws ClassCastException { + return (CreateNetworkIPv4WithPrefix) super.getActualInstance(); + } + + /** + * Get the actual instance of `CreateNetworkIPv4WithPrefixLength`. If the actual instance is not + * `CreateNetworkIPv4WithPrefixLength`, the ClassCastException will be thrown. + * + * @return The actual instance of `CreateNetworkIPv4WithPrefixLength` + * @throws ClassCastException if the instance is not `CreateNetworkIPv4WithPrefixLength` + */ + public CreateNetworkIPv4WithPrefixLength getCreateNetworkIPv4WithPrefixLength() + throws ClassCastException { + return (CreateNetworkIPv4WithPrefixLength) 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 CreateNetworkIPv4 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with CreateNetworkIPv4WithPrefix + try { + CreateNetworkIPv4WithPrefix.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for CreateNetworkIPv4WithPrefix failed with `%s`.", + e.getMessage())); + // continue to the next one + } + // validate the json string with CreateNetworkIPv4WithPrefixLength + try { + CreateNetworkIPv4WithPrefixLength.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for CreateNetworkIPv4WithPrefixLength failed with `%s`.", + e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException( + String.format( + java.util.Locale.ROOT, + "The JSON string is invalid for CreateNetworkIPv4 with oneOf schemas: CreateNetworkIPv4WithPrefix, CreateNetworkIPv4WithPrefixLength. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", + validCount, + errorMessages, + jsonElement.toString())); + } + } + + /** + * Create an instance of CreateNetworkIPv4 given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateNetworkIPv4 + * @throws IOException if the JSON string is invalid with respect to CreateNetworkIPv4 + */ + public static CreateNetworkIPv4 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateNetworkIPv4.class); + } + + /** + * Convert an instance of CreateNetworkIPv4 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateNetworkIPv4WithPrefix.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateNetworkIPv4WithPrefix.java new file mode 100644 index 00000000..48460bd5 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateNetworkIPv4WithPrefix.java @@ -0,0 +1,408 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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.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; +import org.openapitools.jackson.nullable.JsonNullable; + +/** The create request for an IPv4 network with a specified prefix. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateNetworkIPv4WithPrefix { + public static final String SERIALIZED_NAME_GATEWAY = "gateway"; + + @SerializedName(SERIALIZED_NAME_GATEWAY) + @javax.annotation.Nullable private String gateway; + + public static final String SERIALIZED_NAME_NAMESERVERS = "nameservers"; + + @SerializedName(SERIALIZED_NAME_NAMESERVERS) + @javax.annotation.Nullable private List nameservers = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PREFIX = "prefix"; + + @SerializedName(SERIALIZED_NAME_PREFIX) + @javax.annotation.Nonnull + private String prefix; + + public CreateNetworkIPv4WithPrefix() {} + + public CreateNetworkIPv4WithPrefix gateway(@javax.annotation.Nullable String gateway) { + this.gateway = gateway; + return this; + } + + /** + * The IPv4 gateway of a network. If not specified the first IP of the network will be assigned + * as the gateway. If 'null' is sent, then the network doesn't have a gateway. + * + * @return gateway + */ + @javax.annotation.Nullable public String getGateway() { + return gateway; + } + + public void setGateway(@javax.annotation.Nullable String gateway) { + this.gateway = gateway; + } + + public CreateNetworkIPv4WithPrefix nameservers( + @javax.annotation.Nullable List nameservers) { + this.nameservers = nameservers; + return this; + } + + public CreateNetworkIPv4WithPrefix addNameserversItem(String nameserversItem) { + if (this.nameservers == null) { + this.nameservers = new ArrayList<>(); + } + this.nameservers.add(nameserversItem); + return this; + } + + /** + * A list containing DNS Servers/Nameservers for IPv4. + * + * @return nameservers + */ + @javax.annotation.Nullable public List getNameservers() { + return nameservers; + } + + public void setNameservers(@javax.annotation.Nullable List nameservers) { + this.nameservers = nameservers; + } + + public CreateNetworkIPv4WithPrefix prefix(@javax.annotation.Nonnull String prefix) { + this.prefix = prefix; + return this; + } + + /** + * IPv4 Classless Inter-Domain Routing (CIDR). + * + * @return prefix + */ + @javax.annotation.Nonnull + public String getPrefix() { + return prefix; + } + + public void setPrefix(@javax.annotation.Nonnull String prefix) { + this.prefix = prefix; + } + + /** + * 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 CreateNetworkIPv4WithPrefix instance itself + */ + public CreateNetworkIPv4WithPrefix 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; + } + CreateNetworkIPv4WithPrefix createNetworkIPv4WithPrefix = (CreateNetworkIPv4WithPrefix) o; + return Objects.equals(this.gateway, createNetworkIPv4WithPrefix.gateway) + && Objects.equals(this.nameservers, createNetworkIPv4WithPrefix.nameservers) + && Objects.equals(this.prefix, createNetworkIPv4WithPrefix.prefix) + && Objects.equals( + this.additionalProperties, + createNetworkIPv4WithPrefix.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(gateway, nameservers, prefix, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateNetworkIPv4WithPrefix {\n"); + sb.append(" gateway: ").append(toIndentedString(gateway)).append("\n"); + sb.append(" nameservers: ").append(toIndentedString(nameservers)).append("\n"); + sb.append(" prefix: ").append(toIndentedString(prefix)).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("gateway", "nameservers", "prefix")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("prefix")); + } + + /** + * 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 + * CreateNetworkIPv4WithPrefix + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateNetworkIPv4WithPrefix.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 CreateNetworkIPv4WithPrefix is not found in the empty JSON string", + CreateNetworkIPv4WithPrefix.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateNetworkIPv4WithPrefix.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("gateway") != null && !jsonObj.get("gateway").isJsonNull()) + && !jsonObj.get("gateway").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `gateway` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("gateway").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("nameservers") != null + && !jsonObj.get("nameservers").isJsonNull() + && !jsonObj.get("nameservers").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `nameservers` to be an array in the JSON string but got `%s`", + jsonObj.get("nameservers").toString())); + } + if (!jsonObj.get("prefix").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `prefix` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("prefix").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateNetworkIPv4WithPrefix.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateNetworkIPv4WithPrefix' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateNetworkIPv4WithPrefix.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateNetworkIPv4WithPrefix 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 CreateNetworkIPv4WithPrefix read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateNetworkIPv4WithPrefix 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 CreateNetworkIPv4WithPrefix given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateNetworkIPv4WithPrefix + * @throws IOException if the JSON string is invalid with respect to CreateNetworkIPv4WithPrefix + */ + public static CreateNetworkIPv4WithPrefix fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateNetworkIPv4WithPrefix.class); + } + + /** + * Convert an instance of CreateNetworkIPv4WithPrefix to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateNetworkIPv4WithPrefixLength.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateNetworkIPv4WithPrefixLength.java new file mode 100644 index 00000000..7ad59c7a --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateNetworkIPv4WithPrefixLength.java @@ -0,0 +1,356 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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.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; + +/** The create request for an IPv4 network with a wanted prefix length. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateNetworkIPv4WithPrefixLength { + public static final String SERIALIZED_NAME_NAMESERVERS = "nameservers"; + + @SerializedName(SERIALIZED_NAME_NAMESERVERS) + @javax.annotation.Nullable private List nameservers = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PREFIX_LENGTH = "prefixLength"; + + @SerializedName(SERIALIZED_NAME_PREFIX_LENGTH) + @javax.annotation.Nonnull + private Long prefixLength; + + public CreateNetworkIPv4WithPrefixLength() {} + + public CreateNetworkIPv4WithPrefixLength nameservers( + @javax.annotation.Nullable List nameservers) { + this.nameservers = nameservers; + return this; + } + + public CreateNetworkIPv4WithPrefixLength addNameserversItem(String nameserversItem) { + if (this.nameservers == null) { + this.nameservers = new ArrayList<>(); + } + this.nameservers.add(nameserversItem); + return this; + } + + /** + * A list containing DNS Servers/Nameservers for IPv4. + * + * @return nameservers + */ + @javax.annotation.Nullable public List getNameservers() { + return nameservers; + } + + public void setNameservers(@javax.annotation.Nullable List nameservers) { + this.nameservers = nameservers; + } + + public CreateNetworkIPv4WithPrefixLength prefixLength( + @javax.annotation.Nonnull Long prefixLength) { + this.prefixLength = prefixLength; + return this; + } + + /** + * Get prefixLength minimum: 8 maximum: 29 + * + * @return prefixLength + */ + @javax.annotation.Nonnull + public Long getPrefixLength() { + return prefixLength; + } + + public void setPrefixLength(@javax.annotation.Nonnull Long prefixLength) { + this.prefixLength = prefixLength; + } + + /** + * 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 CreateNetworkIPv4WithPrefixLength instance itself + */ + public CreateNetworkIPv4WithPrefixLength 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; + } + CreateNetworkIPv4WithPrefixLength createNetworkIPv4WithPrefixLength = + (CreateNetworkIPv4WithPrefixLength) o; + return Objects.equals(this.nameservers, createNetworkIPv4WithPrefixLength.nameservers) + && Objects.equals(this.prefixLength, createNetworkIPv4WithPrefixLength.prefixLength) + && Objects.equals( + this.additionalProperties, + createNetworkIPv4WithPrefixLength.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(nameservers, prefixLength, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateNetworkIPv4WithPrefixLength {\n"); + sb.append(" nameservers: ").append(toIndentedString(nameservers)).append("\n"); + sb.append(" prefixLength: ").append(toIndentedString(prefixLength)).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("nameservers", "prefixLength")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("prefixLength")); + } + + /** + * 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 + * CreateNetworkIPv4WithPrefixLength + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateNetworkIPv4WithPrefixLength.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 CreateNetworkIPv4WithPrefixLength is not found in the empty JSON string", + CreateNetworkIPv4WithPrefixLength.openapiRequiredFields + .toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateNetworkIPv4WithPrefixLength.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 optional json data is an array if present + if (jsonObj.get("nameservers") != null + && !jsonObj.get("nameservers").isJsonNull() + && !jsonObj.get("nameservers").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `nameservers` to be an array in the JSON string but got `%s`", + jsonObj.get("nameservers").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateNetworkIPv4WithPrefixLength.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateNetworkIPv4WithPrefixLength' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateNetworkIPv4WithPrefixLength.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateNetworkIPv4WithPrefixLength 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 CreateNetworkIPv4WithPrefixLength read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateNetworkIPv4WithPrefixLength 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 CreateNetworkIPv4WithPrefixLength given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateNetworkIPv4WithPrefixLength + * @throws IOException if the JSON string is invalid with respect to + * CreateNetworkIPv4WithPrefixLength + */ + public static CreateNetworkIPv4WithPrefixLength fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateNetworkIPv4WithPrefixLength.class); + } + + /** + * Convert an instance of CreateNetworkIPv4WithPrefixLength to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateNetworkIPv6.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateNetworkIPv6.java new file mode 100644 index 00000000..2d91c2a9 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateNetworkIPv6.java @@ -0,0 +1,300 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +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 CreateNetworkIPv6 extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(CreateNetworkIPv6.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateNetworkIPv6.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateNetworkIPv6' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterCreateNetworkIPv6WithPrefix = + gson.getDelegateAdapter(this, TypeToken.get(CreateNetworkIPv6WithPrefix.class)); + final TypeAdapter + adapterCreateNetworkIPv6WithPrefixLength = + gson.getDelegateAdapter( + this, TypeToken.get(CreateNetworkIPv6WithPrefixLength.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateNetworkIPv6 value) + throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type + // `CreateNetworkIPv6WithPrefix` + if (value.getActualInstance() instanceof CreateNetworkIPv6WithPrefix) { + JsonElement element = + adapterCreateNetworkIPv6WithPrefix.toJsonTree( + (CreateNetworkIPv6WithPrefix) + value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type + // `CreateNetworkIPv6WithPrefixLength` + if (value.getActualInstance() + instanceof CreateNetworkIPv6WithPrefixLength) { + JsonElement element = + adapterCreateNetworkIPv6WithPrefixLength.toJsonTree( + (CreateNetworkIPv6WithPrefixLength) + value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException( + "Failed to serialize as the type doesn't match oneOf schemas: CreateNetworkIPv6WithPrefix, CreateNetworkIPv6WithPrefixLength"); + } + + @Override + public CreateNetworkIPv6 read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize CreateNetworkIPv6WithPrefix + try { + // validate the JSON object to see if any exception is thrown + CreateNetworkIPv6WithPrefix.validateJsonElement(jsonElement); + actualAdapter = adapterCreateNetworkIPv6WithPrefix; + match++; + log.log( + Level.FINER, + "Input data matches schema 'CreateNetworkIPv6WithPrefix'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for CreateNetworkIPv6WithPrefix failed with `%s`.", + e.getMessage())); + log.log( + Level.FINER, + "Input data does not match schema 'CreateNetworkIPv6WithPrefix'", + e); + } + // deserialize CreateNetworkIPv6WithPrefixLength + try { + // validate the JSON object to see if any exception is thrown + CreateNetworkIPv6WithPrefixLength.validateJsonElement(jsonElement); + actualAdapter = adapterCreateNetworkIPv6WithPrefixLength; + match++; + log.log( + Level.FINER, + "Input data matches schema 'CreateNetworkIPv6WithPrefixLength'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for CreateNetworkIPv6WithPrefixLength failed with `%s`.", + e.getMessage())); + log.log( + Level.FINER, + "Input data does not match schema 'CreateNetworkIPv6WithPrefixLength'", + e); + } + + if (match == 1) { + CreateNetworkIPv6 ret = new CreateNetworkIPv6(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException( + String.format( + java.util.Locale.ROOT, + "Failed deserialization for CreateNetworkIPv6: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", + match, + errorMessages, + jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public CreateNetworkIPv6() { + super("oneOf", Boolean.FALSE); + } + + public CreateNetworkIPv6(Object o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("CreateNetworkIPv6WithPrefix", CreateNetworkIPv6WithPrefix.class); + schemas.put("CreateNetworkIPv6WithPrefixLength", CreateNetworkIPv6WithPrefixLength.class); + } + + @Override + public Map> getSchemas() { + return CreateNetworkIPv6.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: CreateNetworkIPv6WithPrefix, + * CreateNetworkIPv6WithPrefixLength + * + *

It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof CreateNetworkIPv6WithPrefix) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof CreateNetworkIPv6WithPrefixLength) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException( + "Invalid instance type. Must be CreateNetworkIPv6WithPrefix, CreateNetworkIPv6WithPrefixLength"); + } + + /** + * Get the actual instance, which can be the following: CreateNetworkIPv6WithPrefix, + * CreateNetworkIPv6WithPrefixLength + * + * @return The actual instance (CreateNetworkIPv6WithPrefix, CreateNetworkIPv6WithPrefixLength) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `CreateNetworkIPv6WithPrefix`. If the actual instance is not + * `CreateNetworkIPv6WithPrefix`, the ClassCastException will be thrown. + * + * @return The actual instance of `CreateNetworkIPv6WithPrefix` + * @throws ClassCastException if the instance is not `CreateNetworkIPv6WithPrefix` + */ + public CreateNetworkIPv6WithPrefix getCreateNetworkIPv6WithPrefix() throws ClassCastException { + return (CreateNetworkIPv6WithPrefix) super.getActualInstance(); + } + + /** + * Get the actual instance of `CreateNetworkIPv6WithPrefixLength`. If the actual instance is not + * `CreateNetworkIPv6WithPrefixLength`, the ClassCastException will be thrown. + * + * @return The actual instance of `CreateNetworkIPv6WithPrefixLength` + * @throws ClassCastException if the instance is not `CreateNetworkIPv6WithPrefixLength` + */ + public CreateNetworkIPv6WithPrefixLength getCreateNetworkIPv6WithPrefixLength() + throws ClassCastException { + return (CreateNetworkIPv6WithPrefixLength) 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 CreateNetworkIPv6 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with CreateNetworkIPv6WithPrefix + try { + CreateNetworkIPv6WithPrefix.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for CreateNetworkIPv6WithPrefix failed with `%s`.", + e.getMessage())); + // continue to the next one + } + // validate the json string with CreateNetworkIPv6WithPrefixLength + try { + CreateNetworkIPv6WithPrefixLength.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for CreateNetworkIPv6WithPrefixLength failed with `%s`.", + e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException( + String.format( + java.util.Locale.ROOT, + "The JSON string is invalid for CreateNetworkIPv6 with oneOf schemas: CreateNetworkIPv6WithPrefix, CreateNetworkIPv6WithPrefixLength. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", + validCount, + errorMessages, + jsonElement.toString())); + } + } + + /** + * Create an instance of CreateNetworkIPv6 given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateNetworkIPv6 + * @throws IOException if the JSON string is invalid with respect to CreateNetworkIPv6 + */ + public static CreateNetworkIPv6 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateNetworkIPv6.class); + } + + /** + * Convert an instance of CreateNetworkIPv6 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateNetworkIPv6WithPrefix.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateNetworkIPv6WithPrefix.java new file mode 100644 index 00000000..637ed2ae --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateNetworkIPv6WithPrefix.java @@ -0,0 +1,408 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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.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; +import org.openapitools.jackson.nullable.JsonNullable; + +/** The create request for an IPv6 network with a specified prefix. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateNetworkIPv6WithPrefix { + public static final String SERIALIZED_NAME_GATEWAY = "gateway"; + + @SerializedName(SERIALIZED_NAME_GATEWAY) + @javax.annotation.Nullable private String gateway; + + public static final String SERIALIZED_NAME_NAMESERVERS = "nameservers"; + + @SerializedName(SERIALIZED_NAME_NAMESERVERS) + @javax.annotation.Nullable private List nameservers = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PREFIX = "prefix"; + + @SerializedName(SERIALIZED_NAME_PREFIX) + @javax.annotation.Nonnull + private String prefix; + + public CreateNetworkIPv6WithPrefix() {} + + public CreateNetworkIPv6WithPrefix gateway(@javax.annotation.Nullable String gateway) { + this.gateway = gateway; + return this; + } + + /** + * The IPv6 gateway of a network. If not specified the first IP of the network will be assigned + * as the gateway. If 'null' is sent, then the network doesn't have a gateway. + * + * @return gateway + */ + @javax.annotation.Nullable public String getGateway() { + return gateway; + } + + public void setGateway(@javax.annotation.Nullable String gateway) { + this.gateway = gateway; + } + + public CreateNetworkIPv6WithPrefix nameservers( + @javax.annotation.Nullable List nameservers) { + this.nameservers = nameservers; + return this; + } + + public CreateNetworkIPv6WithPrefix addNameserversItem(String nameserversItem) { + if (this.nameservers == null) { + this.nameservers = new ArrayList<>(); + } + this.nameservers.add(nameserversItem); + return this; + } + + /** + * A list containing DNS Servers/Nameservers for IPv6. + * + * @return nameservers + */ + @javax.annotation.Nullable public List getNameservers() { + return nameservers; + } + + public void setNameservers(@javax.annotation.Nullable List nameservers) { + this.nameservers = nameservers; + } + + public CreateNetworkIPv6WithPrefix prefix(@javax.annotation.Nonnull String prefix) { + this.prefix = prefix; + return this; + } + + /** + * Classless Inter-Domain Routing (CIDR) for IPv6. + * + * @return prefix + */ + @javax.annotation.Nonnull + public String getPrefix() { + return prefix; + } + + public void setPrefix(@javax.annotation.Nonnull String prefix) { + this.prefix = prefix; + } + + /** + * 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 CreateNetworkIPv6WithPrefix instance itself + */ + public CreateNetworkIPv6WithPrefix 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; + } + CreateNetworkIPv6WithPrefix createNetworkIPv6WithPrefix = (CreateNetworkIPv6WithPrefix) o; + return Objects.equals(this.gateway, createNetworkIPv6WithPrefix.gateway) + && Objects.equals(this.nameservers, createNetworkIPv6WithPrefix.nameservers) + && Objects.equals(this.prefix, createNetworkIPv6WithPrefix.prefix) + && Objects.equals( + this.additionalProperties, + createNetworkIPv6WithPrefix.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(gateway, nameservers, prefix, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateNetworkIPv6WithPrefix {\n"); + sb.append(" gateway: ").append(toIndentedString(gateway)).append("\n"); + sb.append(" nameservers: ").append(toIndentedString(nameservers)).append("\n"); + sb.append(" prefix: ").append(toIndentedString(prefix)).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("gateway", "nameservers", "prefix")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("prefix")); + } + + /** + * 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 + * CreateNetworkIPv6WithPrefix + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateNetworkIPv6WithPrefix.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 CreateNetworkIPv6WithPrefix is not found in the empty JSON string", + CreateNetworkIPv6WithPrefix.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateNetworkIPv6WithPrefix.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("gateway") != null && !jsonObj.get("gateway").isJsonNull()) + && !jsonObj.get("gateway").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `gateway` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("gateway").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("nameservers") != null + && !jsonObj.get("nameservers").isJsonNull() + && !jsonObj.get("nameservers").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `nameservers` to be an array in the JSON string but got `%s`", + jsonObj.get("nameservers").toString())); + } + if (!jsonObj.get("prefix").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `prefix` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("prefix").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateNetworkIPv6WithPrefix.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateNetworkIPv6WithPrefix' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateNetworkIPv6WithPrefix.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateNetworkIPv6WithPrefix 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 CreateNetworkIPv6WithPrefix read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateNetworkIPv6WithPrefix 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 CreateNetworkIPv6WithPrefix given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateNetworkIPv6WithPrefix + * @throws IOException if the JSON string is invalid with respect to CreateNetworkIPv6WithPrefix + */ + public static CreateNetworkIPv6WithPrefix fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateNetworkIPv6WithPrefix.class); + } + + /** + * Convert an instance of CreateNetworkIPv6WithPrefix to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateNetworkIPv6WithPrefixLength.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateNetworkIPv6WithPrefixLength.java new file mode 100644 index 00000000..dd596949 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateNetworkIPv6WithPrefixLength.java @@ -0,0 +1,356 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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.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; + +/** The create request for an IPv6 network with a wanted prefix length. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateNetworkIPv6WithPrefixLength { + public static final String SERIALIZED_NAME_NAMESERVERS = "nameservers"; + + @SerializedName(SERIALIZED_NAME_NAMESERVERS) + @javax.annotation.Nullable private List nameservers = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PREFIX_LENGTH = "prefixLength"; + + @SerializedName(SERIALIZED_NAME_PREFIX_LENGTH) + @javax.annotation.Nonnull + private Long prefixLength; + + public CreateNetworkIPv6WithPrefixLength() {} + + public CreateNetworkIPv6WithPrefixLength nameservers( + @javax.annotation.Nullable List nameservers) { + this.nameservers = nameservers; + return this; + } + + public CreateNetworkIPv6WithPrefixLength addNameserversItem(String nameserversItem) { + if (this.nameservers == null) { + this.nameservers = new ArrayList<>(); + } + this.nameservers.add(nameserversItem); + return this; + } + + /** + * A list containing DNS Servers/Nameservers for IPv6. + * + * @return nameservers + */ + @javax.annotation.Nullable public List getNameservers() { + return nameservers; + } + + public void setNameservers(@javax.annotation.Nullable List nameservers) { + this.nameservers = nameservers; + } + + public CreateNetworkIPv6WithPrefixLength prefixLength( + @javax.annotation.Nonnull Long prefixLength) { + this.prefixLength = prefixLength; + return this; + } + + /** + * Get prefixLength minimum: 56 maximum: 128 + * + * @return prefixLength + */ + @javax.annotation.Nonnull + public Long getPrefixLength() { + return prefixLength; + } + + public void setPrefixLength(@javax.annotation.Nonnull Long prefixLength) { + this.prefixLength = prefixLength; + } + + /** + * 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 CreateNetworkIPv6WithPrefixLength instance itself + */ + public CreateNetworkIPv6WithPrefixLength 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; + } + CreateNetworkIPv6WithPrefixLength createNetworkIPv6WithPrefixLength = + (CreateNetworkIPv6WithPrefixLength) o; + return Objects.equals(this.nameservers, createNetworkIPv6WithPrefixLength.nameservers) + && Objects.equals(this.prefixLength, createNetworkIPv6WithPrefixLength.prefixLength) + && Objects.equals( + this.additionalProperties, + createNetworkIPv6WithPrefixLength.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(nameservers, prefixLength, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateNetworkIPv6WithPrefixLength {\n"); + sb.append(" nameservers: ").append(toIndentedString(nameservers)).append("\n"); + sb.append(" prefixLength: ").append(toIndentedString(prefixLength)).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("nameservers", "prefixLength")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("prefixLength")); + } + + /** + * 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 + * CreateNetworkIPv6WithPrefixLength + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateNetworkIPv6WithPrefixLength.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 CreateNetworkIPv6WithPrefixLength is not found in the empty JSON string", + CreateNetworkIPv6WithPrefixLength.openapiRequiredFields + .toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateNetworkIPv6WithPrefixLength.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 optional json data is an array if present + if (jsonObj.get("nameservers") != null + && !jsonObj.get("nameservers").isJsonNull() + && !jsonObj.get("nameservers").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `nameservers` to be an array in the JSON string but got `%s`", + jsonObj.get("nameservers").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateNetworkIPv6WithPrefixLength.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateNetworkIPv6WithPrefixLength' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateNetworkIPv6WithPrefixLength.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateNetworkIPv6WithPrefixLength 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 CreateNetworkIPv6WithPrefixLength read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateNetworkIPv6WithPrefixLength 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 CreateNetworkIPv6WithPrefixLength given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateNetworkIPv6WithPrefixLength + * @throws IOException if the JSON string is invalid with respect to + * CreateNetworkIPv6WithPrefixLength + */ + public static CreateNetworkIPv6WithPrefixLength fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateNetworkIPv6WithPrefixLength.class); + } + + /** + * Convert an instance of CreateNetworkIPv6WithPrefixLength to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateNetworkPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateNetworkPayload.java new file mode 100644 index 00000000..6d9c03bf --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateNetworkPayload.java @@ -0,0 +1,489 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +/** Object that represents the request body for a network create. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateNetworkPayload { + public static final String SERIALIZED_NAME_DHCP = "dhcp"; + + @SerializedName(SERIALIZED_NAME_DHCP) + @javax.annotation.Nullable private Boolean dhcp = true; + + public static final String SERIALIZED_NAME_IPV4 = "ipv4"; + + @SerializedName(SERIALIZED_NAME_IPV4) + @javax.annotation.Nullable private CreateNetworkIPv4 ipv4; + + public static final String SERIALIZED_NAME_IPV6 = "ipv6"; + + @SerializedName(SERIALIZED_NAME_IPV6) + @javax.annotation.Nullable private CreateNetworkIPv6 ipv6; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_ROUTED = "routed"; + + @SerializedName(SERIALIZED_NAME_ROUTED) + @javax.annotation.Nullable private Boolean routed; + + public static final String SERIALIZED_NAME_ROUTING_TABLE_ID = "routingTableId"; + + @SerializedName(SERIALIZED_NAME_ROUTING_TABLE_ID) + @javax.annotation.Nullable private UUID routingTableId; + + public CreateNetworkPayload() {} + + public CreateNetworkPayload dhcp(@javax.annotation.Nullable Boolean dhcp) { + this.dhcp = dhcp; + return this; + } + + /** + * Enable or disable DHCP for a network. + * + * @return dhcp + */ + @javax.annotation.Nullable public Boolean getDhcp() { + return dhcp; + } + + public void setDhcp(@javax.annotation.Nullable Boolean dhcp) { + this.dhcp = dhcp; + } + + public CreateNetworkPayload ipv4(@javax.annotation.Nullable CreateNetworkIPv4 ipv4) { + this.ipv4 = ipv4; + return this; + } + + /** + * Get ipv4 + * + * @return ipv4 + */ + @javax.annotation.Nullable public CreateNetworkIPv4 getIpv4() { + return ipv4; + } + + public void setIpv4(@javax.annotation.Nullable CreateNetworkIPv4 ipv4) { + this.ipv4 = ipv4; + } + + public CreateNetworkPayload ipv6(@javax.annotation.Nullable CreateNetworkIPv6 ipv6) { + this.ipv6 = ipv6; + return this; + } + + /** + * Get ipv6 + * + * @return ipv6 + */ + @javax.annotation.Nullable public CreateNetworkIPv6 getIpv6() { + return ipv6; + } + + public void setIpv6(@javax.annotation.Nullable CreateNetworkIPv6 ipv6) { + this.ipv6 = ipv6; + } + + public CreateNetworkPayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public CreateNetworkPayload name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + public CreateNetworkPayload routed(@javax.annotation.Nullable Boolean routed) { + this.routed = routed; + return this; + } + + /** + * Shows if the network is routed and therefore accessible from other networks. + * + * @return routed + */ + @javax.annotation.Nullable public Boolean getRouted() { + return routed; + } + + public void setRouted(@javax.annotation.Nullable Boolean routed) { + this.routed = routed; + } + + public CreateNetworkPayload routingTableId(@javax.annotation.Nullable UUID routingTableId) { + this.routingTableId = routingTableId; + return this; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return routingTableId + */ + @javax.annotation.Nullable public UUID getRoutingTableId() { + return routingTableId; + } + + public void setRoutingTableId(@javax.annotation.Nullable UUID routingTableId) { + this.routingTableId = routingTableId; + } + + /** + * 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 CreateNetworkPayload instance itself + */ + public CreateNetworkPayload 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; + } + CreateNetworkPayload createNetworkPayload = (CreateNetworkPayload) o; + return Objects.equals(this.dhcp, createNetworkPayload.dhcp) + && Objects.equals(this.ipv4, createNetworkPayload.ipv4) + && Objects.equals(this.ipv6, createNetworkPayload.ipv6) + && Objects.equals(this.labels, createNetworkPayload.labels) + && Objects.equals(this.name, createNetworkPayload.name) + && Objects.equals(this.routed, createNetworkPayload.routed) + && Objects.equals(this.routingTableId, createNetworkPayload.routingTableId) + && Objects.equals( + this.additionalProperties, createNetworkPayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + dhcp, ipv4, ipv6, labels, name, routed, routingTableId, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateNetworkPayload {\n"); + sb.append(" dhcp: ").append(toIndentedString(dhcp)).append("\n"); + sb.append(" ipv4: ").append(toIndentedString(ipv4)).append("\n"); + sb.append(" ipv6: ").append(toIndentedString(ipv6)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" routed: ").append(toIndentedString(routed)).append("\n"); + sb.append(" routingTableId: ").append(toIndentedString(routingTableId)).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( + "dhcp", + "ipv4", + "ipv6", + "labels", + "name", + "routed", + "routingTableId")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name")); + } + + /** + * 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 CreateNetworkPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateNetworkPayload.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 CreateNetworkPayload is not found in the empty JSON string", + CreateNetworkPayload.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateNetworkPayload.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 optional field `ipv4` + if (jsonObj.get("ipv4") != null && !jsonObj.get("ipv4").isJsonNull()) { + CreateNetworkIPv4.validateJsonElement(jsonObj.get("ipv4")); + } + // validate the optional field `ipv6` + if (jsonObj.get("ipv6") != null && !jsonObj.get("ipv6").isJsonNull()) { + CreateNetworkIPv6.validateJsonElement(jsonObj.get("ipv6")); + } + 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("routingTableId") != null && !jsonObj.get("routingTableId").isJsonNull()) + && !jsonObj.get("routingTableId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `routingTableId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("routingTableId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateNetworkPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateNetworkPayload' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateNetworkPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateNetworkPayload 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 CreateNetworkPayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateNetworkPayload 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 CreateNetworkPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateNetworkPayload + * @throws IOException if the JSON string is invalid with respect to CreateNetworkPayload + */ + public static CreateNetworkPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateNetworkPayload.class); + } + + /** + * Convert an instance of CreateNetworkPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateNicPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateNicPayload.java new file mode 100644 index 00000000..860ca8ec --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateNicPayload.java @@ -0,0 +1,735 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; +import java.util.UUID; + +/** Object that represents a network interface. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateNicPayload { + public static final String SERIALIZED_NAME_ALLOWED_ADDRESSES = "allowedAddresses"; + + @SerializedName(SERIALIZED_NAME_ALLOWED_ADDRESSES) + @javax.annotation.Nullable private List allowedAddresses = new ArrayList<>(); + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable private String description; + + public static final String SERIALIZED_NAME_DEVICE = "device"; + + @SerializedName(SERIALIZED_NAME_DEVICE) + @javax.annotation.Nullable private UUID device; + + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_IPV4 = "ipv4"; + + @SerializedName(SERIALIZED_NAME_IPV4) + @javax.annotation.Nullable private String ipv4; + + public static final String SERIALIZED_NAME_IPV6 = "ipv6"; + + @SerializedName(SERIALIZED_NAME_IPV6) + @javax.annotation.Nullable private String ipv6; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_MAC = "mac"; + + @SerializedName(SERIALIZED_NAME_MAC) + @javax.annotation.Nullable private String mac; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; + + public static final String SERIALIZED_NAME_NETWORK_ID = "networkId"; + + @SerializedName(SERIALIZED_NAME_NETWORK_ID) + @javax.annotation.Nullable private UUID networkId; + + public static final String SERIALIZED_NAME_NIC_SECURITY = "nicSecurity"; + + @SerializedName(SERIALIZED_NAME_NIC_SECURITY) + @javax.annotation.Nullable private Boolean nicSecurity = true; + + public static final String SERIALIZED_NAME_SECURITY_GROUPS = "securityGroups"; + + @SerializedName(SERIALIZED_NAME_SECURITY_GROUPS) + @javax.annotation.Nullable private List securityGroups = new ArrayList<>(); + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable private String status; + + public static final String SERIALIZED_NAME_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable private String type; + + public CreateNicPayload() {} + + public CreateNicPayload( + UUID device, UUID id, String mac, UUID networkId, String status, String type) { + this(); + this.device = device; + this.id = id; + this.mac = mac; + this.networkId = networkId; + this.status = status; + this.type = type; + } + + public CreateNicPayload allowedAddresses( + @javax.annotation.Nullable List allowedAddresses) { + this.allowedAddresses = allowedAddresses; + return this; + } + + public CreateNicPayload addAllowedAddressesItem(AllowedAddressesInner allowedAddressesItem) { + if (this.allowedAddresses == null) { + this.allowedAddresses = new ArrayList<>(); + } + this.allowedAddresses.add(allowedAddressesItem); + return this; + } + + /** + * A list of IPs or CIDR notations. + * + * @return allowedAddresses + */ + @javax.annotation.Nullable public List getAllowedAddresses() { + return allowedAddresses; + } + + public void setAllowedAddresses( + @javax.annotation.Nullable List allowedAddresses) { + this.allowedAddresses = allowedAddresses; + } + + public CreateNicPayload description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Description Object. Allows string up to 255 Characters. + * + * @return description + */ + @javax.annotation.Nullable public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return device + */ + @javax.annotation.Nullable public UUID getDevice() { + return device; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + public CreateNicPayload ipv4(@javax.annotation.Nullable String ipv4) { + this.ipv4 = ipv4; + return this; + } + + /** + * Object that represents an IP address. + * + * @return ipv4 + */ + @javax.annotation.Nullable public String getIpv4() { + return ipv4; + } + + public void setIpv4(@javax.annotation.Nullable String ipv4) { + this.ipv4 = ipv4; + } + + public CreateNicPayload ipv6(@javax.annotation.Nullable String ipv6) { + this.ipv6 = ipv6; + return this; + } + + /** + * String that represents an IPv6 address. + * + * @return ipv6 + */ + @javax.annotation.Nullable public String getIpv6() { + return ipv6; + } + + public void setIpv6(@javax.annotation.Nullable String ipv6) { + this.ipv6 = ipv6; + } + + public CreateNicPayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + /** + * Object that represents an MAC address. + * + * @return mac + */ + @javax.annotation.Nullable public String getMac() { + return mac; + } + + public CreateNicPayload name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nullable public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return networkId + */ + @javax.annotation.Nullable public UUID getNetworkId() { + return networkId; + } + + public CreateNicPayload nicSecurity(@javax.annotation.Nullable Boolean nicSecurity) { + this.nicSecurity = nicSecurity; + return this; + } + + /** + * If this is set to false, then no security groups will apply to this network interface. + * + * @return nicSecurity + */ + @javax.annotation.Nullable public Boolean getNicSecurity() { + return nicSecurity; + } + + public void setNicSecurity(@javax.annotation.Nullable Boolean nicSecurity) { + this.nicSecurity = nicSecurity; + } + + public CreateNicPayload securityGroups(@javax.annotation.Nullable List securityGroups) { + this.securityGroups = securityGroups; + return this; + } + + public CreateNicPayload addSecurityGroupsItem(UUID securityGroupsItem) { + if (this.securityGroups == null) { + this.securityGroups = new ArrayList<>(); + } + this.securityGroups.add(securityGroupsItem); + return this; + } + + /** + * A list of UUIDs. + * + * @return securityGroups + */ + @javax.annotation.Nullable public List getSecurityGroups() { + return securityGroups; + } + + public void setSecurityGroups(@javax.annotation.Nullable List securityGroups) { + this.securityGroups = securityGroups; + } + + /** + * Possible values: `ACTIVE`, `DOWN`. + * + * @return status + */ + @javax.annotation.Nullable public String getStatus() { + return status; + } + + /** + * Possible values: `server`, `metadata`, `gateway`, + * `none`. + * + * @return type + */ + @javax.annotation.Nullable public String getType() { + return 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 CreateNicPayload instance itself + */ + public CreateNicPayload 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; + } + CreateNicPayload createNicPayload = (CreateNicPayload) o; + return Objects.equals(this.allowedAddresses, createNicPayload.allowedAddresses) + && Objects.equals(this.description, createNicPayload.description) + && Objects.equals(this.device, createNicPayload.device) + && Objects.equals(this.id, createNicPayload.id) + && Objects.equals(this.ipv4, createNicPayload.ipv4) + && Objects.equals(this.ipv6, createNicPayload.ipv6) + && Objects.equals(this.labels, createNicPayload.labels) + && Objects.equals(this.mac, createNicPayload.mac) + && Objects.equals(this.name, createNicPayload.name) + && Objects.equals(this.networkId, createNicPayload.networkId) + && Objects.equals(this.nicSecurity, createNicPayload.nicSecurity) + && Objects.equals(this.securityGroups, createNicPayload.securityGroups) + && Objects.equals(this.status, createNicPayload.status) + && Objects.equals(this.type, createNicPayload.type) + && Objects.equals(this.additionalProperties, createNicPayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + allowedAddresses, + description, + device, + id, + ipv4, + ipv6, + labels, + mac, + name, + networkId, + nicSecurity, + securityGroups, + status, + type, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateNicPayload {\n"); + sb.append(" allowedAddresses: ").append(toIndentedString(allowedAddresses)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" device: ").append(toIndentedString(device)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" ipv4: ").append(toIndentedString(ipv4)).append("\n"); + sb.append(" ipv6: ").append(toIndentedString(ipv6)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" mac: ").append(toIndentedString(mac)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" networkId: ").append(toIndentedString(networkId)).append("\n"); + sb.append(" nicSecurity: ").append(toIndentedString(nicSecurity)).append("\n"); + sb.append(" securityGroups: ").append(toIndentedString(securityGroups)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).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( + "allowedAddresses", + "description", + "device", + "id", + "ipv4", + "ipv6", + "labels", + "mac", + "name", + "networkId", + "nicSecurity", + "securityGroups", + "status", + "type")); + + // 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 CreateNicPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateNicPayload.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 CreateNicPayload is not found in the empty JSON string", + CreateNicPayload.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("allowedAddresses") != null + && !jsonObj.get("allowedAddresses").isJsonNull()) { + JsonArray jsonArrayallowedAddresses = jsonObj.getAsJsonArray("allowedAddresses"); + if (jsonArrayallowedAddresses != null) { + // ensure the json data is an array + if (!jsonObj.get("allowedAddresses").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `allowedAddresses` to be an array in the JSON string but got `%s`", + jsonObj.get("allowedAddresses").toString())); + } + + // validate the optional field `allowedAddresses` (array) + for (int i = 0; i < jsonArrayallowedAddresses.size(); i++) { + AllowedAddressesInner.validateJsonElement(jsonArrayallowedAddresses.get(i)); + } + ; + } + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `description` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("description").toString())); + } + if ((jsonObj.get("device") != null && !jsonObj.get("device").isJsonNull()) + && !jsonObj.get("device").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `device` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("device").toString())); + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if ((jsonObj.get("ipv4") != null && !jsonObj.get("ipv4").isJsonNull()) + && !jsonObj.get("ipv4").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `ipv4` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("ipv4").toString())); + } + if ((jsonObj.get("ipv6") != null && !jsonObj.get("ipv6").isJsonNull()) + && !jsonObj.get("ipv6").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `ipv6` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("ipv6").toString())); + } + if ((jsonObj.get("mac") != null && !jsonObj.get("mac").isJsonNull()) + && !jsonObj.get("mac").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `mac` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("mac").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `name` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("name").toString())); + } + if ((jsonObj.get("networkId") != null && !jsonObj.get("networkId").isJsonNull()) + && !jsonObj.get("networkId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `networkId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("networkId").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("securityGroups") != null + && !jsonObj.get("securityGroups").isJsonNull() + && !jsonObj.get("securityGroups").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `securityGroups` to be an array in the JSON string but got `%s`", + jsonObj.get("securityGroups").toString())); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) + && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `status` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("status").toString())); + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) + && !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 (!CreateNicPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateNicPayload' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateNicPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateNicPayload 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 CreateNicPayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateNicPayload 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 CreateNicPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateNicPayload + * @throws IOException if the JSON string is invalid with respect to CreateNicPayload + */ + public static CreateNicPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateNicPayload.class); + } + + /** + * Convert an instance of CreateNicPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateProtocol.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateProtocol.java new file mode 100644 index 00000000..80276b04 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateProtocol.java @@ -0,0 +1,308 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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 CreateProtocol extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(CreateProtocol.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateProtocol.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateProtocol' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterLong = + gson.getDelegateAdapter(this, TypeToken.get(Long.class)); + final TypeAdapter adapterString = + gson.getDelegateAdapter(this, TypeToken.get(String.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateProtocol value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `Long` + if (value.getActualInstance() instanceof Long) { + JsonPrimitive primitive = + adapterLong + .toJsonTree((Long) value.getActualInstance()) + .getAsJsonPrimitive(); + elementAdapter.write(out, primitive); + 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; + } + throw new IOException( + "Failed to serialize as the type doesn't match oneOf schemas: Long, String"); + } + + @Override + public CreateProtocol read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize Long + 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 = adapterLong; + match++; + log.log(Level.FINER, "Input data matches schema 'Long'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for Long failed with `%s`.", + e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'Long'", e); + } + // 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; + match++; + log.log(Level.FINER, "Input data matches schema 'String'"); + } 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); + } + + if (match == 1) { + CreateProtocol ret = new CreateProtocol(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException( + String.format( + java.util.Locale.ROOT, + "Failed deserialization for CreateProtocol: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", + match, + errorMessages, + jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public CreateProtocol() { + super("oneOf", Boolean.FALSE); + } + + public CreateProtocol(Object o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("Long", Long.class); + schemas.put("String", String.class); + } + + @Override + public Map> getSchemas() { + return CreateProtocol.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: Long, String + * + *

It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof Long) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof String) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Long, String"); + } + + /** + * Get the actual instance, which can be the following: Long, String + * + * @return The actual instance (Long, String) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Long`. If the actual instance is not `Long`, the + * ClassCastException will be thrown. + * + * @return The actual instance of `Long` + * @throws ClassCastException if the instance is not `Long` + */ + public Long getLong() throws ClassCastException { + return (Long) 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(); + } + + /** + * 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 CreateProtocol + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with Long + 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())); + } + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for Long failed with `%s`.", + e.getMessage())); + // continue to the next one + } + // 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())); + } + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for String failed with `%s`.", + e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException( + String.format( + java.util.Locale.ROOT, + "The JSON string is invalid for CreateProtocol with oneOf schemas: Long, String. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", + validCount, + errorMessages, + jsonElement.toString())); + } + } + + /** + * Create an instance of CreateProtocol given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateProtocol + * @throws IOException if the JSON string is invalid with respect to CreateProtocol + */ + public static CreateProtocol fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateProtocol.class); + } + + /** + * Convert an instance of CreateProtocol to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreatePublicIPPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreatePublicIPPayload.java new file mode 100644 index 00000000..10c1aaf4 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreatePublicIPPayload.java @@ -0,0 +1,399 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Object that represents a public IP. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreatePublicIPPayload { + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_IP = "ip"; + + @SerializedName(SERIALIZED_NAME_IP) + @javax.annotation.Nullable private String ip; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NETWORK_INTERFACE = "networkInterface"; + + @SerializedName(SERIALIZED_NAME_NETWORK_INTERFACE) + @javax.annotation.Nullable private UUID networkInterface; + + public CreatePublicIPPayload() {} + + public CreatePublicIPPayload(UUID id, String ip) { + this(); + this.id = id; + this.ip = ip; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + /** + * String that represents an IPv4 address. + * + * @return ip + */ + @javax.annotation.Nullable public String getIp() { + return ip; + } + + public CreatePublicIPPayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public CreatePublicIPPayload networkInterface( + @javax.annotation.Nullable UUID networkInterface) { + this.networkInterface = networkInterface; + return this; + } + + /** + * Associate the public IP with a network interface (ID). + * + * @return networkInterface + */ + @javax.annotation.Nullable public UUID getNetworkInterface() { + return networkInterface; + } + + public void setNetworkInterface(@javax.annotation.Nullable UUID networkInterface) { + this.networkInterface = networkInterface; + } + + /** + * 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 CreatePublicIPPayload instance itself + */ + public CreatePublicIPPayload 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; + } + CreatePublicIPPayload createPublicIPPayload = (CreatePublicIPPayload) o; + return Objects.equals(this.id, createPublicIPPayload.id) + && Objects.equals(this.ip, createPublicIPPayload.ip) + && Objects.equals(this.labels, createPublicIPPayload.labels) + && Objects.equals(this.networkInterface, createPublicIPPayload.networkInterface) + && Objects.equals( + this.additionalProperties, createPublicIPPayload.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(id, ip, labels, networkInterface, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreatePublicIPPayload {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" ip: ").append(toIndentedString(ip)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" networkInterface: ").append(toIndentedString(networkInterface)).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("id", "ip", "labels", "networkInterface")); + + // 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 CreatePublicIPPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreatePublicIPPayload.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 CreatePublicIPPayload is not found in the empty JSON string", + CreatePublicIPPayload.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if ((jsonObj.get("ip") != null && !jsonObj.get("ip").isJsonNull()) + && !jsonObj.get("ip").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `ip` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("ip").toString())); + } + if ((jsonObj.get("networkInterface") != null + && !jsonObj.get("networkInterface").isJsonNull()) + && !jsonObj.get("networkInterface").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `networkInterface` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("networkInterface").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreatePublicIPPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreatePublicIPPayload' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreatePublicIPPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreatePublicIPPayload 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 CreatePublicIPPayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreatePublicIPPayload 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 CreatePublicIPPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreatePublicIPPayload + * @throws IOException if the JSON string is invalid with respect to CreatePublicIPPayload + */ + public static CreatePublicIPPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreatePublicIPPayload.class); + } + + /** + * Convert an instance of CreatePublicIPPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateSecurityGroupPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateSecurityGroupPayload.java new file mode 100644 index 00000000..35fe2192 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateSecurityGroupPayload.java @@ -0,0 +1,522 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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.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; +import java.util.UUID; + +/** Object that represents a security group. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateSecurityGroupPayload { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable private String description; + + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_RULES = "rules"; + + @SerializedName(SERIALIZED_NAME_RULES) + @javax.annotation.Nullable private List rules; + + public static final String SERIALIZED_NAME_STATEFUL = "stateful"; + + @SerializedName(SERIALIZED_NAME_STATEFUL) + @javax.annotation.Nullable private Boolean stateful = true; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable private OffsetDateTime updatedAt; + + public CreateSecurityGroupPayload() {} + + public CreateSecurityGroupPayload( + OffsetDateTime createdAt, + UUID id, + List rules, + OffsetDateTime updatedAt) { + this(); + this.createdAt = createdAt; + this.id = id; + this.rules = rules; + this.updatedAt = updatedAt; + } + + /** + * Date-time when resource was created. + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public CreateSecurityGroupPayload description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Description Object. Allows string up to 255 Characters. + * + * @return description + */ + @javax.annotation.Nullable public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + public CreateSecurityGroupPayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public CreateSecurityGroupPayload name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + /** + * A list containing security group rule objects. + * + * @return rules + */ + @javax.annotation.Nullable public List getRules() { + return rules; + } + + public CreateSecurityGroupPayload stateful(@javax.annotation.Nullable Boolean stateful) { + this.stateful = stateful; + return this; + } + + /** + * Shows if a security group is stateful or stateless. You can only have one type of security + * groups per network interface/server. + * + * @return stateful + */ + @javax.annotation.Nullable public Boolean getStateful() { + return stateful; + } + + public void setStateful(@javax.annotation.Nullable Boolean stateful) { + this.stateful = stateful; + } + + /** + * Date-time when resource was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nullable public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * 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 CreateSecurityGroupPayload instance itself + */ + public CreateSecurityGroupPayload 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; + } + CreateSecurityGroupPayload createSecurityGroupPayload = (CreateSecurityGroupPayload) o; + return Objects.equals(this.createdAt, createSecurityGroupPayload.createdAt) + && Objects.equals(this.description, createSecurityGroupPayload.description) + && Objects.equals(this.id, createSecurityGroupPayload.id) + && Objects.equals(this.labels, createSecurityGroupPayload.labels) + && Objects.equals(this.name, createSecurityGroupPayload.name) + && Objects.equals(this.rules, createSecurityGroupPayload.rules) + && Objects.equals(this.stateful, createSecurityGroupPayload.stateful) + && Objects.equals(this.updatedAt, createSecurityGroupPayload.updatedAt) + && Objects.equals( + this.additionalProperties, createSecurityGroupPayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + createdAt, + description, + id, + labels, + name, + rules, + stateful, + updatedAt, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateSecurityGroupPayload {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" rules: ").append(toIndentedString(rules)).append("\n"); + sb.append(" stateful: ").append(toIndentedString(stateful)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).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( + "createdAt", + "description", + "id", + "labels", + "name", + "rules", + "stateful", + "updatedAt")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name")); + } + + /** + * 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 CreateSecurityGroupPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateSecurityGroupPayload.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 CreateSecurityGroupPayload is not found in the empty JSON string", + CreateSecurityGroupPayload.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateSecurityGroupPayload.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("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `description` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("description").toString())); + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if (!jsonObj.get("name").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("rules") != null && !jsonObj.get("rules").isJsonNull()) { + JsonArray jsonArrayrules = jsonObj.getAsJsonArray("rules"); + if (jsonArrayrules != null) { + // ensure the json data is an array + if (!jsonObj.get("rules").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `rules` to be an array in the JSON string but got `%s`", + jsonObj.get("rules").toString())); + } + + // validate the optional field `rules` (array) + for (int i = 0; i < jsonArrayrules.size(); i++) { + SecurityGroupRule.validateJsonElement(jsonArrayrules.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSecurityGroupPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSecurityGroupPayload' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateSecurityGroupPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSecurityGroupPayload 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 CreateSecurityGroupPayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateSecurityGroupPayload 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 CreateSecurityGroupPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSecurityGroupPayload + * @throws IOException if the JSON string is invalid with respect to CreateSecurityGroupPayload + */ + public static CreateSecurityGroupPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSecurityGroupPayload.class); + } + + /** + * Convert an instance of CreateSecurityGroupPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateSecurityGroupRulePayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateSecurityGroupRulePayload.java new file mode 100644 index 00000000..f2dac64c --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateSecurityGroupRulePayload.java @@ -0,0 +1,667 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; +import java.util.UUID; + +/** Object that represents a request body for security group rule creation. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateSecurityGroupRulePayload { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable private String description; + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + + @SerializedName(SERIALIZED_NAME_DIRECTION) + @javax.annotation.Nonnull + private String direction; + + public static final String SERIALIZED_NAME_ETHERTYPE = "ethertype"; + + @SerializedName(SERIALIZED_NAME_ETHERTYPE) + @javax.annotation.Nullable private String ethertype = "IPv4"; + + public static final String SERIALIZED_NAME_ICMP_PARAMETERS = "icmpParameters"; + + @SerializedName(SERIALIZED_NAME_ICMP_PARAMETERS) + @javax.annotation.Nullable private ICMPParameters icmpParameters; + + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_IP_RANGE = "ipRange"; + + @SerializedName(SERIALIZED_NAME_IP_RANGE) + @javax.annotation.Nullable private String ipRange; + + public static final String SERIALIZED_NAME_PORT_RANGE = "portRange"; + + @SerializedName(SERIALIZED_NAME_PORT_RANGE) + @javax.annotation.Nullable private PortRange portRange; + + public static final String SERIALIZED_NAME_REMOTE_SECURITY_GROUP_ID = "remoteSecurityGroupId"; + + @SerializedName(SERIALIZED_NAME_REMOTE_SECURITY_GROUP_ID) + @javax.annotation.Nullable private UUID remoteSecurityGroupId; + + public static final String SERIALIZED_NAME_SECURITY_GROUP_ID = "securityGroupId"; + + @SerializedName(SERIALIZED_NAME_SECURITY_GROUP_ID) + @javax.annotation.Nullable private UUID securityGroupId; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable private OffsetDateTime updatedAt; + + public static final String SERIALIZED_NAME_PROTOCOL = "protocol"; + + @SerializedName(SERIALIZED_NAME_PROTOCOL) + @javax.annotation.Nullable private CreateProtocol protocol; + + public CreateSecurityGroupRulePayload() {} + + public CreateSecurityGroupRulePayload( + OffsetDateTime createdAt, UUID id, UUID securityGroupId, OffsetDateTime updatedAt) { + this(); + this.createdAt = createdAt; + this.id = id; + this.securityGroupId = securityGroupId; + this.updatedAt = updatedAt; + } + + /** + * Date-time when resource was created. + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public CreateSecurityGroupRulePayload description( + @javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Description Object. Allows string up to 255 Characters. + * + * @return description + */ + @javax.annotation.Nullable public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + public CreateSecurityGroupRulePayload direction(@javax.annotation.Nonnull String direction) { + this.direction = direction; + return this; + } + + /** + * The direction of the traffic which the rule should match. Possible values: + * `ingress`, `egress`. + * + * @return direction + */ + @javax.annotation.Nonnull + public String getDirection() { + return direction; + } + + public void setDirection(@javax.annotation.Nonnull String direction) { + this.direction = direction; + } + + public CreateSecurityGroupRulePayload ethertype(@javax.annotation.Nullable String ethertype) { + this.ethertype = ethertype; + return this; + } + + /** + * The ethertype which the rule should match. Possible values: `IPv4`, + * `IPv6`. + * + * @return ethertype + */ + @javax.annotation.Nullable public String getEthertype() { + return ethertype; + } + + public void setEthertype(@javax.annotation.Nullable String ethertype) { + this.ethertype = ethertype; + } + + public CreateSecurityGroupRulePayload icmpParameters( + @javax.annotation.Nullable ICMPParameters icmpParameters) { + this.icmpParameters = icmpParameters; + return this; + } + + /** + * Get icmpParameters + * + * @return icmpParameters + */ + @javax.annotation.Nullable public ICMPParameters getIcmpParameters() { + return icmpParameters; + } + + public void setIcmpParameters(@javax.annotation.Nullable ICMPParameters icmpParameters) { + this.icmpParameters = icmpParameters; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + public CreateSecurityGroupRulePayload ipRange(@javax.annotation.Nullable String ipRange) { + this.ipRange = ipRange; + return this; + } + + /** + * The remote IP range which the rule should match. + * + * @return ipRange + */ + @javax.annotation.Nullable public String getIpRange() { + return ipRange; + } + + public void setIpRange(@javax.annotation.Nullable String ipRange) { + this.ipRange = ipRange; + } + + public CreateSecurityGroupRulePayload portRange( + @javax.annotation.Nullable PortRange portRange) { + this.portRange = portRange; + return this; + } + + /** + * Get portRange + * + * @return portRange + */ + @javax.annotation.Nullable public PortRange getPortRange() { + return portRange; + } + + public void setPortRange(@javax.annotation.Nullable PortRange portRange) { + this.portRange = portRange; + } + + public CreateSecurityGroupRulePayload remoteSecurityGroupId( + @javax.annotation.Nullable UUID remoteSecurityGroupId) { + this.remoteSecurityGroupId = remoteSecurityGroupId; + return this; + } + + /** + * The remote security group which the rule should match. + * + * @return remoteSecurityGroupId + */ + @javax.annotation.Nullable public UUID getRemoteSecurityGroupId() { + return remoteSecurityGroupId; + } + + public void setRemoteSecurityGroupId(@javax.annotation.Nullable UUID remoteSecurityGroupId) { + this.remoteSecurityGroupId = remoteSecurityGroupId; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return securityGroupId + */ + @javax.annotation.Nullable public UUID getSecurityGroupId() { + return securityGroupId; + } + + /** + * Date-time when resource was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nullable public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public CreateSecurityGroupRulePayload protocol( + @javax.annotation.Nullable CreateProtocol protocol) { + this.protocol = protocol; + return this; + } + + /** + * Get protocol + * + * @return protocol + */ + @javax.annotation.Nullable public CreateProtocol getProtocol() { + return protocol; + } + + public void setProtocol(@javax.annotation.Nullable CreateProtocol protocol) { + this.protocol = protocol; + } + + /** + * 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 CreateSecurityGroupRulePayload instance itself + */ + public CreateSecurityGroupRulePayload 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; + } + CreateSecurityGroupRulePayload createSecurityGroupRulePayload = + (CreateSecurityGroupRulePayload) o; + return Objects.equals(this.createdAt, createSecurityGroupRulePayload.createdAt) + && Objects.equals(this.description, createSecurityGroupRulePayload.description) + && Objects.equals(this.direction, createSecurityGroupRulePayload.direction) + && Objects.equals(this.ethertype, createSecurityGroupRulePayload.ethertype) + && Objects.equals( + this.icmpParameters, createSecurityGroupRulePayload.icmpParameters) + && Objects.equals(this.id, createSecurityGroupRulePayload.id) + && Objects.equals(this.ipRange, createSecurityGroupRulePayload.ipRange) + && Objects.equals(this.portRange, createSecurityGroupRulePayload.portRange) + && Objects.equals( + this.remoteSecurityGroupId, + createSecurityGroupRulePayload.remoteSecurityGroupId) + && Objects.equals( + this.securityGroupId, createSecurityGroupRulePayload.securityGroupId) + && Objects.equals(this.updatedAt, createSecurityGroupRulePayload.updatedAt) + && Objects.equals(this.protocol, createSecurityGroupRulePayload.protocol) + && Objects.equals( + this.additionalProperties, + createSecurityGroupRulePayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + createdAt, + description, + direction, + ethertype, + icmpParameters, + id, + ipRange, + portRange, + remoteSecurityGroupId, + securityGroupId, + updatedAt, + protocol, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateSecurityGroupRulePayload {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" ethertype: ").append(toIndentedString(ethertype)).append("\n"); + sb.append(" icmpParameters: ").append(toIndentedString(icmpParameters)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" ipRange: ").append(toIndentedString(ipRange)).append("\n"); + sb.append(" portRange: ").append(toIndentedString(portRange)).append("\n"); + sb.append(" remoteSecurityGroupId: ") + .append(toIndentedString(remoteSecurityGroupId)) + .append("\n"); + sb.append(" securityGroupId: ").append(toIndentedString(securityGroupId)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" protocol: ").append(toIndentedString(protocol)).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( + "createdAt", + "description", + "direction", + "ethertype", + "icmpParameters", + "id", + "ipRange", + "portRange", + "remoteSecurityGroupId", + "securityGroupId", + "updatedAt", + "protocol")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("direction")); + } + + /** + * 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 + * CreateSecurityGroupRulePayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateSecurityGroupRulePayload.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 CreateSecurityGroupRulePayload is not found in the empty JSON string", + CreateSecurityGroupRulePayload.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateSecurityGroupRulePayload.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("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `description` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("description").toString())); + } + if (!jsonObj.get("direction").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `direction` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("direction").toString())); + } + if ((jsonObj.get("ethertype") != null && !jsonObj.get("ethertype").isJsonNull()) + && !jsonObj.get("ethertype").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `ethertype` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("ethertype").toString())); + } + // validate the optional field `icmpParameters` + if (jsonObj.get("icmpParameters") != null && !jsonObj.get("icmpParameters").isJsonNull()) { + ICMPParameters.validateJsonElement(jsonObj.get("icmpParameters")); + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if ((jsonObj.get("ipRange") != null && !jsonObj.get("ipRange").isJsonNull()) + && !jsonObj.get("ipRange").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `ipRange` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("ipRange").toString())); + } + // validate the optional field `portRange` + if (jsonObj.get("portRange") != null && !jsonObj.get("portRange").isJsonNull()) { + PortRange.validateJsonElement(jsonObj.get("portRange")); + } + if ((jsonObj.get("remoteSecurityGroupId") != null + && !jsonObj.get("remoteSecurityGroupId").isJsonNull()) + && !jsonObj.get("remoteSecurityGroupId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `remoteSecurityGroupId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("remoteSecurityGroupId").toString())); + } + if ((jsonObj.get("securityGroupId") != null && !jsonObj.get("securityGroupId").isJsonNull()) + && !jsonObj.get("securityGroupId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `securityGroupId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("securityGroupId").toString())); + } + // validate the optional field `protocol` + if (jsonObj.get("protocol") != null && !jsonObj.get("protocol").isJsonNull()) { + CreateProtocol.validateJsonElement(jsonObj.get("protocol")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSecurityGroupRulePayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSecurityGroupRulePayload' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateSecurityGroupRulePayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSecurityGroupRulePayload 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 CreateSecurityGroupRulePayload read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateSecurityGroupRulePayload 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 CreateSecurityGroupRulePayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSecurityGroupRulePayload + * @throws IOException if the JSON string is invalid with respect to + * CreateSecurityGroupRulePayload + */ + public static CreateSecurityGroupRulePayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSecurityGroupRulePayload.class); + } + + /** + * Convert an instance of CreateSecurityGroupRulePayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateSecurityGroupRuleProtocol.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateSecurityGroupRuleProtocol.java new file mode 100644 index 00000000..70225fc6 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateSecurityGroupRuleProtocol.java @@ -0,0 +1,300 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** The internet protocol which the rule should match. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateSecurityGroupRuleProtocol { + public static final String SERIALIZED_NAME_PROTOCOL = "protocol"; + + @SerializedName(SERIALIZED_NAME_PROTOCOL) + @javax.annotation.Nullable private CreateProtocol protocol; + + public CreateSecurityGroupRuleProtocol() {} + + public CreateSecurityGroupRuleProtocol protocol( + @javax.annotation.Nullable CreateProtocol protocol) { + this.protocol = protocol; + return this; + } + + /** + * Get protocol + * + * @return protocol + */ + @javax.annotation.Nullable public CreateProtocol getProtocol() { + return protocol; + } + + public void setProtocol(@javax.annotation.Nullable CreateProtocol protocol) { + this.protocol = protocol; + } + + /** + * 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 CreateSecurityGroupRuleProtocol instance itself + */ + public CreateSecurityGroupRuleProtocol 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; + } + CreateSecurityGroupRuleProtocol createSecurityGroupRuleProtocol = + (CreateSecurityGroupRuleProtocol) o; + return Objects.equals(this.protocol, createSecurityGroupRuleProtocol.protocol) + && Objects.equals( + this.additionalProperties, + createSecurityGroupRuleProtocol.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(protocol, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateSecurityGroupRuleProtocol {\n"); + sb.append(" protocol: ").append(toIndentedString(protocol)).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("protocol")); + + // 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 + * CreateSecurityGroupRuleProtocol + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateSecurityGroupRuleProtocol.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 CreateSecurityGroupRuleProtocol is not found in the empty JSON string", + CreateSecurityGroupRuleProtocol.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `protocol` + if (jsonObj.get("protocol") != null && !jsonObj.get("protocol").isJsonNull()) { + CreateProtocol.validateJsonElement(jsonObj.get("protocol")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSecurityGroupRuleProtocol.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSecurityGroupRuleProtocol' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateSecurityGroupRuleProtocol.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSecurityGroupRuleProtocol 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 CreateSecurityGroupRuleProtocol read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateSecurityGroupRuleProtocol 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 CreateSecurityGroupRuleProtocol given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSecurityGroupRuleProtocol + * @throws IOException if the JSON string is invalid with respect to + * CreateSecurityGroupRuleProtocol + */ + public static CreateSecurityGroupRuleProtocol fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSecurityGroupRuleProtocol.class); + } + + /** + * Convert an instance of CreateSecurityGroupRuleProtocol to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateServerNetworking.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateServerNetworking.java new file mode 100644 index 00000000..3fbbf8ee --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateServerNetworking.java @@ -0,0 +1,201 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; + +/** The initial networking setup for the server creation with a network. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateServerNetworking { + public static final String SERIALIZED_NAME_NETWORK_ID = "networkId"; + + @SerializedName(SERIALIZED_NAME_NETWORK_ID) + @javax.annotation.Nullable private UUID networkId; + + public CreateServerNetworking() {} + + public CreateServerNetworking networkId(@javax.annotation.Nullable UUID networkId) { + this.networkId = networkId; + return this; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return networkId + */ + @javax.annotation.Nullable public UUID getNetworkId() { + return networkId; + } + + public void setNetworkId(@javax.annotation.Nullable UUID networkId) { + this.networkId = networkId; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateServerNetworking createServerNetworking = (CreateServerNetworking) o; + return Objects.equals(this.networkId, createServerNetworking.networkId); + } + + @Override + public int hashCode() { + return Objects.hash(networkId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateServerNetworking {\n"); + sb.append(" networkId: ").append(toIndentedString(networkId)).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("networkId")); + + // 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 CreateServerNetworking + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateServerNetworking.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 CreateServerNetworking is not found in the empty JSON string", + CreateServerNetworking.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateServerNetworking.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "The field `%s` in the JSON string is not defined in the `CreateServerNetworking` properties. JSON: %s", + entry.getKey(), + jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("networkId") != null && !jsonObj.get("networkId").isJsonNull()) + && !jsonObj.get("networkId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `networkId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("networkId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateServerNetworking.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateServerNetworking' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateServerNetworking.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateServerNetworking value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateServerNetworking read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateServerNetworking given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateServerNetworking + * @throws IOException if the JSON string is invalid with respect to CreateServerNetworking + */ + public static CreateServerNetworking fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateServerNetworking.class); + } + + /** + * Convert an instance of CreateServerNetworking to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateServerNetworkingWithNics.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateServerNetworkingWithNics.java new file mode 100644 index 00000000..2174e94a --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateServerNetworkingWithNics.java @@ -0,0 +1,219 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; + +/** The initial networking setup for the server creation with a network interface. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateServerNetworkingWithNics { + public static final String SERIALIZED_NAME_NIC_IDS = "nicIds"; + + @SerializedName(SERIALIZED_NAME_NIC_IDS) + @javax.annotation.Nullable private List nicIds = new ArrayList<>(); + + public CreateServerNetworkingWithNics() {} + + public CreateServerNetworkingWithNics nicIds(@javax.annotation.Nullable List nicIds) { + this.nicIds = nicIds; + return this; + } + + public CreateServerNetworkingWithNics addNicIdsItem(UUID nicIdsItem) { + if (this.nicIds == null) { + this.nicIds = new ArrayList<>(); + } + this.nicIds.add(nicIdsItem); + return this; + } + + /** + * A list of UUIDs. + * + * @return nicIds + */ + @javax.annotation.Nullable public List getNicIds() { + return nicIds; + } + + public void setNicIds(@javax.annotation.Nullable List nicIds) { + this.nicIds = nicIds; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateServerNetworkingWithNics createServerNetworkingWithNics = + (CreateServerNetworkingWithNics) o; + return Objects.equals(this.nicIds, createServerNetworkingWithNics.nicIds); + } + + @Override + public int hashCode() { + return Objects.hash(nicIds); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateServerNetworkingWithNics {\n"); + sb.append(" nicIds: ").append(toIndentedString(nicIds)).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("nicIds")); + + // 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 + * CreateServerNetworkingWithNics + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateServerNetworkingWithNics.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 CreateServerNetworkingWithNics is not found in the empty JSON string", + CreateServerNetworkingWithNics.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateServerNetworkingWithNics.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "The field `%s` in the JSON string is not defined in the `CreateServerNetworkingWithNics` properties. JSON: %s", + entry.getKey(), + jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("nicIds") != null + && !jsonObj.get("nicIds").isJsonNull() + && !jsonObj.get("nicIds").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `nicIds` to be an array in the JSON string but got `%s`", + jsonObj.get("nicIds").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateServerNetworkingWithNics.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateServerNetworkingWithNics' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(CreateServerNetworkingWithNics.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateServerNetworkingWithNics value) + throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateServerNetworkingWithNics read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + }.nullSafe(); + } + } + + /** + * Create an instance of CreateServerNetworkingWithNics given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateServerNetworkingWithNics + * @throws IOException if the JSON string is invalid with respect to + * CreateServerNetworkingWithNics + */ + public static CreateServerNetworkingWithNics fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateServerNetworkingWithNics.class); + } + + /** + * Convert an instance of CreateServerNetworkingWithNics to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateServerPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateServerPayload.java new file mode 100644 index 00000000..de0c6d8b --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateServerPayload.java @@ -0,0 +1,1099 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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.time.OffsetDateTime; +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; +import java.util.UUID; + +/** Object that represents the request body for a server create. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateServerPayload { + public static final String SERIALIZED_NAME_AFFINITY_GROUP = "affinityGroup"; + + @SerializedName(SERIALIZED_NAME_AFFINITY_GROUP) + @javax.annotation.Nullable private UUID affinityGroup; + + public static final String SERIALIZED_NAME_AGENT = "agent"; + + @SerializedName(SERIALIZED_NAME_AGENT) + @javax.annotation.Nullable private ServerAgent agent; + + public static final String SERIALIZED_NAME_AVAILABILITY_ZONE = "availabilityZone"; + + @SerializedName(SERIALIZED_NAME_AVAILABILITY_ZONE) + @javax.annotation.Nullable private String availabilityZone; + + public static final String SERIALIZED_NAME_BOOT_VOLUME = "bootVolume"; + + @SerializedName(SERIALIZED_NAME_BOOT_VOLUME) + @javax.annotation.Nullable private BootVolume bootVolume; + + public static final String SERIALIZED_NAME_CONFIG_DRIVE = "configDrive"; + + @SerializedName(SERIALIZED_NAME_CONFIG_DRIVE) + @javax.annotation.Nullable private Boolean configDrive = false; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_ERROR_MESSAGE = "errorMessage"; + + @SerializedName(SERIALIZED_NAME_ERROR_MESSAGE) + @javax.annotation.Nullable private String errorMessage; + + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_IMAGE_ID = "imageId"; + + @SerializedName(SERIALIZED_NAME_IMAGE_ID) + @javax.annotation.Nullable private UUID imageId; + + public static final String SERIALIZED_NAME_KEYPAIR_NAME = "keypairName"; + + @SerializedName(SERIALIZED_NAME_KEYPAIR_NAME) + @javax.annotation.Nullable private String keypairName; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_LAUNCHED_AT = "launchedAt"; + + @SerializedName(SERIALIZED_NAME_LAUNCHED_AT) + @javax.annotation.Nullable private OffsetDateTime launchedAt; + + public static final String SERIALIZED_NAME_MACHINE_TYPE = "machineType"; + + @SerializedName(SERIALIZED_NAME_MACHINE_TYPE) + @javax.annotation.Nonnull + private String machineType; + + public static final String SERIALIZED_NAME_MAINTENANCE_WINDOW = "maintenanceWindow"; + + @SerializedName(SERIALIZED_NAME_MAINTENANCE_WINDOW) + @javax.annotation.Nullable private ServerMaintenance maintenanceWindow; + + public static final String SERIALIZED_NAME_METADATA = "metadata"; + + @SerializedName(SERIALIZED_NAME_METADATA) + @javax.annotation.Nullable private Object metadata; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_NETWORKING = "networking"; + + @SerializedName(SERIALIZED_NAME_NETWORKING) + @javax.annotation.Nonnull + private CreateServerPayloadAllOfNetworking networking; + + public static final String SERIALIZED_NAME_NICS = "nics"; + + @SerializedName(SERIALIZED_NAME_NICS) + @javax.annotation.Nullable private List nics; + + public static final String SERIALIZED_NAME_POWER_STATUS = "powerStatus"; + + @SerializedName(SERIALIZED_NAME_POWER_STATUS) + @javax.annotation.Nullable private String powerStatus; + + public static final String SERIALIZED_NAME_SECURITY_GROUPS = "securityGroups"; + + @SerializedName(SERIALIZED_NAME_SECURITY_GROUPS) + @javax.annotation.Nullable private List securityGroups; + + public static final String SERIALIZED_NAME_SERVICE_ACCOUNT_MAILS = "serviceAccountMails"; + + @SerializedName(SERIALIZED_NAME_SERVICE_ACCOUNT_MAILS) + @javax.annotation.Nullable private List serviceAccountMails; + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable private String status; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable private OffsetDateTime updatedAt; + + public static final String SERIALIZED_NAME_USER_DATA = "userData"; + + @SerializedName(SERIALIZED_NAME_USER_DATA) + @javax.annotation.Nullable private byte[] userData; + + public static final String SERIALIZED_NAME_VOLUMES = "volumes"; + + @SerializedName(SERIALIZED_NAME_VOLUMES) + @javax.annotation.Nullable private List volumes; + + public CreateServerPayload() {} + + public CreateServerPayload( + OffsetDateTime createdAt, + String errorMessage, + UUID id, + OffsetDateTime launchedAt, + ServerMaintenance maintenanceWindow, + List nics, + String powerStatus, + String status, + OffsetDateTime updatedAt) { + this(); + this.createdAt = createdAt; + this.errorMessage = errorMessage; + this.id = id; + this.launchedAt = launchedAt; + this.maintenanceWindow = maintenanceWindow; + this.nics = nics; + this.powerStatus = powerStatus; + this.status = status; + this.updatedAt = updatedAt; + } + + public CreateServerPayload affinityGroup(@javax.annotation.Nullable UUID affinityGroup) { + this.affinityGroup = affinityGroup; + return this; + } + + /** + * The affinity group the server is assigned to. + * + * @return affinityGroup + */ + @javax.annotation.Nullable public UUID getAffinityGroup() { + return affinityGroup; + } + + public void setAffinityGroup(@javax.annotation.Nullable UUID affinityGroup) { + this.affinityGroup = affinityGroup; + } + + public CreateServerPayload agent(@javax.annotation.Nullable ServerAgent agent) { + this.agent = agent; + return this; + } + + /** + * Get agent + * + * @return agent + */ + @javax.annotation.Nullable public ServerAgent getAgent() { + return agent; + } + + public void setAgent(@javax.annotation.Nullable ServerAgent agent) { + this.agent = agent; + } + + public CreateServerPayload availabilityZone( + @javax.annotation.Nullable String availabilityZone) { + this.availabilityZone = availabilityZone; + return this; + } + + /** + * This is the availability zone requested during server creation. If none is provided during + * the creation request and an existing volume will be used as boot volume it will be set to the + * same availability zone as the volume. For requests with no volumes involved it will be set to + * the metro availability zone. + * + * @return availabilityZone + */ + @javax.annotation.Nullable public String getAvailabilityZone() { + return availabilityZone; + } + + public void setAvailabilityZone(@javax.annotation.Nullable String availabilityZone) { + this.availabilityZone = availabilityZone; + } + + public CreateServerPayload bootVolume(@javax.annotation.Nullable BootVolume bootVolume) { + this.bootVolume = bootVolume; + return this; + } + + /** + * Get bootVolume + * + * @return bootVolume + */ + @javax.annotation.Nullable public BootVolume getBootVolume() { + return bootVolume; + } + + public void setBootVolume(@javax.annotation.Nullable BootVolume bootVolume) { + this.bootVolume = bootVolume; + } + + public CreateServerPayload configDrive(@javax.annotation.Nullable Boolean configDrive) { + this.configDrive = configDrive; + return this; + } + + /** + * When true the server is created with a config drive. + * + * @return configDrive + */ + @javax.annotation.Nullable public Boolean getConfigDrive() { + return configDrive; + } + + public void setConfigDrive(@javax.annotation.Nullable Boolean configDrive) { + this.configDrive = configDrive; + } + + /** + * Date-time when resource was created. + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * An error message. + * + * @return errorMessage + */ + @javax.annotation.Nullable public String getErrorMessage() { + return errorMessage; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + public CreateServerPayload imageId(@javax.annotation.Nullable UUID imageId) { + this.imageId = imageId; + return this; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return imageId + */ + @javax.annotation.Nullable public UUID getImageId() { + return imageId; + } + + public void setImageId(@javax.annotation.Nullable UUID imageId) { + this.imageId = imageId; + } + + public CreateServerPayload keypairName(@javax.annotation.Nullable String keypairName) { + this.keypairName = keypairName; + return this; + } + + /** + * The SSH keypair used during the server creation. + * + * @return keypairName + */ + @javax.annotation.Nullable public String getKeypairName() { + return keypairName; + } + + public void setKeypairName(@javax.annotation.Nullable String keypairName) { + this.keypairName = keypairName; + } + + public CreateServerPayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + /** + * Date-time when resource was launched. + * + * @return launchedAt + */ + @javax.annotation.Nullable public OffsetDateTime getLaunchedAt() { + return launchedAt; + } + + public CreateServerPayload machineType(@javax.annotation.Nonnull String machineType) { + this.machineType = machineType; + return this; + } + + /** + * Name of the machine type the server shall belong to. + * + * @return machineType + */ + @javax.annotation.Nonnull + public String getMachineType() { + return machineType; + } + + public void setMachineType(@javax.annotation.Nonnull String machineType) { + this.machineType = machineType; + } + + /** + * Get maintenanceWindow + * + * @return maintenanceWindow + */ + @javax.annotation.Nullable public ServerMaintenance getMaintenanceWindow() { + return maintenanceWindow; + } + + public CreateServerPayload metadata(@javax.annotation.Nullable Object metadata) { + this.metadata = metadata; + return this; + } + + /** + * Object that represents the metadata of an object. Regex for keys: `^[a-zA-Z0-9-_:. + * ]{1,255}$`. Regex for values: `^.{0,255}$`. Providing a `null` value + * for a key will remove that key. + * + * @return metadata + */ + @javax.annotation.Nullable public Object getMetadata() { + return metadata; + } + + public void setMetadata(@javax.annotation.Nullable Object metadata) { + this.metadata = metadata; + } + + public CreateServerPayload name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * The name for a Server. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + public CreateServerPayload networking( + @javax.annotation.Nonnull CreateServerPayloadAllOfNetworking networking) { + this.networking = networking; + return this; + } + + /** + * Get networking + * + * @return networking + */ + @javax.annotation.Nonnull + public CreateServerPayloadAllOfNetworking getNetworking() { + return networking; + } + + public void setNetworking( + @javax.annotation.Nonnull CreateServerPayloadAllOfNetworking networking) { + this.networking = networking; + } + + /** + * The list of network interfaces (NICs) attached to the server. Only shown when detailed + * information is requested. + * + * @return nics + */ + @javax.annotation.Nullable public List getNics() { + return nics; + } + + /** + * The power status of a server. Possible values: `CRASHED`, `ERROR`, + * `RUNNING`, `STOPPED`. + * + * @return powerStatus + */ + @javax.annotation.Nullable public String getPowerStatus() { + return powerStatus; + } + + public CreateServerPayload securityGroups( + @javax.annotation.Nullable List securityGroups) { + this.securityGroups = securityGroups; + return this; + } + + public CreateServerPayload addSecurityGroupsItem(String securityGroupsItem) { + if (this.securityGroups == null) { + this.securityGroups = new ArrayList<>(); + } + this.securityGroups.add(securityGroupsItem); + return this; + } + + /** + * The initial security groups for the server creation. + * + * @return securityGroups + */ + @javax.annotation.Nullable public List getSecurityGroups() { + return securityGroups; + } + + public void setSecurityGroups(@javax.annotation.Nullable List securityGroups) { + this.securityGroups = securityGroups; + } + + public CreateServerPayload serviceAccountMails( + @javax.annotation.Nullable List serviceAccountMails) { + this.serviceAccountMails = serviceAccountMails; + return this; + } + + public CreateServerPayload addServiceAccountMailsItem(String serviceAccountMailsItem) { + if (this.serviceAccountMails == null) { + this.serviceAccountMails = new ArrayList<>(); + } + this.serviceAccountMails.add(serviceAccountMailsItem); + return this; + } + + /** + * A list of service account mails. Only shown when detailed information is requested. + * + * @return serviceAccountMails + */ + @javax.annotation.Nullable public List getServiceAccountMails() { + return serviceAccountMails; + } + + public void setServiceAccountMails( + @javax.annotation.Nullable List serviceAccountMails) { + this.serviceAccountMails = serviceAccountMails; + } + + /** + * The status of a server object. Possible values: `ACTIVE`, `BACKING-UP`, + * `CREATING`, `DEALLOCATED`, `DEALLOCATING`, `DELETED`, + * `DELETING`, `ERROR`, `INACTIVE`, `MIGRATING`, + * `PAUSED`, `REBOOT`, `REBOOTING`, `REBUILD`, + * `REBUILDING`, `RESCUE`, `RESCUING`, `RESIZING`, + * `RESTORING`, `SNAPSHOTTING`, `STARTING`, `STOPPING`, + * `UNRESCUING`, `UPDATING`. + * + * @return status + */ + @javax.annotation.Nullable public String getStatus() { + return status; + } + + /** + * Date-time when resource was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nullable public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public CreateServerPayload userData(@javax.annotation.Nullable byte[] userData) { + this.userData = userData; + return this; + } + + /** + * User Data that is provided to the server. Must be base64 encoded and is passed via cloud-init + * to the server. Only shown when detailed information is requested. + * + * @return userData + */ + @javax.annotation.Nullable public byte[] getUserData() { + return userData; + } + + public void setUserData(@javax.annotation.Nullable byte[] userData) { + this.userData = userData; + } + + public CreateServerPayload volumes(@javax.annotation.Nullable List volumes) { + this.volumes = volumes; + return this; + } + + public CreateServerPayload addVolumesItem(UUID volumesItem) { + if (this.volumes == null) { + this.volumes = new ArrayList<>(); + } + this.volumes.add(volumesItem); + return this; + } + + /** + * The list of volumes attached to the server. + * + * @return volumes + */ + @javax.annotation.Nullable public List getVolumes() { + return volumes; + } + + public void setVolumes(@javax.annotation.Nullable List volumes) { + this.volumes = volumes; + } + + /** + * 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 CreateServerPayload instance itself + */ + public CreateServerPayload 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; + } + CreateServerPayload createServerPayload = (CreateServerPayload) o; + return Objects.equals(this.affinityGroup, createServerPayload.affinityGroup) + && Objects.equals(this.agent, createServerPayload.agent) + && Objects.equals(this.availabilityZone, createServerPayload.availabilityZone) + && Objects.equals(this.bootVolume, createServerPayload.bootVolume) + && Objects.equals(this.configDrive, createServerPayload.configDrive) + && Objects.equals(this.createdAt, createServerPayload.createdAt) + && Objects.equals(this.errorMessage, createServerPayload.errorMessage) + && Objects.equals(this.id, createServerPayload.id) + && Objects.equals(this.imageId, createServerPayload.imageId) + && Objects.equals(this.keypairName, createServerPayload.keypairName) + && Objects.equals(this.labels, createServerPayload.labels) + && Objects.equals(this.launchedAt, createServerPayload.launchedAt) + && Objects.equals(this.machineType, createServerPayload.machineType) + && Objects.equals(this.maintenanceWindow, createServerPayload.maintenanceWindow) + && Objects.equals(this.metadata, createServerPayload.metadata) + && Objects.equals(this.name, createServerPayload.name) + && Objects.equals(this.networking, createServerPayload.networking) + && Objects.equals(this.nics, createServerPayload.nics) + && Objects.equals(this.powerStatus, createServerPayload.powerStatus) + && Objects.equals(this.securityGroups, createServerPayload.securityGroups) + && Objects.equals(this.serviceAccountMails, createServerPayload.serviceAccountMails) + && Objects.equals(this.status, createServerPayload.status) + && Objects.equals(this.updatedAt, createServerPayload.updatedAt) + && Arrays.equals(this.userData, createServerPayload.userData) + && Objects.equals(this.volumes, createServerPayload.volumes) + && Objects.equals( + this.additionalProperties, createServerPayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + affinityGroup, + agent, + availabilityZone, + bootVolume, + configDrive, + createdAt, + errorMessage, + id, + imageId, + keypairName, + labels, + launchedAt, + machineType, + maintenanceWindow, + metadata, + name, + networking, + nics, + powerStatus, + securityGroups, + serviceAccountMails, + status, + updatedAt, + Arrays.hashCode(userData), + volumes, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateServerPayload {\n"); + sb.append(" affinityGroup: ").append(toIndentedString(affinityGroup)).append("\n"); + sb.append(" agent: ").append(toIndentedString(agent)).append("\n"); + sb.append(" availabilityZone: ").append(toIndentedString(availabilityZone)).append("\n"); + sb.append(" bootVolume: ").append(toIndentedString(bootVolume)).append("\n"); + sb.append(" configDrive: ").append(toIndentedString(configDrive)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" errorMessage: ").append(toIndentedString(errorMessage)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" imageId: ").append(toIndentedString(imageId)).append("\n"); + sb.append(" keypairName: ").append(toIndentedString(keypairName)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" launchedAt: ").append(toIndentedString(launchedAt)).append("\n"); + sb.append(" machineType: ").append(toIndentedString(machineType)).append("\n"); + sb.append(" maintenanceWindow: ") + .append(toIndentedString(maintenanceWindow)) + .append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" networking: ").append(toIndentedString(networking)).append("\n"); + sb.append(" nics: ").append(toIndentedString(nics)).append("\n"); + sb.append(" powerStatus: ").append(toIndentedString(powerStatus)).append("\n"); + sb.append(" securityGroups: ").append(toIndentedString(securityGroups)).append("\n"); + sb.append(" serviceAccountMails: ") + .append(toIndentedString(serviceAccountMails)) + .append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" userData: ").append(toIndentedString(userData)).append("\n"); + sb.append(" volumes: ").append(toIndentedString(volumes)).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( + "affinityGroup", + "agent", + "availabilityZone", + "bootVolume", + "configDrive", + "createdAt", + "errorMessage", + "id", + "imageId", + "keypairName", + "labels", + "launchedAt", + "machineType", + "maintenanceWindow", + "metadata", + "name", + "networking", + "nics", + "powerStatus", + "securityGroups", + "serviceAccountMails", + "status", + "updatedAt", + "userData", + "volumes")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = + new HashSet(Arrays.asList("machineType", "name", "networking")); + } + + /** + * 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 CreateServerPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateServerPayload.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 CreateServerPayload is not found in the empty JSON string", + CreateServerPayload.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateServerPayload.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("affinityGroup") != null && !jsonObj.get("affinityGroup").isJsonNull()) + && !jsonObj.get("affinityGroup").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `affinityGroup` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("affinityGroup").toString())); + } + // validate the optional field `agent` + if (jsonObj.get("agent") != null && !jsonObj.get("agent").isJsonNull()) { + ServerAgent.validateJsonElement(jsonObj.get("agent")); + } + if ((jsonObj.get("availabilityZone") != null + && !jsonObj.get("availabilityZone").isJsonNull()) + && !jsonObj.get("availabilityZone").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `availabilityZone` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("availabilityZone").toString())); + } + // validate the optional field `bootVolume` + if (jsonObj.get("bootVolume") != null && !jsonObj.get("bootVolume").isJsonNull()) { + BootVolume.validateJsonElement(jsonObj.get("bootVolume")); + } + if ((jsonObj.get("errorMessage") != null && !jsonObj.get("errorMessage").isJsonNull()) + && !jsonObj.get("errorMessage").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `errorMessage` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("errorMessage").toString())); + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if ((jsonObj.get("imageId") != null && !jsonObj.get("imageId").isJsonNull()) + && !jsonObj.get("imageId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `imageId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("imageId").toString())); + } + if ((jsonObj.get("keypairName") != null && !jsonObj.get("keypairName").isJsonNull()) + && !jsonObj.get("keypairName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `keypairName` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("keypairName").toString())); + } + if (!jsonObj.get("machineType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `machineType` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("machineType").toString())); + } + // validate the optional field `maintenanceWindow` + if (jsonObj.get("maintenanceWindow") != null + && !jsonObj.get("maintenanceWindow").isJsonNull()) { + ServerMaintenance.validateJsonElement(jsonObj.get("maintenanceWindow")); + } + 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())); + } + // validate the required field `networking` + CreateServerPayloadAllOfNetworking.validateJsonElement(jsonObj.get("networking")); + if (jsonObj.get("nics") != null && !jsonObj.get("nics").isJsonNull()) { + JsonArray jsonArraynics = jsonObj.getAsJsonArray("nics"); + if (jsonArraynics != null) { + // ensure the json data is an array + if (!jsonObj.get("nics").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `nics` to be an array in the JSON string but got `%s`", + jsonObj.get("nics").toString())); + } + + // validate the optional field `nics` (array) + for (int i = 0; i < jsonArraynics.size(); i++) { + ServerNetwork.validateJsonElement(jsonArraynics.get(i)); + } + ; + } + } + if ((jsonObj.get("powerStatus") != null && !jsonObj.get("powerStatus").isJsonNull()) + && !jsonObj.get("powerStatus").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `powerStatus` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("powerStatus").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("securityGroups") != null + && !jsonObj.get("securityGroups").isJsonNull() + && !jsonObj.get("securityGroups").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `securityGroups` to be an array in the JSON string but got `%s`", + jsonObj.get("securityGroups").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("serviceAccountMails") != null + && !jsonObj.get("serviceAccountMails").isJsonNull() + && !jsonObj.get("serviceAccountMails").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `serviceAccountMails` to be an array in the JSON string but got `%s`", + jsonObj.get("serviceAccountMails").toString())); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) + && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `status` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("status").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("volumes") != null + && !jsonObj.get("volumes").isJsonNull() + && !jsonObj.get("volumes").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `volumes` to be an array in the JSON string but got `%s`", + jsonObj.get("volumes").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateServerPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateServerPayload' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateServerPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateServerPayload 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 CreateServerPayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateServerPayload 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 CreateServerPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateServerPayload + * @throws IOException if the JSON string is invalid with respect to CreateServerPayload + */ + public static CreateServerPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateServerPayload.class); + } + + /** + * Convert an instance of CreateServerPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateServerPayloadAllOfNetworking.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateServerPayloadAllOfNetworking.java new file mode 100644 index 00000000..85fc31f3 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateServerPayloadAllOfNetworking.java @@ -0,0 +1,304 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +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 CreateServerPayloadAllOfNetworking extends AbstractOpenApiSchema { + private static final Logger log = + Logger.getLogger(CreateServerPayloadAllOfNetworking.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateServerPayloadAllOfNetworking.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateServerPayloadAllOfNetworking' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterCreateServerNetworking = + gson.getDelegateAdapter(this, TypeToken.get(CreateServerNetworking.class)); + final TypeAdapter + adapterCreateServerNetworkingWithNics = + gson.getDelegateAdapter( + this, TypeToken.get(CreateServerNetworkingWithNics.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateServerPayloadAllOfNetworking value) + throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `CreateServerNetworking` + if (value.getActualInstance() instanceof CreateServerNetworking) { + JsonElement element = + adapterCreateServerNetworking.toJsonTree( + (CreateServerNetworking) value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type + // `CreateServerNetworkingWithNics` + if (value.getActualInstance() + instanceof CreateServerNetworkingWithNics) { + JsonElement element = + adapterCreateServerNetworkingWithNics.toJsonTree( + (CreateServerNetworkingWithNics) + value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException( + "Failed to serialize as the type doesn't match oneOf schemas: CreateServerNetworking, CreateServerNetworkingWithNics"); + } + + @Override + public CreateServerPayloadAllOfNetworking read(JsonReader in) + throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize CreateServerNetworking + try { + // validate the JSON object to see if any exception is thrown + CreateServerNetworking.validateJsonElement(jsonElement); + actualAdapter = adapterCreateServerNetworking; + match++; + log.log( + Level.FINER, + "Input data matches schema 'CreateServerNetworking'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for CreateServerNetworking failed with `%s`.", + e.getMessage())); + log.log( + Level.FINER, + "Input data does not match schema 'CreateServerNetworking'", + e); + } + // deserialize CreateServerNetworkingWithNics + try { + // validate the JSON object to see if any exception is thrown + CreateServerNetworkingWithNics.validateJsonElement(jsonElement); + actualAdapter = adapterCreateServerNetworkingWithNics; + match++; + log.log( + Level.FINER, + "Input data matches schema 'CreateServerNetworkingWithNics'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for CreateServerNetworkingWithNics failed with `%s`.", + e.getMessage())); + log.log( + Level.FINER, + "Input data does not match schema 'CreateServerNetworkingWithNics'", + e); + } + + if (match == 1) { + CreateServerPayloadAllOfNetworking ret = + new CreateServerPayloadAllOfNetworking(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException( + String.format( + java.util.Locale.ROOT, + "Failed deserialization for CreateServerPayloadAllOfNetworking: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", + match, + errorMessages, + jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public CreateServerPayloadAllOfNetworking() { + super("oneOf", Boolean.FALSE); + } + + public CreateServerPayloadAllOfNetworking(Object o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("CreateServerNetworking", CreateServerNetworking.class); + schemas.put("CreateServerNetworkingWithNics", CreateServerNetworkingWithNics.class); + } + + @Override + public Map> getSchemas() { + return CreateServerPayloadAllOfNetworking.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: CreateServerNetworking, CreateServerNetworkingWithNics + * + *

It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof CreateServerNetworking) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof CreateServerNetworkingWithNics) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException( + "Invalid instance type. Must be CreateServerNetworking, CreateServerNetworkingWithNics"); + } + + /** + * Get the actual instance, which can be the following: CreateServerNetworking, + * CreateServerNetworkingWithNics + * + * @return The actual instance (CreateServerNetworking, CreateServerNetworkingWithNics) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `CreateServerNetworking`. If the actual instance is not + * `CreateServerNetworking`, the ClassCastException will be thrown. + * + * @return The actual instance of `CreateServerNetworking` + * @throws ClassCastException if the instance is not `CreateServerNetworking` + */ + public CreateServerNetworking getCreateServerNetworking() throws ClassCastException { + return (CreateServerNetworking) super.getActualInstance(); + } + + /** + * Get the actual instance of `CreateServerNetworkingWithNics`. If the actual instance is not + * `CreateServerNetworkingWithNics`, the ClassCastException will be thrown. + * + * @return The actual instance of `CreateServerNetworkingWithNics` + * @throws ClassCastException if the instance is not `CreateServerNetworkingWithNics` + */ + public CreateServerNetworkingWithNics getCreateServerNetworkingWithNics() + throws ClassCastException { + return (CreateServerNetworkingWithNics) 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 + * CreateServerPayloadAllOfNetworking + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with CreateServerNetworking + try { + CreateServerNetworking.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for CreateServerNetworking failed with `%s`.", + e.getMessage())); + // continue to the next one + } + // validate the json string with CreateServerNetworkingWithNics + try { + CreateServerNetworkingWithNics.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for CreateServerNetworkingWithNics failed with `%s`.", + e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException( + String.format( + java.util.Locale.ROOT, + "The JSON string is invalid for CreateServerPayloadAllOfNetworking with oneOf schemas: CreateServerNetworking, CreateServerNetworkingWithNics. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", + validCount, + errorMessages, + jsonElement.toString())); + } + } + + /** + * Create an instance of CreateServerPayloadAllOfNetworking given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateServerPayloadAllOfNetworking + * @throws IOException if the JSON string is invalid with respect to + * CreateServerPayloadAllOfNetworking + */ + public static CreateServerPayloadAllOfNetworking fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, CreateServerPayloadAllOfNetworking.class); + } + + /** + * Convert an instance of CreateServerPayloadAllOfNetworking to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateVolumePayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateVolumePayload.java new file mode 100644 index 00000000..9f8b4c4c --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/CreateVolumePayload.java @@ -0,0 +1,755 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; +import java.util.UUID; + +/** + * Object that represents a volume and its parameters. Volumes sized up to 16000GB are supported. + */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class CreateVolumePayload { + public static final String SERIALIZED_NAME_AVAILABILITY_ZONE = "availabilityZone"; + + @SerializedName(SERIALIZED_NAME_AVAILABILITY_ZONE) + @javax.annotation.Nonnull + private String availabilityZone; + + public static final String SERIALIZED_NAME_BOOTABLE = "bootable"; + + @SerializedName(SERIALIZED_NAME_BOOTABLE) + @javax.annotation.Nullable private Boolean bootable; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable private String description; + + public static final String SERIALIZED_NAME_ENCRYPTED = "encrypted"; + + @SerializedName(SERIALIZED_NAME_ENCRYPTED) + @javax.annotation.Nullable private Boolean encrypted; + + public static final String SERIALIZED_NAME_ENCRYPTION_PARAMETERS = "encryptionParameters"; + + @SerializedName(SERIALIZED_NAME_ENCRYPTION_PARAMETERS) + @javax.annotation.Nullable private VolumeEncryptionParameter encryptionParameters; + + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_IMAGE_CONFIG = "imageConfig"; + + @SerializedName(SERIALIZED_NAME_IMAGE_CONFIG) + @javax.annotation.Nullable private ImageConfig imageConfig; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; + + public static final String SERIALIZED_NAME_PERFORMANCE_CLASS = "performanceClass"; + + @SerializedName(SERIALIZED_NAME_PERFORMANCE_CLASS) + @javax.annotation.Nullable private String performanceClass; + + public static final String SERIALIZED_NAME_SERVER_ID = "serverId"; + + @SerializedName(SERIALIZED_NAME_SERVER_ID) + @javax.annotation.Nullable private UUID serverId; + + public static final String SERIALIZED_NAME_SIZE = "size"; + + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nullable private Long size; + + public static final String SERIALIZED_NAME_SOURCE = "source"; + + @SerializedName(SERIALIZED_NAME_SOURCE) + @javax.annotation.Nullable private VolumeSource source; + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable private String status; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable private OffsetDateTime updatedAt; + + public CreateVolumePayload() {} + + public CreateVolumePayload( + OffsetDateTime createdAt, + Boolean encrypted, + UUID id, + ImageConfig imageConfig, + UUID serverId, + String status, + OffsetDateTime updatedAt) { + this(); + this.createdAt = createdAt; + this.encrypted = encrypted; + this.id = id; + this.imageConfig = imageConfig; + this.serverId = serverId; + this.status = status; + this.updatedAt = updatedAt; + } + + public CreateVolumePayload availabilityZone(@javax.annotation.Nonnull String availabilityZone) { + this.availabilityZone = availabilityZone; + return this; + } + + /** + * Object that represents an availability zone. + * + * @return availabilityZone + */ + @javax.annotation.Nonnull + public String getAvailabilityZone() { + return availabilityZone; + } + + public void setAvailabilityZone(@javax.annotation.Nonnull String availabilityZone) { + this.availabilityZone = availabilityZone; + } + + public CreateVolumePayload bootable(@javax.annotation.Nullable Boolean bootable) { + this.bootable = bootable; + return this; + } + + /** + * Indicates if a volume is bootable. + * + * @return bootable + */ + @javax.annotation.Nullable public Boolean getBootable() { + return bootable; + } + + public void setBootable(@javax.annotation.Nullable Boolean bootable) { + this.bootable = bootable; + } + + /** + * Date-time when resource was created. + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public CreateVolumePayload description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Description Object. Allows string up to 255 Characters. + * + * @return description + */ + @javax.annotation.Nullable public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + /** + * Indicates if a volume is encrypted. + * + * @return encrypted + */ + @javax.annotation.Nullable public Boolean getEncrypted() { + return encrypted; + } + + public CreateVolumePayload encryptionParameters( + @javax.annotation.Nullable VolumeEncryptionParameter encryptionParameters) { + this.encryptionParameters = encryptionParameters; + return this; + } + + /** + * Get encryptionParameters + * + * @return encryptionParameters + */ + @javax.annotation.Nullable public VolumeEncryptionParameter getEncryptionParameters() { + return encryptionParameters; + } + + public void setEncryptionParameters( + @javax.annotation.Nullable VolumeEncryptionParameter encryptionParameters) { + this.encryptionParameters = encryptionParameters; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + /** + * Get imageConfig + * + * @return imageConfig + */ + @javax.annotation.Nullable public ImageConfig getImageConfig() { + return imageConfig; + } + + public CreateVolumePayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public CreateVolumePayload name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nullable public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + public CreateVolumePayload performanceClass( + @javax.annotation.Nullable String performanceClass) { + this.performanceClass = performanceClass; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return performanceClass + */ + @javax.annotation.Nullable public String getPerformanceClass() { + return performanceClass; + } + + public void setPerformanceClass(@javax.annotation.Nullable String performanceClass) { + this.performanceClass = performanceClass; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return serverId + */ + @javax.annotation.Nullable public UUID getServerId() { + return serverId; + } + + public CreateVolumePayload size(@javax.annotation.Nullable Long size) { + this.size = size; + return this; + } + + /** + * Size in Gigabyte. + * + * @return size + */ + @javax.annotation.Nullable public Long getSize() { + return size; + } + + public void setSize(@javax.annotation.Nullable Long size) { + this.size = size; + } + + public CreateVolumePayload source(@javax.annotation.Nullable VolumeSource source) { + this.source = source; + return this; + } + + /** + * Get source + * + * @return source + */ + @javax.annotation.Nullable public VolumeSource getSource() { + return source; + } + + public void setSource(@javax.annotation.Nullable VolumeSource source) { + this.source = source; + } + + /** + * The status of a volume object. Possible values: `ATTACHED`, `ATTACHING`, + * `AVAILABLE`, `AWAITING-TRANSFER`, `BACKING-UP`, + * `CREATING`, `DELETED`, `DELETING`, `DETACHING`, + * `DOWNLOADING`, `ERROR`, `ERROR_BACKING-UP`, + * `ERROR_DELETING`, `ERROR_RESIZING`, `ERROR_RESTORING-BACKUP`, + * `MAINTENANCE`, `RESERVED`, `RESIZING`, + * `RESTORING-BACKUP`, `RETYPING`, `UPLOADING`. + * + * @return status + */ + @javax.annotation.Nullable public String getStatus() { + return status; + } + + /** + * Date-time when resource was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nullable public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * 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 CreateVolumePayload instance itself + */ + public CreateVolumePayload 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; + } + CreateVolumePayload createVolumePayload = (CreateVolumePayload) o; + return Objects.equals(this.availabilityZone, createVolumePayload.availabilityZone) + && Objects.equals(this.bootable, createVolumePayload.bootable) + && Objects.equals(this.createdAt, createVolumePayload.createdAt) + && Objects.equals(this.description, createVolumePayload.description) + && Objects.equals(this.encrypted, createVolumePayload.encrypted) + && Objects.equals( + this.encryptionParameters, createVolumePayload.encryptionParameters) + && Objects.equals(this.id, createVolumePayload.id) + && Objects.equals(this.imageConfig, createVolumePayload.imageConfig) + && Objects.equals(this.labels, createVolumePayload.labels) + && Objects.equals(this.name, createVolumePayload.name) + && Objects.equals(this.performanceClass, createVolumePayload.performanceClass) + && Objects.equals(this.serverId, createVolumePayload.serverId) + && Objects.equals(this.size, createVolumePayload.size) + && Objects.equals(this.source, createVolumePayload.source) + && Objects.equals(this.status, createVolumePayload.status) + && Objects.equals(this.updatedAt, createVolumePayload.updatedAt) + && Objects.equals( + this.additionalProperties, createVolumePayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + availabilityZone, + bootable, + createdAt, + description, + encrypted, + encryptionParameters, + id, + imageConfig, + labels, + name, + performanceClass, + serverId, + size, + source, + status, + updatedAt, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateVolumePayload {\n"); + sb.append(" availabilityZone: ").append(toIndentedString(availabilityZone)).append("\n"); + sb.append(" bootable: ").append(toIndentedString(bootable)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" encrypted: ").append(toIndentedString(encrypted)).append("\n"); + sb.append(" encryptionParameters: ") + .append(toIndentedString(encryptionParameters)) + .append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" imageConfig: ").append(toIndentedString(imageConfig)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" performanceClass: ").append(toIndentedString(performanceClass)).append("\n"); + sb.append(" serverId: ").append(toIndentedString(serverId)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" source: ").append(toIndentedString(source)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).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( + "availabilityZone", + "bootable", + "createdAt", + "description", + "encrypted", + "encryptionParameters", + "id", + "imageConfig", + "labels", + "name", + "performanceClass", + "serverId", + "size", + "source", + "status", + "updatedAt")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("availabilityZone")); + } + + /** + * 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 CreateVolumePayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateVolumePayload.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 CreateVolumePayload is not found in the empty JSON string", + CreateVolumePayload.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateVolumePayload.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("availabilityZone").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `availabilityZone` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("availabilityZone").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `description` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("description").toString())); + } + // validate the optional field `encryptionParameters` + if (jsonObj.get("encryptionParameters") != null + && !jsonObj.get("encryptionParameters").isJsonNull()) { + VolumeEncryptionParameter.validateJsonElement(jsonObj.get("encryptionParameters")); + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + // validate the optional field `imageConfig` + if (jsonObj.get("imageConfig") != null && !jsonObj.get("imageConfig").isJsonNull()) { + ImageConfig.validateJsonElement(jsonObj.get("imageConfig")); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `name` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("name").toString())); + } + if ((jsonObj.get("performanceClass") != null + && !jsonObj.get("performanceClass").isJsonNull()) + && !jsonObj.get("performanceClass").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `performanceClass` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("performanceClass").toString())); + } + if ((jsonObj.get("serverId") != null && !jsonObj.get("serverId").isJsonNull()) + && !jsonObj.get("serverId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `serverId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("serverId").toString())); + } + // validate the optional field `source` + if (jsonObj.get("source") != null && !jsonObj.get("source").isJsonNull()) { + VolumeSource.validateJsonElement(jsonObj.get("source")); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) + && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `status` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("status").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateVolumePayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateVolumePayload' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(CreateVolumePayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateVolumePayload 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 CreateVolumePayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateVolumePayload 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 CreateVolumePayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateVolumePayload + * @throws IOException if the JSON string is invalid with respect to CreateVolumePayload + */ + public static CreateVolumePayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateVolumePayload.class); + } + + /** + * Convert an instance of CreateVolumePayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/DestinationCIDRv4.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/DestinationCIDRv4.java new file mode 100644 index 00000000..7abf295d --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/DestinationCIDRv4.java @@ -0,0 +1,342 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** IPv4 Classless Inter-Domain Routing (CIDR) Object. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class DestinationCIDRv4 { + public static final String SERIALIZED_NAME_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private String type; + + public static final String SERIALIZED_NAME_VALUE = "value"; + + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nonnull + private String value; + + public DestinationCIDRv4() {} + + public DestinationCIDRv4 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; + } + + public DestinationCIDRv4 value(@javax.annotation.Nonnull String value) { + this.value = value; + return this; + } + + /** + * An CIDRv4 string. + * + * @return value + */ + @javax.annotation.Nonnull + public String getValue() { + return value; + } + + public void setValue(@javax.annotation.Nonnull String value) { + this.value = value; + } + + /** + * 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 DestinationCIDRv4 instance itself + */ + public DestinationCIDRv4 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; + } + DestinationCIDRv4 destinationCIDRv4 = (DestinationCIDRv4) o; + return Objects.equals(this.type, destinationCIDRv4.type) + && Objects.equals(this.value, destinationCIDRv4.value) + && Objects.equals( + this.additionalProperties, destinationCIDRv4.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(type, value, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DestinationCIDRv4 {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).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("type", "value")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("type", "value")); + } + + /** + * 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 DestinationCIDRv4 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DestinationCIDRv4.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 DestinationCIDRv4 is not found in the empty JSON string", + DestinationCIDRv4.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DestinationCIDRv4.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("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())); + } + if (!jsonObj.get("value").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `value` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("value").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DestinationCIDRv4.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DestinationCIDRv4' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DestinationCIDRv4.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DestinationCIDRv4 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 DestinationCIDRv4 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + DestinationCIDRv4 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 DestinationCIDRv4 given an JSON string + * + * @param jsonString JSON string + * @return An instance of DestinationCIDRv4 + * @throws IOException if the JSON string is invalid with respect to DestinationCIDRv4 + */ + public static DestinationCIDRv4 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DestinationCIDRv4.class); + } + + /** + * Convert an instance of DestinationCIDRv4 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/DestinationCIDRv6.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/DestinationCIDRv6.java new file mode 100644 index 00000000..c2019358 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/DestinationCIDRv6.java @@ -0,0 +1,342 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** IPv6 Classless Inter-Domain Routing (CIDR) Object. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class DestinationCIDRv6 { + public static final String SERIALIZED_NAME_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private String type; + + public static final String SERIALIZED_NAME_VALUE = "value"; + + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nonnull + private String value; + + public DestinationCIDRv6() {} + + public DestinationCIDRv6 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; + } + + public DestinationCIDRv6 value(@javax.annotation.Nonnull String value) { + this.value = value; + return this; + } + + /** + * An CIDRv6 string. + * + * @return value + */ + @javax.annotation.Nonnull + public String getValue() { + return value; + } + + public void setValue(@javax.annotation.Nonnull String value) { + this.value = value; + } + + /** + * 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 DestinationCIDRv6 instance itself + */ + public DestinationCIDRv6 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; + } + DestinationCIDRv6 destinationCIDRv6 = (DestinationCIDRv6) o; + return Objects.equals(this.type, destinationCIDRv6.type) + && Objects.equals(this.value, destinationCIDRv6.value) + && Objects.equals( + this.additionalProperties, destinationCIDRv6.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(type, value, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DestinationCIDRv6 {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).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("type", "value")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("type", "value")); + } + + /** + * 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 DestinationCIDRv6 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DestinationCIDRv6.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 DestinationCIDRv6 is not found in the empty JSON string", + DestinationCIDRv6.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DestinationCIDRv6.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("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())); + } + if (!jsonObj.get("value").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `value` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("value").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DestinationCIDRv6.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DestinationCIDRv6' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(DestinationCIDRv6.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, DestinationCIDRv6 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 DestinationCIDRv6 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + DestinationCIDRv6 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 DestinationCIDRv6 given an JSON string + * + * @param jsonString JSON string + * @return An instance of DestinationCIDRv6 + * @throws IOException if the JSON string is invalid with respect to DestinationCIDRv6 + */ + public static DestinationCIDRv6 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DestinationCIDRv6.class); + } + + /** + * Convert an instance of DestinationCIDRv6 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/Error.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/Error.java new file mode 100644 index 00000000..34594224 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/Error.java @@ -0,0 +1,333 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** Error with HTTP error code and an error message. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class Error { + public static final String SERIALIZED_NAME_CODE = "code"; + + @SerializedName(SERIALIZED_NAME_CODE) + @javax.annotation.Nonnull + private Long code; + + public static final String SERIALIZED_NAME_MSG = "msg"; + + @SerializedName(SERIALIZED_NAME_MSG) + @javax.annotation.Nonnull + private String msg; + + public Error() {} + + public Error code(@javax.annotation.Nonnull Long code) { + this.code = code; + return this; + } + + /** + * Get code + * + * @return code + */ + @javax.annotation.Nonnull + public Long getCode() { + return code; + } + + public void setCode(@javax.annotation.Nonnull Long code) { + this.code = code; + } + + public Error msg(@javax.annotation.Nonnull String msg) { + this.msg = msg; + return this; + } + + /** + * An error message. + * + * @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 Error instance itself + */ + public Error 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; + } + Error error = (Error) o; + return Objects.equals(this.code, error.code) + && Objects.equals(this.msg, error.msg) + && Objects.equals(this.additionalProperties, error.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(code, msg, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Error {\n"); + sb.append(" code: ").append(toIndentedString(code)).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("code", "msg")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("code", "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 Error + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Error.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 Error is not found in the empty JSON string", + Error.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Error.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("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 (!Error.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Error' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(Error.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, Error 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 Error read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Error 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 Error given an JSON string + * + * @param jsonString JSON string + * @return An instance of Error + * @throws IOException if the JSON string is invalid with respect to Error + */ + public static Error fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Error.class); + } + + /** + * Convert an instance of Error to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/GetServerLog200Response.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/GetServerLog200Response.java new file mode 100644 index 00000000..ff66dc17 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/GetServerLog200Response.java @@ -0,0 +1,296 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** GetServerLog200Response */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class GetServerLog200Response { + public static final String SERIALIZED_NAME_OUTPUT = "output"; + + @SerializedName(SERIALIZED_NAME_OUTPUT) + @javax.annotation.Nullable private String output; + + public GetServerLog200Response() {} + + public GetServerLog200Response output(@javax.annotation.Nullable String output) { + this.output = output; + return this; + } + + /** + * Get output + * + * @return output + */ + @javax.annotation.Nullable public String getOutput() { + return output; + } + + public void setOutput(@javax.annotation.Nullable String output) { + this.output = output; + } + + /** + * 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 GetServerLog200Response instance itself + */ + public GetServerLog200Response 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; + } + GetServerLog200Response getServerLog200Response = (GetServerLog200Response) o; + return Objects.equals(this.output, getServerLog200Response.output) + && Objects.equals( + this.additionalProperties, getServerLog200Response.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(output, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetServerLog200Response {\n"); + sb.append(" output: ").append(toIndentedString(output)).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("output")); + + // 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 GetServerLog200Response + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetServerLog200Response.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 GetServerLog200Response is not found in the empty JSON string", + GetServerLog200Response.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("output") != null && !jsonObj.get("output").isJsonNull()) + && !jsonObj.get("output").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `output` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("output").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetServerLog200Response.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetServerLog200Response' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(GetServerLog200Response.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, GetServerLog200Response 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 GetServerLog200Response read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + GetServerLog200Response 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 GetServerLog200Response given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetServerLog200Response + * @throws IOException if the JSON string is invalid with respect to GetServerLog200Response + */ + public static GetServerLog200Response fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetServerLog200Response.class); + } + + /** + * Convert an instance of GetServerLog200Response to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ICMPParameters.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ICMPParameters.java new file mode 100644 index 00000000..43f30be4 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ICMPParameters.java @@ -0,0 +1,326 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** Object that represents ICMP parameters. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class ICMPParameters { + public static final String SERIALIZED_NAME_CODE = "code"; + + @SerializedName(SERIALIZED_NAME_CODE) + @javax.annotation.Nonnull + private Long code; + + public static final String SERIALIZED_NAME_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private Long type; + + public ICMPParameters() {} + + public ICMPParameters code(@javax.annotation.Nonnull Long code) { + this.code = code; + return this; + } + + /** + * ICMP code. Can be set if the protocol is ICMP. minimum: 0 maximum: 255 + * + * @return code + */ + @javax.annotation.Nonnull + public Long getCode() { + return code; + } + + public void setCode(@javax.annotation.Nonnull Long code) { + this.code = code; + } + + public ICMPParameters type(@javax.annotation.Nonnull Long type) { + this.type = type; + return this; + } + + /** + * ICMP type. Can be set if the protocol is ICMP. minimum: 0 maximum: 255 + * + * @return type + */ + @javax.annotation.Nonnull + public Long getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull Long 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 ICMPParameters instance itself + */ + public ICMPParameters 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; + } + ICMPParameters icMPParameters = (ICMPParameters) o; + return Objects.equals(this.code, icMPParameters.code) + && Objects.equals(this.type, icMPParameters.type) + && Objects.equals(this.additionalProperties, icMPParameters.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(code, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ICMPParameters {\n"); + sb.append(" code: ").append(toIndentedString(code)).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("code", "type")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("code", "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 ICMPParameters + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ICMPParameters.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 ICMPParameters is not found in the empty JSON string", + ICMPParameters.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ICMPParameters.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "The required field `%s` is not found in the JSON string: %s", + requiredField, + jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ICMPParameters.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ICMPParameters' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ICMPParameters.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ICMPParameters 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 ICMPParameters read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ICMPParameters 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 ICMPParameters given an JSON string + * + * @param jsonString JSON string + * @return An instance of ICMPParameters + * @throws IOException if the JSON string is invalid with respect to ICMPParameters + */ + public static ICMPParameters fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ICMPParameters.class); + } + + /** + * Convert an instance of ICMPParameters to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/Image.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/Image.java new file mode 100644 index 00000000..380de7fb --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/Image.java @@ -0,0 +1,748 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; +import java.util.UUID; + +/** + * Object that represents an Image and its parameters. Used for Creating and returning (get/list). + */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class Image { + public static final String SERIALIZED_NAME_AGENT = "agent"; + + @SerializedName(SERIALIZED_NAME_AGENT) + @javax.annotation.Nullable private ImageAgent agent; + + public static final String SERIALIZED_NAME_CHECKSUM = "checksum"; + + @SerializedName(SERIALIZED_NAME_CHECKSUM) + @javax.annotation.Nullable private ImageChecksum checksum; + + public static final String SERIALIZED_NAME_CONFIG = "config"; + + @SerializedName(SERIALIZED_NAME_CONFIG) + @javax.annotation.Nullable private ImageConfig config; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_DISK_FORMAT = "diskFormat"; + + @SerializedName(SERIALIZED_NAME_DISK_FORMAT) + @javax.annotation.Nonnull + private String diskFormat; + + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_IMPORT_PROGRESS = "importProgress"; + + @SerializedName(SERIALIZED_NAME_IMPORT_PROGRESS) + @javax.annotation.Nullable private Long importProgress; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_MIN_DISK_SIZE = "minDiskSize"; + + @SerializedName(SERIALIZED_NAME_MIN_DISK_SIZE) + @javax.annotation.Nullable private Long minDiskSize; + + public static final String SERIALIZED_NAME_MIN_RAM = "minRam"; + + @SerializedName(SERIALIZED_NAME_MIN_RAM) + @javax.annotation.Nullable private Long minRam; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_OWNER = "owner"; + + @SerializedName(SERIALIZED_NAME_OWNER) + @javax.annotation.Nullable private UUID owner; + + public static final String SERIALIZED_NAME_PROTECTED = "protected"; + + @SerializedName(SERIALIZED_NAME_PROTECTED) + @javax.annotation.Nullable private Boolean _protected; + + public static final String SERIALIZED_NAME_SCOPE = "scope"; + + @SerializedName(SERIALIZED_NAME_SCOPE) + @javax.annotation.Nullable private String scope; + + public static final String SERIALIZED_NAME_SIZE = "size"; + + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nullable private Long size; + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable private String status; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable private OffsetDateTime updatedAt; + + public Image() {} + + public Image( + ImageChecksum checksum, + OffsetDateTime createdAt, + UUID id, + Long importProgress, + UUID owner, + String scope, + Long size, + String status, + OffsetDateTime updatedAt) { + this(); + this.checksum = checksum; + this.createdAt = createdAt; + this.id = id; + this.importProgress = importProgress; + this.owner = owner; + this.scope = scope; + this.size = size; + this.status = status; + this.updatedAt = updatedAt; + } + + public Image agent(@javax.annotation.Nullable ImageAgent agent) { + this.agent = agent; + return this; + } + + /** + * Get agent + * + * @return agent + */ + @javax.annotation.Nullable public ImageAgent getAgent() { + return agent; + } + + public void setAgent(@javax.annotation.Nullable ImageAgent agent) { + this.agent = agent; + } + + /** + * Get checksum + * + * @return checksum + */ + @javax.annotation.Nullable public ImageChecksum getChecksum() { + return checksum; + } + + public Image config(@javax.annotation.Nullable ImageConfig config) { + this.config = config; + return this; + } + + /** + * Get config + * + * @return config + */ + @javax.annotation.Nullable public ImageConfig getConfig() { + return config; + } + + public void setConfig(@javax.annotation.Nullable ImageConfig config) { + this.config = config; + } + + /** + * Date-time when resource was created. + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public Image diskFormat(@javax.annotation.Nonnull String diskFormat) { + this.diskFormat = diskFormat; + return this; + } + + /** + * Object that represents a disk format. Possible values: `raw`, `qcow2`, + * `iso`. + * + * @return diskFormat + */ + @javax.annotation.Nonnull + public String getDiskFormat() { + return diskFormat; + } + + public void setDiskFormat(@javax.annotation.Nonnull String diskFormat) { + this.diskFormat = diskFormat; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + /** + * Indicates Image Import Progress in percent. + * + * @return importProgress + */ + @javax.annotation.Nullable public Long getImportProgress() { + return importProgress; + } + + public Image labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public Image minDiskSize(@javax.annotation.Nullable Long minDiskSize) { + this.minDiskSize = minDiskSize; + return this; + } + + /** + * Size in Gigabyte. + * + * @return minDiskSize + */ + @javax.annotation.Nullable public Long getMinDiskSize() { + return minDiskSize; + } + + public void setMinDiskSize(@javax.annotation.Nullable Long minDiskSize) { + this.minDiskSize = minDiskSize; + } + + public Image minRam(@javax.annotation.Nullable Long minRam) { + this.minRam = minRam; + return this; + } + + /** + * Size in Megabyte. + * + * @return minRam + */ + @javax.annotation.Nullable public Long getMinRam() { + return minRam; + } + + public void setMinRam(@javax.annotation.Nullable Long minRam) { + this.minRam = minRam; + } + + public Image name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return owner + */ + @javax.annotation.Nullable public UUID getOwner() { + return owner; + } + + public Image _protected(@javax.annotation.Nullable Boolean _protected) { + this._protected = _protected; + return this; + } + + /** + * When true the image is prevented from being deleted. + * + * @return _protected + */ + @javax.annotation.Nullable public Boolean getProtected() { + return _protected; + } + + public void setProtected(@javax.annotation.Nullable Boolean _protected) { + this._protected = _protected; + } + + /** + * Scope of an Image. Possible values: `public`, `local`, + * `projects`, `organization`. + * + * @return scope + */ + @javax.annotation.Nullable public String getScope() { + return scope; + } + + /** + * Size in bytes. + * + * @return size + */ + @javax.annotation.Nullable public Long getSize() { + return size; + } + + /** + * The status of an image object. Possible values: `AVAILABLE`, `CREATING`, + * `DEACTIVATED`, `DELETED`, `DELETING`, `ERROR`. + * + * @return status + */ + @javax.annotation.Nullable public String getStatus() { + return status; + } + + /** + * Date-time when resource was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nullable public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * 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 Image instance itself + */ + public Image 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; + } + Image image = (Image) o; + return Objects.equals(this.agent, image.agent) + && Objects.equals(this.checksum, image.checksum) + && Objects.equals(this.config, image.config) + && Objects.equals(this.createdAt, image.createdAt) + && Objects.equals(this.diskFormat, image.diskFormat) + && Objects.equals(this.id, image.id) + && Objects.equals(this.importProgress, image.importProgress) + && Objects.equals(this.labels, image.labels) + && Objects.equals(this.minDiskSize, image.minDiskSize) + && Objects.equals(this.minRam, image.minRam) + && Objects.equals(this.name, image.name) + && Objects.equals(this.owner, image.owner) + && Objects.equals(this._protected, image._protected) + && Objects.equals(this.scope, image.scope) + && Objects.equals(this.size, image.size) + && Objects.equals(this.status, image.status) + && Objects.equals(this.updatedAt, image.updatedAt) + && Objects.equals(this.additionalProperties, image.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + agent, + checksum, + config, + createdAt, + diskFormat, + id, + importProgress, + labels, + minDiskSize, + minRam, + name, + owner, + _protected, + scope, + size, + status, + updatedAt, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Image {\n"); + sb.append(" agent: ").append(toIndentedString(agent)).append("\n"); + sb.append(" checksum: ").append(toIndentedString(checksum)).append("\n"); + sb.append(" config: ").append(toIndentedString(config)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" diskFormat: ").append(toIndentedString(diskFormat)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" importProgress: ").append(toIndentedString(importProgress)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" minDiskSize: ").append(toIndentedString(minDiskSize)).append("\n"); + sb.append(" minRam: ").append(toIndentedString(minRam)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" owner: ").append(toIndentedString(owner)).append("\n"); + sb.append(" _protected: ").append(toIndentedString(_protected)).append("\n"); + sb.append(" scope: ").append(toIndentedString(scope)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).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( + "agent", + "checksum", + "config", + "createdAt", + "diskFormat", + "id", + "importProgress", + "labels", + "minDiskSize", + "minRam", + "name", + "owner", + "protected", + "scope", + "size", + "status", + "updatedAt")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("diskFormat", "name")); + } + + /** + * 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 Image + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Image.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 Image is not found in the empty JSON string", + Image.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Image.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 optional field `agent` + if (jsonObj.get("agent") != null && !jsonObj.get("agent").isJsonNull()) { + ImageAgent.validateJsonElement(jsonObj.get("agent")); + } + // validate the optional field `checksum` + if (jsonObj.get("checksum") != null && !jsonObj.get("checksum").isJsonNull()) { + ImageChecksum.validateJsonElement(jsonObj.get("checksum")); + } + // validate the optional field `config` + if (jsonObj.get("config") != null && !jsonObj.get("config").isJsonNull()) { + ImageConfig.validateJsonElement(jsonObj.get("config")); + } + if (!jsonObj.get("diskFormat").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `diskFormat` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("diskFormat").toString())); + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if (!jsonObj.get("name").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("owner") != null && !jsonObj.get("owner").isJsonNull()) + && !jsonObj.get("owner").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `owner` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("owner").toString())); + } + if ((jsonObj.get("scope") != null && !jsonObj.get("scope").isJsonNull()) + && !jsonObj.get("scope").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `scope` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("scope").toString())); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) + && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `status` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("status").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Image.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Image' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(Image.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, Image 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 Image read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Image 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 Image given an JSON string + * + * @param jsonString JSON string + * @return An instance of Image + * @throws IOException if the JSON string is invalid with respect to Image + */ + public static Image fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Image.class); + } + + /** + * Convert an instance of Image to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ImageAgent.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ImageAgent.java new file mode 100644 index 00000000..ab3dcae3 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ImageAgent.java @@ -0,0 +1,313 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** Support status and default provioning setting for the STACKIT server agent. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class ImageAgent { + public static final String SERIALIZED_NAME_PROVISION_BY_DEFAULT = "provisionByDefault"; + + @SerializedName(SERIALIZED_NAME_PROVISION_BY_DEFAULT) + @javax.annotation.Nullable private Boolean provisionByDefault; + + public static final String SERIALIZED_NAME_SUPPORTED = "supported"; + + @SerializedName(SERIALIZED_NAME_SUPPORTED) + @javax.annotation.Nullable private Boolean supported; + + public ImageAgent() {} + + public ImageAgent provisionByDefault(@javax.annotation.Nullable Boolean provisionByDefault) { + this.provisionByDefault = provisionByDefault; + return this; + } + + /** + * Default provioning of the STACKIT server agent for new servers. The default for new images is + * false. Can only be enabled when supported is also true. + * + * @return provisionByDefault + */ + @javax.annotation.Nullable public Boolean getProvisionByDefault() { + return provisionByDefault; + } + + public void setProvisionByDefault(@javax.annotation.Nullable Boolean provisionByDefault) { + this.provisionByDefault = provisionByDefault; + } + + public ImageAgent supported(@javax.annotation.Nullable Boolean supported) { + this.supported = supported; + return this; + } + + /** + * Indicates the STACKIT server agent for the image. The default for new images is false. + * + * @return supported + */ + @javax.annotation.Nullable public Boolean getSupported() { + return supported; + } + + public void setSupported(@javax.annotation.Nullable Boolean supported) { + this.supported = supported; + } + + /** + * 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 ImageAgent instance itself + */ + public ImageAgent 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; + } + ImageAgent imageAgent = (ImageAgent) o; + return Objects.equals(this.provisionByDefault, imageAgent.provisionByDefault) + && Objects.equals(this.supported, imageAgent.supported) + && Objects.equals(this.additionalProperties, imageAgent.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(provisionByDefault, supported, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ImageAgent {\n"); + sb.append(" provisionByDefault: ") + .append(toIndentedString(provisionByDefault)) + .append("\n"); + sb.append(" supported: ").append(toIndentedString(supported)).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("provisionByDefault", "supported")); + + // 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 ImageAgent + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ImageAgent.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 ImageAgent is not found in the empty JSON string", + ImageAgent.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ImageAgent.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ImageAgent' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ImageAgent.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ImageAgent 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 ImageAgent read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ImageAgent 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 ImageAgent given an JSON string + * + * @param jsonString JSON string + * @return An instance of ImageAgent + * @throws IOException if the JSON string is invalid with respect to ImageAgent + */ + public static ImageAgent fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ImageAgent.class); + } + + /** + * Convert an instance of ImageAgent to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ImageChecksum.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ImageChecksum.java new file mode 100644 index 00000000..f4d50a4b --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ImageChecksum.java @@ -0,0 +1,341 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** Representation of an image checksum. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class ImageChecksum { + public static final String SERIALIZED_NAME_ALGORITHM = "algorithm"; + + @SerializedName(SERIALIZED_NAME_ALGORITHM) + @javax.annotation.Nonnull + private String algorithm; + + public static final String SERIALIZED_NAME_DIGEST = "digest"; + + @SerializedName(SERIALIZED_NAME_DIGEST) + @javax.annotation.Nonnull + private String digest; + + public ImageChecksum() {} + + public ImageChecksum algorithm(@javax.annotation.Nonnull String algorithm) { + this.algorithm = algorithm; + return this; + } + + /** + * Algorithm for the checksum of the image data. Possible values: `md5`, + * `sha512`. + * + * @return algorithm + */ + @javax.annotation.Nonnull + public String getAlgorithm() { + return algorithm; + } + + public void setAlgorithm(@javax.annotation.Nonnull String algorithm) { + this.algorithm = algorithm; + } + + public ImageChecksum digest(@javax.annotation.Nonnull String digest) { + this.digest = digest; + return this; + } + + /** + * Hexdigest of the checksum of the image data. + * + * @return digest + */ + @javax.annotation.Nonnull + public String getDigest() { + return digest; + } + + public void setDigest(@javax.annotation.Nonnull String digest) { + this.digest = digest; + } + + /** + * 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 ImageChecksum instance itself + */ + public ImageChecksum 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; + } + ImageChecksum imageChecksum = (ImageChecksum) o; + return Objects.equals(this.algorithm, imageChecksum.algorithm) + && Objects.equals(this.digest, imageChecksum.digest) + && Objects.equals(this.additionalProperties, imageChecksum.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(algorithm, digest, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ImageChecksum {\n"); + sb.append(" algorithm: ").append(toIndentedString(algorithm)).append("\n"); + sb.append(" digest: ").append(toIndentedString(digest)).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("algorithm", "digest")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("algorithm", "digest")); + } + + /** + * 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 ImageChecksum + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ImageChecksum.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 ImageChecksum is not found in the empty JSON string", + ImageChecksum.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ImageChecksum.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("algorithm").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `algorithm` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("algorithm").toString())); + } + if (!jsonObj.get("digest").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `digest` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("digest").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ImageChecksum.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ImageChecksum' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ImageChecksum.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ImageChecksum 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 ImageChecksum read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ImageChecksum 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 ImageChecksum given an JSON string + * + * @param jsonString JSON string + * @return An instance of ImageChecksum + * @throws IOException if the JSON string is invalid with respect to ImageChecksum + */ + public static ImageChecksum fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ImageChecksum.class); + } + + /** + * Convert an instance of ImageChecksum to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ImageConfig.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ImageConfig.java new file mode 100644 index 00000000..e8953055 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ImageConfig.java @@ -0,0 +1,756 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Properties to set hardware and scheduling settings for an Image. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class ImageConfig { + public static final String SERIALIZED_NAME_ARCHITECTURE = "architecture"; + + @SerializedName(SERIALIZED_NAME_ARCHITECTURE) + @javax.annotation.Nullable private String architecture; + + public static final String SERIALIZED_NAME_BOOT_MENU = "bootMenu"; + + @SerializedName(SERIALIZED_NAME_BOOT_MENU) + @javax.annotation.Nullable private Boolean bootMenu; + + public static final String SERIALIZED_NAME_CDROM_BUS = "cdromBus"; + + @SerializedName(SERIALIZED_NAME_CDROM_BUS) + @javax.annotation.Nullable private String cdromBus; + + public static final String SERIALIZED_NAME_DISK_BUS = "diskBus"; + + @SerializedName(SERIALIZED_NAME_DISK_BUS) + @javax.annotation.Nullable private String diskBus; + + public static final String SERIALIZED_NAME_NIC_MODEL = "nicModel"; + + @SerializedName(SERIALIZED_NAME_NIC_MODEL) + @javax.annotation.Nullable private String nicModel; + + public static final String SERIALIZED_NAME_OPERATING_SYSTEM = "operatingSystem"; + + @SerializedName(SERIALIZED_NAME_OPERATING_SYSTEM) + @javax.annotation.Nullable private String operatingSystem; + + public static final String SERIALIZED_NAME_OPERATING_SYSTEM_DISTRO = "operatingSystemDistro"; + + @SerializedName(SERIALIZED_NAME_OPERATING_SYSTEM_DISTRO) + @javax.annotation.Nullable private String operatingSystemDistro; + + public static final String SERIALIZED_NAME_OPERATING_SYSTEM_VERSION = "operatingSystemVersion"; + + @SerializedName(SERIALIZED_NAME_OPERATING_SYSTEM_VERSION) + @javax.annotation.Nullable private String operatingSystemVersion; + + public static final String SERIALIZED_NAME_RESCUE_BUS = "rescueBus"; + + @SerializedName(SERIALIZED_NAME_RESCUE_BUS) + @javax.annotation.Nullable private String rescueBus; + + public static final String SERIALIZED_NAME_RESCUE_DEVICE = "rescueDevice"; + + @SerializedName(SERIALIZED_NAME_RESCUE_DEVICE) + @javax.annotation.Nullable private String rescueDevice; + + public static final String SERIALIZED_NAME_SECURE_BOOT = "secureBoot"; + + @SerializedName(SERIALIZED_NAME_SECURE_BOOT) + @javax.annotation.Nullable private Boolean secureBoot; + + public static final String SERIALIZED_NAME_UEFI = "uefi"; + + @SerializedName(SERIALIZED_NAME_UEFI) + @javax.annotation.Nullable private Boolean uefi; + + public static final String SERIALIZED_NAME_VIDEO_MODEL = "videoModel"; + + @SerializedName(SERIALIZED_NAME_VIDEO_MODEL) + @javax.annotation.Nullable private String videoModel; + + public static final String SERIALIZED_NAME_VIRTIO_SCSI = "virtioScsi"; + + @SerializedName(SERIALIZED_NAME_VIRTIO_SCSI) + @javax.annotation.Nullable private Boolean virtioScsi; + + public ImageConfig() {} + + public ImageConfig architecture(@javax.annotation.Nullable String architecture) { + this.architecture = architecture; + return this; + } + + /** + * Represents CPU architecture. The default for new images is x86. Possible values: + * `arm64`, `x86`. + * + * @return architecture + */ + @javax.annotation.Nullable public String getArchitecture() { + return architecture; + } + + public void setArchitecture(@javax.annotation.Nullable String architecture) { + this.architecture = architecture; + } + + public ImageConfig bootMenu(@javax.annotation.Nullable Boolean bootMenu) { + this.bootMenu = bootMenu; + return this; + } + + /** + * Enables the BIOS bootmenu. The default for new images is disabled. + * + * @return bootMenu + */ + @javax.annotation.Nullable public Boolean getBootMenu() { + return bootMenu; + } + + public void setBootMenu(@javax.annotation.Nullable Boolean bootMenu) { + this.bootMenu = bootMenu; + } + + public ImageConfig cdromBus(@javax.annotation.Nullable String cdromBus) { + this.cdromBus = cdromBus; + return this; + } + + /** + * Sets CDROM bus controller type. Possible values: `scsi`, `virtio`, + * `ide`, `usb`. + * + * @return cdromBus + */ + @javax.annotation.Nullable public String getCdromBus() { + return cdromBus; + } + + public void setCdromBus(@javax.annotation.Nullable String cdromBus) { + this.cdromBus = cdromBus; + } + + public ImageConfig diskBus(@javax.annotation.Nullable String diskBus) { + this.diskBus = diskBus; + return this; + } + + /** + * Sets Disk bus controller type. Possible values: `scsi`, `virtio`, + * `ide`, `usb`. + * + * @return diskBus + */ + @javax.annotation.Nullable public String getDiskBus() { + return diskBus; + } + + public void setDiskBus(@javax.annotation.Nullable String diskBus) { + this.diskBus = diskBus; + } + + public ImageConfig nicModel(@javax.annotation.Nullable String nicModel) { + this.nicModel = nicModel; + return this; + } + + /** + * Sets virtual nic model. Possible values: `e1000`, `e1000e`, + * `ne2k_pci`, `pcnet`, `rtl8139`, `virtio`, + * `vmxnet3`. + * + * @return nicModel + */ + @javax.annotation.Nullable public String getNicModel() { + return nicModel; + } + + public void setNicModel(@javax.annotation.Nullable String nicModel) { + this.nicModel = nicModel; + } + + public ImageConfig operatingSystem(@javax.annotation.Nullable String operatingSystem) { + this.operatingSystem = operatingSystem; + return this; + } + + /** + * Enables OS specific optimizations. Possible values: `windows`, `linux`. + * + * @return operatingSystem + */ + @javax.annotation.Nullable public String getOperatingSystem() { + return operatingSystem; + } + + public void setOperatingSystem(@javax.annotation.Nullable String operatingSystem) { + this.operatingSystem = operatingSystem; + } + + public ImageConfig operatingSystemDistro( + @javax.annotation.Nullable String operatingSystemDistro) { + this.operatingSystemDistro = operatingSystemDistro; + return this; + } + + /** + * Operating System Distribution. + * + * @return operatingSystemDistro + */ + @javax.annotation.Nullable public String getOperatingSystemDistro() { + return operatingSystemDistro; + } + + public void setOperatingSystemDistro(@javax.annotation.Nullable String operatingSystemDistro) { + this.operatingSystemDistro = operatingSystemDistro; + } + + public ImageConfig operatingSystemVersion( + @javax.annotation.Nullable String operatingSystemVersion) { + this.operatingSystemVersion = operatingSystemVersion; + return this; + } + + /** + * Version of the OS. + * + * @return operatingSystemVersion + */ + @javax.annotation.Nullable public String getOperatingSystemVersion() { + return operatingSystemVersion; + } + + public void setOperatingSystemVersion( + @javax.annotation.Nullable String operatingSystemVersion) { + this.operatingSystemVersion = operatingSystemVersion; + } + + public ImageConfig rescueBus(@javax.annotation.Nullable String rescueBus) { + this.rescueBus = rescueBus; + return this; + } + + /** + * Sets the device bus when the image is used as a rescue image. Possible values: + * `sata`, `scsi`, `virtio`, `usb`. + * + * @return rescueBus + */ + @javax.annotation.Nullable public String getRescueBus() { + return rescueBus; + } + + public void setRescueBus(@javax.annotation.Nullable String rescueBus) { + this.rescueBus = rescueBus; + } + + public ImageConfig rescueDevice(@javax.annotation.Nullable String rescueDevice) { + this.rescueDevice = rescueDevice; + return this; + } + + /** + * Sets the device when the image is used as a rescue image. Possible values: `cdrom`, + * `disk`. + * + * @return rescueDevice + */ + @javax.annotation.Nullable public String getRescueDevice() { + return rescueDevice; + } + + public void setRescueDevice(@javax.annotation.Nullable String rescueDevice) { + this.rescueDevice = rescueDevice; + } + + public ImageConfig secureBoot(@javax.annotation.Nullable Boolean secureBoot) { + this.secureBoot = secureBoot; + return this; + } + + /** + * Enables Secure Boot. The default for new images is disabled. + * + * @return secureBoot + */ + @javax.annotation.Nullable public Boolean getSecureBoot() { + return secureBoot; + } + + public void setSecureBoot(@javax.annotation.Nullable Boolean secureBoot) { + this.secureBoot = secureBoot; + } + + public ImageConfig uefi(@javax.annotation.Nullable Boolean uefi) { + this.uefi = uefi; + return this; + } + + /** + * Configure UEFI boot. The default for new images is enabled. + * + * @return uefi + */ + @javax.annotation.Nullable public Boolean getUefi() { + return uefi; + } + + public void setUefi(@javax.annotation.Nullable Boolean uefi) { + this.uefi = uefi; + } + + public ImageConfig videoModel(@javax.annotation.Nullable String videoModel) { + this.videoModel = videoModel; + return this; + } + + /** + * Sets Graphic device model. Possible values: `vga`, `cirrus`, + * `vmvga`, `qxl`, `virtio`, `none`. + * + * @return videoModel + */ + @javax.annotation.Nullable public String getVideoModel() { + return videoModel; + } + + public void setVideoModel(@javax.annotation.Nullable String videoModel) { + this.videoModel = videoModel; + } + + public ImageConfig virtioScsi(@javax.annotation.Nullable Boolean virtioScsi) { + this.virtioScsi = virtioScsi; + return this; + } + + /** + * Enables the use of VirtIO SCSI to provide block device access. By default servers use VirtIO + * Block. + * + * @return virtioScsi + */ + @javax.annotation.Nullable public Boolean getVirtioScsi() { + return virtioScsi; + } + + public void setVirtioScsi(@javax.annotation.Nullable Boolean virtioScsi) { + this.virtioScsi = virtioScsi; + } + + /** + * 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 ImageConfig instance itself + */ + public ImageConfig 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; + } + ImageConfig imageConfig = (ImageConfig) o; + return Objects.equals(this.architecture, imageConfig.architecture) + && Objects.equals(this.bootMenu, imageConfig.bootMenu) + && Objects.equals(this.cdromBus, imageConfig.cdromBus) + && Objects.equals(this.diskBus, imageConfig.diskBus) + && Objects.equals(this.nicModel, imageConfig.nicModel) + && Objects.equals(this.operatingSystem, imageConfig.operatingSystem) + && Objects.equals(this.operatingSystemDistro, imageConfig.operatingSystemDistro) + && Objects.equals(this.operatingSystemVersion, imageConfig.operatingSystemVersion) + && Objects.equals(this.rescueBus, imageConfig.rescueBus) + && Objects.equals(this.rescueDevice, imageConfig.rescueDevice) + && Objects.equals(this.secureBoot, imageConfig.secureBoot) + && Objects.equals(this.uefi, imageConfig.uefi) + && Objects.equals(this.videoModel, imageConfig.videoModel) + && Objects.equals(this.virtioScsi, imageConfig.virtioScsi) + && Objects.equals(this.additionalProperties, imageConfig.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash( + architecture, + bootMenu, + cdromBus, + diskBus, + nicModel, + operatingSystem, + operatingSystemDistro, + operatingSystemVersion, + rescueBus, + rescueDevice, + secureBoot, + uefi, + videoModel, + virtioScsi, + additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ImageConfig {\n"); + sb.append(" architecture: ").append(toIndentedString(architecture)).append("\n"); + sb.append(" bootMenu: ").append(toIndentedString(bootMenu)).append("\n"); + sb.append(" cdromBus: ").append(toIndentedString(cdromBus)).append("\n"); + sb.append(" diskBus: ").append(toIndentedString(diskBus)).append("\n"); + sb.append(" nicModel: ").append(toIndentedString(nicModel)).append("\n"); + sb.append(" operatingSystem: ").append(toIndentedString(operatingSystem)).append("\n"); + sb.append(" operatingSystemDistro: ") + .append(toIndentedString(operatingSystemDistro)) + .append("\n"); + sb.append(" operatingSystemVersion: ") + .append(toIndentedString(operatingSystemVersion)) + .append("\n"); + sb.append(" rescueBus: ").append(toIndentedString(rescueBus)).append("\n"); + sb.append(" rescueDevice: ").append(toIndentedString(rescueDevice)).append("\n"); + sb.append(" secureBoot: ").append(toIndentedString(secureBoot)).append("\n"); + sb.append(" uefi: ").append(toIndentedString(uefi)).append("\n"); + sb.append(" videoModel: ").append(toIndentedString(videoModel)).append("\n"); + sb.append(" virtioScsi: ").append(toIndentedString(virtioScsi)).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( + "architecture", + "bootMenu", + "cdromBus", + "diskBus", + "nicModel", + "operatingSystem", + "operatingSystemDistro", + "operatingSystemVersion", + "rescueBus", + "rescueDevice", + "secureBoot", + "uefi", + "videoModel", + "virtioScsi")); + + // 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 ImageConfig + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ImageConfig.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 ImageConfig is not found in the empty JSON string", + ImageConfig.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("architecture") != null && !jsonObj.get("architecture").isJsonNull()) + && !jsonObj.get("architecture").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `architecture` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("architecture").toString())); + } + if ((jsonObj.get("cdromBus") != null && !jsonObj.get("cdromBus").isJsonNull()) + && !jsonObj.get("cdromBus").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `cdromBus` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("cdromBus").toString())); + } + if ((jsonObj.get("diskBus") != null && !jsonObj.get("diskBus").isJsonNull()) + && !jsonObj.get("diskBus").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `diskBus` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("diskBus").toString())); + } + if ((jsonObj.get("nicModel") != null && !jsonObj.get("nicModel").isJsonNull()) + && !jsonObj.get("nicModel").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `nicModel` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("nicModel").toString())); + } + if ((jsonObj.get("operatingSystem") != null && !jsonObj.get("operatingSystem").isJsonNull()) + && !jsonObj.get("operatingSystem").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `operatingSystem` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("operatingSystem").toString())); + } + if ((jsonObj.get("operatingSystemDistro") != null + && !jsonObj.get("operatingSystemDistro").isJsonNull()) + && !jsonObj.get("operatingSystemDistro").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `operatingSystemDistro` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("operatingSystemDistro").toString())); + } + if ((jsonObj.get("operatingSystemVersion") != null + && !jsonObj.get("operatingSystemVersion").isJsonNull()) + && !jsonObj.get("operatingSystemVersion").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `operatingSystemVersion` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("operatingSystemVersion").toString())); + } + if ((jsonObj.get("rescueBus") != null && !jsonObj.get("rescueBus").isJsonNull()) + && !jsonObj.get("rescueBus").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `rescueBus` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("rescueBus").toString())); + } + if ((jsonObj.get("rescueDevice") != null && !jsonObj.get("rescueDevice").isJsonNull()) + && !jsonObj.get("rescueDevice").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `rescueDevice` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("rescueDevice").toString())); + } + if ((jsonObj.get("videoModel") != null && !jsonObj.get("videoModel").isJsonNull()) + && !jsonObj.get("videoModel").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `videoModel` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("videoModel").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ImageConfig.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ImageConfig' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ImageConfig.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ImageConfig 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 ImageConfig read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ImageConfig 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 ImageConfig given an JSON string + * + * @param jsonString JSON string + * @return An instance of ImageConfig + * @throws IOException if the JSON string is invalid with respect to ImageConfig + */ + public static ImageConfig fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ImageConfig.class); + } + + /** + * Convert an instance of ImageConfig to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ImageCreateResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ImageCreateResponse.java new file mode 100644 index 00000000..76d1b294 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ImageCreateResponse.java @@ -0,0 +1,344 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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.net.URI; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +/** Image creation response. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class ImageCreateResponse { + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private UUID id; + + public static final String SERIALIZED_NAME_UPLOAD_URL = "uploadUrl"; + + @SerializedName(SERIALIZED_NAME_UPLOAD_URL) + @javax.annotation.Nonnull + private URI uploadUrl; + + public ImageCreateResponse() {} + + public ImageCreateResponse id(@javax.annotation.Nonnull UUID id) { + this.id = id; + return this; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nonnull + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull UUID id) { + this.id = id; + } + + public ImageCreateResponse uploadUrl(@javax.annotation.Nonnull URI uploadUrl) { + this.uploadUrl = uploadUrl; + return this; + } + + /** + * Get uploadUrl + * + * @return uploadUrl + */ + @javax.annotation.Nonnull + public URI getUploadUrl() { + return uploadUrl; + } + + public void setUploadUrl(@javax.annotation.Nonnull URI uploadUrl) { + this.uploadUrl = uploadUrl; + } + + /** + * 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 ImageCreateResponse instance itself + */ + public ImageCreateResponse 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; + } + ImageCreateResponse imageCreateResponse = (ImageCreateResponse) o; + return Objects.equals(this.id, imageCreateResponse.id) + && Objects.equals(this.uploadUrl, imageCreateResponse.uploadUrl) + && Objects.equals( + this.additionalProperties, imageCreateResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, uploadUrl, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ImageCreateResponse {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" uploadUrl: ").append(toIndentedString(uploadUrl)).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("id", "uploadUrl")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("id", "uploadUrl")); + } + + /** + * 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 ImageCreateResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ImageCreateResponse.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 ImageCreateResponse is not found in the empty JSON string", + ImageCreateResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ImageCreateResponse.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("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if (!jsonObj.get("uploadUrl").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `uploadUrl` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("uploadUrl").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ImageCreateResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ImageCreateResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ImageCreateResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ImageCreateResponse 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 ImageCreateResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ImageCreateResponse 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 ImageCreateResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ImageCreateResponse + * @throws IOException if the JSON string is invalid with respect to ImageCreateResponse + */ + public static ImageCreateResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ImageCreateResponse.class); + } + + /** + * Convert an instance of ImageCreateResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ImageListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ImageListResponse.java new file mode 100644 index 00000000..e4a4a8a9 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ImageListResponse.java @@ -0,0 +1,326 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** Image list response. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class ImageListResponse { + public static final String SERIALIZED_NAME_ITEMS = "items"; + + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public ImageListResponse() {} + + public ImageListResponse items(@javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public ImageListResponse addItemsItem(Image itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list containing image objects. + * + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ImageListResponse instance itself + */ + public ImageListResponse 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; + } + ImageListResponse imageListResponse = (ImageListResponse) o; + return Objects.equals(this.items, imageListResponse.items) + && Objects.equals( + this.additionalProperties, imageListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ImageListResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("items")); + } + + /** + * 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 ImageListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ImageListResponse.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 ImageListResponse is not found in the empty JSON string", + ImageListResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ImageListResponse.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("items").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `items` to be an array in the JSON string but got `%s`", + jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + Image.validateJsonElement(jsonArrayitems.get(i)); + } + ; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ImageListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ImageListResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ImageListResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ImageListResponse 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 ImageListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ImageListResponse 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 ImageListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ImageListResponse + * @throws IOException if the JSON string is invalid with respect to ImageListResponse + */ + public static ImageListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ImageListResponse.class); + } + + /** + * Convert an instance of ImageListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ImageShare.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ImageShare.java new file mode 100644 index 00000000..cc4c0fac --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ImageShare.java @@ -0,0 +1,334 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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.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; +import java.util.UUID; + +/** + * Share details of an Image. For requests ParentOrganization and Projects are mutually exclusive. + */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class ImageShare { + public static final String SERIALIZED_NAME_PARENT_ORGANIZATION = "parentOrganization"; + + @SerializedName(SERIALIZED_NAME_PARENT_ORGANIZATION) + @javax.annotation.Nullable private Boolean parentOrganization; + + public static final String SERIALIZED_NAME_PROJECTS = "projects"; + + @SerializedName(SERIALIZED_NAME_PROJECTS) + @javax.annotation.Nullable private List projects = new ArrayList<>(); + + public ImageShare() {} + + public ImageShare parentOrganization(@javax.annotation.Nullable Boolean parentOrganization) { + this.parentOrganization = parentOrganization; + return this; + } + + /** + * Image is shared with all projects inside the image owners organization. + * + * @return parentOrganization + */ + @javax.annotation.Nullable public Boolean getParentOrganization() { + return parentOrganization; + } + + public void setParentOrganization(@javax.annotation.Nullable Boolean parentOrganization) { + this.parentOrganization = parentOrganization; + } + + public ImageShare projects(@javax.annotation.Nullable List projects) { + this.projects = projects; + return this; + } + + public ImageShare addProjectsItem(UUID projectsItem) { + if (this.projects == null) { + this.projects = new ArrayList<>(); + } + this.projects.add(projectsItem); + return this; + } + + /** + * List of all projects the Image is shared with. + * + * @return projects + */ + @javax.annotation.Nullable public List getProjects() { + return projects; + } + + public void setProjects(@javax.annotation.Nullable List projects) { + this.projects = projects; + } + + /** + * 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 ImageShare instance itself + */ + public ImageShare 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; + } + ImageShare imageShare = (ImageShare) o; + return Objects.equals(this.parentOrganization, imageShare.parentOrganization) + && Objects.equals(this.projects, imageShare.projects) + && Objects.equals(this.additionalProperties, imageShare.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(parentOrganization, projects, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ImageShare {\n"); + sb.append(" parentOrganization: ") + .append(toIndentedString(parentOrganization)) + .append("\n"); + sb.append(" projects: ").append(toIndentedString(projects)).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("parentOrganization", "projects")); + + // 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 ImageShare + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ImageShare.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 ImageShare is not found in the empty JSON string", + ImageShare.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("projects") != null + && !jsonObj.get("projects").isJsonNull() + && !jsonObj.get("projects").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `projects` to be an array in the JSON string but got `%s`", + jsonObj.get("projects").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ImageShare.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ImageShare' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ImageShare.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ImageShare 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 ImageShare read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ImageShare 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 ImageShare given an JSON string + * + * @param jsonString JSON string + * @return An instance of ImageShare + * @throws IOException if the JSON string is invalid with respect to ImageShare + */ + public static ImageShare fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ImageShare.class); + } + + /** + * Convert an instance of ImageShare to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ImageShareConsumer.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ImageShareConsumer.java new file mode 100644 index 00000000..226c5a2d --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ImageShareConsumer.java @@ -0,0 +1,361 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; +import java.util.UUID; + +/** The details of an Image share consumer. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class ImageShareConsumer { + public static final String SERIALIZED_NAME_CONSUMER_PROJECT_ID = "consumerProjectId"; + + @SerializedName(SERIALIZED_NAME_CONSUMER_PROJECT_ID) + @javax.annotation.Nullable private UUID consumerProjectId; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_IMAGE_ID = "imageId"; + + @SerializedName(SERIALIZED_NAME_IMAGE_ID) + @javax.annotation.Nullable private UUID imageId; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable private OffsetDateTime updatedAt; + + public ImageShareConsumer() {} + + public ImageShareConsumer( + UUID consumerProjectId, + OffsetDateTime createdAt, + UUID imageId, + OffsetDateTime updatedAt) { + this(); + this.consumerProjectId = consumerProjectId; + this.createdAt = createdAt; + this.imageId = imageId; + this.updatedAt = updatedAt; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return consumerProjectId + */ + @javax.annotation.Nullable public UUID getConsumerProjectId() { + return consumerProjectId; + } + + /** + * Date-time when resource was created. + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return imageId + */ + @javax.annotation.Nullable public UUID getImageId() { + return imageId; + } + + /** + * Date-time when resource was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nullable public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * 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 ImageShareConsumer instance itself + */ + public ImageShareConsumer 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; + } + ImageShareConsumer imageShareConsumer = (ImageShareConsumer) o; + return Objects.equals(this.consumerProjectId, imageShareConsumer.consumerProjectId) + && Objects.equals(this.createdAt, imageShareConsumer.createdAt) + && Objects.equals(this.imageId, imageShareConsumer.imageId) + && Objects.equals(this.updatedAt, imageShareConsumer.updatedAt) + && Objects.equals( + this.additionalProperties, imageShareConsumer.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(consumerProjectId, createdAt, imageId, updatedAt, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ImageShareConsumer {\n"); + sb.append(" consumerProjectId: ") + .append(toIndentedString(consumerProjectId)) + .append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" imageId: ").append(toIndentedString(imageId)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).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("consumerProjectId", "createdAt", "imageId", "updatedAt")); + + // 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 ImageShareConsumer + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ImageShareConsumer.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 ImageShareConsumer is not found in the empty JSON string", + ImageShareConsumer.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("consumerProjectId") != null + && !jsonObj.get("consumerProjectId").isJsonNull()) + && !jsonObj.get("consumerProjectId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `consumerProjectId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("consumerProjectId").toString())); + } + if ((jsonObj.get("imageId") != null && !jsonObj.get("imageId").isJsonNull()) + && !jsonObj.get("imageId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `imageId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("imageId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ImageShareConsumer.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ImageShareConsumer' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ImageShareConsumer.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ImageShareConsumer 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 ImageShareConsumer read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ImageShareConsumer 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 ImageShareConsumer given an JSON string + * + * @param jsonString JSON string + * @return An instance of ImageShareConsumer + * @throws IOException if the JSON string is invalid with respect to ImageShareConsumer + */ + public static ImageShareConsumer fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ImageShareConsumer.class); + } + + /** + * Convert an instance of ImageShareConsumer to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/KeyPairListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/KeyPairListResponse.java new file mode 100644 index 00000000..60418cb9 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/KeyPairListResponse.java @@ -0,0 +1,326 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** SSH keypair list response. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class KeyPairListResponse { + public static final String SERIALIZED_NAME_ITEMS = "items"; + + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public KeyPairListResponse() {} + + public KeyPairListResponse items(@javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public KeyPairListResponse addItemsItem(Keypair itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list of SSH keypairs. + * + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the KeyPairListResponse instance itself + */ + public KeyPairListResponse 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; + } + KeyPairListResponse keyPairListResponse = (KeyPairListResponse) o; + return Objects.equals(this.items, keyPairListResponse.items) + && Objects.equals( + this.additionalProperties, keyPairListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class KeyPairListResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("items")); + } + + /** + * 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 KeyPairListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!KeyPairListResponse.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 KeyPairListResponse is not found in the empty JSON string", + KeyPairListResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : KeyPairListResponse.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("items").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `items` to be an array in the JSON string but got `%s`", + jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + Keypair.validateJsonElement(jsonArrayitems.get(i)); + } + ; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!KeyPairListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'KeyPairListResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(KeyPairListResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, KeyPairListResponse 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 KeyPairListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + KeyPairListResponse 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 KeyPairListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of KeyPairListResponse + * @throws IOException if the JSON string is invalid with respect to KeyPairListResponse + */ + public static KeyPairListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, KeyPairListResponse.class); + } + + /** + * Convert an instance of KeyPairListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/Keypair.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/Keypair.java new file mode 100644 index 00000000..6392e108 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/Keypair.java @@ -0,0 +1,442 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** Object that represents the public key of an SSH keypair and its name. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class Keypair { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_FINGERPRINT = "fingerprint"; + + @SerializedName(SERIALIZED_NAME_FINGERPRINT) + @javax.annotation.Nullable private String fingerprint; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; + + public static final String SERIALIZED_NAME_PUBLIC_KEY = "publicKey"; + + @SerializedName(SERIALIZED_NAME_PUBLIC_KEY) + @javax.annotation.Nonnull + private String publicKey; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable private OffsetDateTime updatedAt; + + public Keypair() {} + + public Keypair(OffsetDateTime createdAt, String fingerprint, OffsetDateTime updatedAt) { + this(); + this.createdAt = createdAt; + this.fingerprint = fingerprint; + this.updatedAt = updatedAt; + } + + /** + * Date-time when resource was created. + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * Object that represents an SSH keypair MD5 fingerprint. + * + * @return fingerprint + */ + @javax.annotation.Nullable public String getFingerprint() { + return fingerprint; + } + + public Keypair labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public Keypair name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The name of an SSH keypair. Allowed characters are letters [a-zA-Z], digits [0-9] and the + * following special characters: [@._-]. + * + * @return name + */ + @javax.annotation.Nullable public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + public Keypair publicKey(@javax.annotation.Nonnull String publicKey) { + this.publicKey = publicKey; + return this; + } + + /** + * Object that represents a public SSH key. + * + * @return publicKey + */ + @javax.annotation.Nonnull + public String getPublicKey() { + return publicKey; + } + + public void setPublicKey(@javax.annotation.Nonnull String publicKey) { + this.publicKey = publicKey; + } + + /** + * Date-time when resource was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nullable public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * 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 Keypair instance itself + */ + public Keypair 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; + } + Keypair keypair = (Keypair) o; + return Objects.equals(this.createdAt, keypair.createdAt) + && Objects.equals(this.fingerprint, keypair.fingerprint) + && Objects.equals(this.labels, keypair.labels) + && Objects.equals(this.name, keypair.name) + && Objects.equals(this.publicKey, keypair.publicKey) + && Objects.equals(this.updatedAt, keypair.updatedAt) + && Objects.equals(this.additionalProperties, keypair.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + createdAt, fingerprint, labels, name, publicKey, updatedAt, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Keypair {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" fingerprint: ").append(toIndentedString(fingerprint)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" publicKey: ").append(toIndentedString(publicKey)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).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( + "createdAt", + "fingerprint", + "labels", + "name", + "publicKey", + "updatedAt")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("publicKey")); + } + + /** + * 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 Keypair + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Keypair.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 Keypair is not found in the empty JSON string", + Keypair.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Keypair.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("fingerprint") != null && !jsonObj.get("fingerprint").isJsonNull()) + && !jsonObj.get("fingerprint").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `fingerprint` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("fingerprint").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `name` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("name").toString())); + } + if (!jsonObj.get("publicKey").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `publicKey` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("publicKey").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Keypair.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Keypair' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(Keypair.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, Keypair 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 Keypair read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Keypair 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 Keypair given an JSON string + * + * @param jsonString JSON string + * @return An instance of Keypair + * @throws IOException if the JSON string is invalid with respect to Keypair + */ + public static Keypair fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Keypair.class); + } + + /** + * Convert an instance of Keypair to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/MachineType.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/MachineType.java new file mode 100644 index 00000000..8d96e795 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/MachineType.java @@ -0,0 +1,450 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** + * Machine Type. Filterable Fields: `disk`, `extraSpecs`, `name`, + * `ram`, `vcpus`. + */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class MachineType { + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable private String description; + + public static final String SERIALIZED_NAME_DISK = "disk"; + + @SerializedName(SERIALIZED_NAME_DISK) + @javax.annotation.Nonnull + private Long disk; + + public static final String SERIALIZED_NAME_EXTRA_SPECS = "extraSpecs"; + + @SerializedName(SERIALIZED_NAME_EXTRA_SPECS) + @javax.annotation.Nullable private Object extraSpecs; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_RAM = "ram"; + + @SerializedName(SERIALIZED_NAME_RAM) + @javax.annotation.Nonnull + private Long ram; + + public static final String SERIALIZED_NAME_VCPUS = "vcpus"; + + @SerializedName(SERIALIZED_NAME_VCPUS) + @javax.annotation.Nonnull + private Long vcpus; + + public MachineType() {} + + public MachineType description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Description Object. Allows string up to 255 Characters. + * + * @return description + */ + @javax.annotation.Nullable public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + public MachineType disk(@javax.annotation.Nonnull Long disk) { + this.disk = disk; + return this; + } + + /** + * Size in Gigabyte. + * + * @return disk + */ + @javax.annotation.Nonnull + public Long getDisk() { + return disk; + } + + public void setDisk(@javax.annotation.Nonnull Long disk) { + this.disk = disk; + } + + public MachineType extraSpecs(@javax.annotation.Nullable Object extraSpecs) { + this.extraSpecs = extraSpecs; + return this; + } + + /** + * Properties to control certain aspects or scheduling behavior for an object. + * + * @return extraSpecs + */ + @javax.annotation.Nullable public Object getExtraSpecs() { + return extraSpecs; + } + + public void setExtraSpecs(@javax.annotation.Nullable Object extraSpecs) { + this.extraSpecs = extraSpecs; + } + + public MachineType name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + public MachineType ram(@javax.annotation.Nonnull Long ram) { + this.ram = ram; + return this; + } + + /** + * Size in Megabyte. + * + * @return ram + */ + @javax.annotation.Nonnull + public Long getRam() { + return ram; + } + + public void setRam(@javax.annotation.Nonnull Long ram) { + this.ram = ram; + } + + public MachineType vcpus(@javax.annotation.Nonnull Long vcpus) { + this.vcpus = vcpus; + return this; + } + + /** + * The number of virtual CPUs of a server. minimum: 1 + * + * @return vcpus + */ + @javax.annotation.Nonnull + public Long getVcpus() { + return vcpus; + } + + public void setVcpus(@javax.annotation.Nonnull Long vcpus) { + this.vcpus = vcpus; + } + + /** + * 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 MachineType instance itself + */ + public MachineType 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; + } + MachineType machineType = (MachineType) o; + return Objects.equals(this.description, machineType.description) + && Objects.equals(this.disk, machineType.disk) + && Objects.equals(this.extraSpecs, machineType.extraSpecs) + && Objects.equals(this.name, machineType.name) + && Objects.equals(this.ram, machineType.ram) + && Objects.equals(this.vcpus, machineType.vcpus) + && Objects.equals(this.additionalProperties, machineType.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(description, disk, extraSpecs, name, ram, vcpus, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MachineType {\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" disk: ").append(toIndentedString(disk)).append("\n"); + sb.append(" extraSpecs: ").append(toIndentedString(extraSpecs)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" ram: ").append(toIndentedString(ram)).append("\n"); + sb.append(" vcpus: ").append(toIndentedString(vcpus)).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("description", "disk", "extraSpecs", "name", "ram", "vcpus")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("disk", "name", "ram", "vcpus")); + } + + /** + * 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 MachineType + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MachineType.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 MachineType is not found in the empty JSON string", + MachineType.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : MachineType.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("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `description` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("description").toString())); + } + if (!jsonObj.get("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())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MachineType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MachineType' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(MachineType.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, MachineType 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 MachineType read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + MachineType 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 MachineType given an JSON string + * + * @param jsonString JSON string + * @return An instance of MachineType + * @throws IOException if the JSON string is invalid with respect to MachineType + */ + public static MachineType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MachineType.class); + } + + /** + * Convert an instance of MachineType to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/MachineTypeListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/MachineTypeListResponse.java new file mode 100644 index 00000000..13636405 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/MachineTypeListResponse.java @@ -0,0 +1,327 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** Machine type list response. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class MachineTypeListResponse { + public static final String SERIALIZED_NAME_ITEMS = "items"; + + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public MachineTypeListResponse() {} + + public MachineTypeListResponse items(@javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public MachineTypeListResponse addItemsItem(MachineType itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * Machine type list. + * + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the MachineTypeListResponse instance itself + */ + public MachineTypeListResponse 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; + } + MachineTypeListResponse machineTypeListResponse = (MachineTypeListResponse) o; + return Objects.equals(this.items, machineTypeListResponse.items) + && Objects.equals( + this.additionalProperties, machineTypeListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MachineTypeListResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("items")); + } + + /** + * 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 MachineTypeListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MachineTypeListResponse.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 MachineTypeListResponse is not found in the empty JSON string", + MachineTypeListResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : MachineTypeListResponse.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("items").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `items` to be an array in the JSON string but got `%s`", + jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + MachineType.validateJsonElement(jsonArrayitems.get(i)); + } + ; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MachineTypeListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MachineTypeListResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(MachineTypeListResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, MachineTypeListResponse 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 MachineTypeListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + MachineTypeListResponse 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 MachineTypeListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of MachineTypeListResponse + * @throws IOException if the JSON string is invalid with respect to MachineTypeListResponse + */ + public static MachineTypeListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MachineTypeListResponse.class); + } + + /** + * Convert an instance of MachineTypeListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/NIC.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/NIC.java new file mode 100644 index 00000000..f1b88d5a --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/NIC.java @@ -0,0 +1,733 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; +import java.util.UUID; + +/** Object that represents a network interface. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class NIC { + public static final String SERIALIZED_NAME_ALLOWED_ADDRESSES = "allowedAddresses"; + + @SerializedName(SERIALIZED_NAME_ALLOWED_ADDRESSES) + @javax.annotation.Nullable private List allowedAddresses = new ArrayList<>(); + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable private String description; + + public static final String SERIALIZED_NAME_DEVICE = "device"; + + @SerializedName(SERIALIZED_NAME_DEVICE) + @javax.annotation.Nullable private UUID device; + + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_IPV4 = "ipv4"; + + @SerializedName(SERIALIZED_NAME_IPV4) + @javax.annotation.Nullable private String ipv4; + + public static final String SERIALIZED_NAME_IPV6 = "ipv6"; + + @SerializedName(SERIALIZED_NAME_IPV6) + @javax.annotation.Nullable private String ipv6; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_MAC = "mac"; + + @SerializedName(SERIALIZED_NAME_MAC) + @javax.annotation.Nullable private String mac; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; + + public static final String SERIALIZED_NAME_NETWORK_ID = "networkId"; + + @SerializedName(SERIALIZED_NAME_NETWORK_ID) + @javax.annotation.Nullable private UUID networkId; + + public static final String SERIALIZED_NAME_NIC_SECURITY = "nicSecurity"; + + @SerializedName(SERIALIZED_NAME_NIC_SECURITY) + @javax.annotation.Nullable private Boolean nicSecurity = true; + + public static final String SERIALIZED_NAME_SECURITY_GROUPS = "securityGroups"; + + @SerializedName(SERIALIZED_NAME_SECURITY_GROUPS) + @javax.annotation.Nullable private List securityGroups = new ArrayList<>(); + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable private String status; + + public static final String SERIALIZED_NAME_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable private String type; + + public NIC() {} + + public NIC(UUID device, UUID id, String mac, UUID networkId, String status, String type) { + this(); + this.device = device; + this.id = id; + this.mac = mac; + this.networkId = networkId; + this.status = status; + this.type = type; + } + + public NIC allowedAddresses( + @javax.annotation.Nullable List allowedAddresses) { + this.allowedAddresses = allowedAddresses; + return this; + } + + public NIC addAllowedAddressesItem(AllowedAddressesInner allowedAddressesItem) { + if (this.allowedAddresses == null) { + this.allowedAddresses = new ArrayList<>(); + } + this.allowedAddresses.add(allowedAddressesItem); + return this; + } + + /** + * A list of IPs or CIDR notations. + * + * @return allowedAddresses + */ + @javax.annotation.Nullable public List getAllowedAddresses() { + return allowedAddresses; + } + + public void setAllowedAddresses( + @javax.annotation.Nullable List allowedAddresses) { + this.allowedAddresses = allowedAddresses; + } + + public NIC description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Description Object. Allows string up to 255 Characters. + * + * @return description + */ + @javax.annotation.Nullable public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return device + */ + @javax.annotation.Nullable public UUID getDevice() { + return device; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + public NIC ipv4(@javax.annotation.Nullable String ipv4) { + this.ipv4 = ipv4; + return this; + } + + /** + * Object that represents an IP address. + * + * @return ipv4 + */ + @javax.annotation.Nullable public String getIpv4() { + return ipv4; + } + + public void setIpv4(@javax.annotation.Nullable String ipv4) { + this.ipv4 = ipv4; + } + + public NIC ipv6(@javax.annotation.Nullable String ipv6) { + this.ipv6 = ipv6; + return this; + } + + /** + * String that represents an IPv6 address. + * + * @return ipv6 + */ + @javax.annotation.Nullable public String getIpv6() { + return ipv6; + } + + public void setIpv6(@javax.annotation.Nullable String ipv6) { + this.ipv6 = ipv6; + } + + public NIC labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + /** + * Object that represents an MAC address. + * + * @return mac + */ + @javax.annotation.Nullable public String getMac() { + return mac; + } + + public NIC name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nullable public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return networkId + */ + @javax.annotation.Nullable public UUID getNetworkId() { + return networkId; + } + + public NIC nicSecurity(@javax.annotation.Nullable Boolean nicSecurity) { + this.nicSecurity = nicSecurity; + return this; + } + + /** + * If this is set to false, then no security groups will apply to this network interface. + * + * @return nicSecurity + */ + @javax.annotation.Nullable public Boolean getNicSecurity() { + return nicSecurity; + } + + public void setNicSecurity(@javax.annotation.Nullable Boolean nicSecurity) { + this.nicSecurity = nicSecurity; + } + + public NIC securityGroups(@javax.annotation.Nullable List securityGroups) { + this.securityGroups = securityGroups; + return this; + } + + public NIC addSecurityGroupsItem(UUID securityGroupsItem) { + if (this.securityGroups == null) { + this.securityGroups = new ArrayList<>(); + } + this.securityGroups.add(securityGroupsItem); + return this; + } + + /** + * A list of UUIDs. + * + * @return securityGroups + */ + @javax.annotation.Nullable public List getSecurityGroups() { + return securityGroups; + } + + public void setSecurityGroups(@javax.annotation.Nullable List securityGroups) { + this.securityGroups = securityGroups; + } + + /** + * Possible values: `ACTIVE`, `DOWN`. + * + * @return status + */ + @javax.annotation.Nullable public String getStatus() { + return status; + } + + /** + * Possible values: `server`, `metadata`, `gateway`, + * `none`. + * + * @return type + */ + @javax.annotation.Nullable public String getType() { + return 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 NIC instance itself + */ + public NIC 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; + } + NIC NIC = (NIC) o; + return Objects.equals(this.allowedAddresses, NIC.allowedAddresses) + && Objects.equals(this.description, NIC.description) + && Objects.equals(this.device, NIC.device) + && Objects.equals(this.id, NIC.id) + && Objects.equals(this.ipv4, NIC.ipv4) + && Objects.equals(this.ipv6, NIC.ipv6) + && Objects.equals(this.labels, NIC.labels) + && Objects.equals(this.mac, NIC.mac) + && Objects.equals(this.name, NIC.name) + && Objects.equals(this.networkId, NIC.networkId) + && Objects.equals(this.nicSecurity, NIC.nicSecurity) + && Objects.equals(this.securityGroups, NIC.securityGroups) + && Objects.equals(this.status, NIC.status) + && Objects.equals(this.type, NIC.type) + && Objects.equals(this.additionalProperties, NIC.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + allowedAddresses, + description, + device, + id, + ipv4, + ipv6, + labels, + mac, + name, + networkId, + nicSecurity, + securityGroups, + status, + type, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NIC {\n"); + sb.append(" allowedAddresses: ").append(toIndentedString(allowedAddresses)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" device: ").append(toIndentedString(device)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" ipv4: ").append(toIndentedString(ipv4)).append("\n"); + sb.append(" ipv6: ").append(toIndentedString(ipv6)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" mac: ").append(toIndentedString(mac)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" networkId: ").append(toIndentedString(networkId)).append("\n"); + sb.append(" nicSecurity: ").append(toIndentedString(nicSecurity)).append("\n"); + sb.append(" securityGroups: ").append(toIndentedString(securityGroups)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).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( + "allowedAddresses", + "description", + "device", + "id", + "ipv4", + "ipv6", + "labels", + "mac", + "name", + "networkId", + "nicSecurity", + "securityGroups", + "status", + "type")); + + // 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 NIC + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NIC.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 NIC is not found in the empty JSON string", + NIC.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("allowedAddresses") != null + && !jsonObj.get("allowedAddresses").isJsonNull()) { + JsonArray jsonArrayallowedAddresses = jsonObj.getAsJsonArray("allowedAddresses"); + if (jsonArrayallowedAddresses != null) { + // ensure the json data is an array + if (!jsonObj.get("allowedAddresses").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `allowedAddresses` to be an array in the JSON string but got `%s`", + jsonObj.get("allowedAddresses").toString())); + } + + // validate the optional field `allowedAddresses` (array) + for (int i = 0; i < jsonArrayallowedAddresses.size(); i++) { + AllowedAddressesInner.validateJsonElement(jsonArrayallowedAddresses.get(i)); + } + ; + } + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `description` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("description").toString())); + } + if ((jsonObj.get("device") != null && !jsonObj.get("device").isJsonNull()) + && !jsonObj.get("device").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `device` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("device").toString())); + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if ((jsonObj.get("ipv4") != null && !jsonObj.get("ipv4").isJsonNull()) + && !jsonObj.get("ipv4").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `ipv4` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("ipv4").toString())); + } + if ((jsonObj.get("ipv6") != null && !jsonObj.get("ipv6").isJsonNull()) + && !jsonObj.get("ipv6").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `ipv6` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("ipv6").toString())); + } + if ((jsonObj.get("mac") != null && !jsonObj.get("mac").isJsonNull()) + && !jsonObj.get("mac").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `mac` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("mac").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `name` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("name").toString())); + } + if ((jsonObj.get("networkId") != null && !jsonObj.get("networkId").isJsonNull()) + && !jsonObj.get("networkId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `networkId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("networkId").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("securityGroups") != null + && !jsonObj.get("securityGroups").isJsonNull() + && !jsonObj.get("securityGroups").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `securityGroups` to be an array in the JSON string but got `%s`", + jsonObj.get("securityGroups").toString())); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) + && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `status` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("status").toString())); + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) + && !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 (!NIC.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NIC' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(NIC.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, NIC 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 NIC read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + NIC 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 NIC given an JSON string + * + * @param jsonString JSON string + * @return An instance of NIC + * @throws IOException if the JSON string is invalid with respect to NIC + */ + public static NIC fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NIC.class); + } + + /** + * Convert an instance of NIC to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/NICListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/NICListResponse.java new file mode 100644 index 00000000..2e5cad17 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/NICListResponse.java @@ -0,0 +1,325 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** NIC list response. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class NICListResponse { + public static final String SERIALIZED_NAME_ITEMS = "items"; + + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public NICListResponse() {} + + public NICListResponse items(@javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public NICListResponse addItemsItem(NIC itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list of network interfaces. + * + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NICListResponse instance itself + */ + public NICListResponse 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; + } + NICListResponse niCListResponse = (NICListResponse) o; + return Objects.equals(this.items, niCListResponse.items) + && Objects.equals(this.additionalProperties, niCListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NICListResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("items")); + } + + /** + * 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 NICListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NICListResponse.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 NICListResponse is not found in the empty JSON string", + NICListResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : NICListResponse.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("items").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `items` to be an array in the JSON string but got `%s`", + jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + NIC.validateJsonElement(jsonArrayitems.get(i)); + } + ; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!NICListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NICListResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(NICListResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, NICListResponse 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 NICListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + NICListResponse 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 NICListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of NICListResponse + * @throws IOException if the JSON string is invalid with respect to NICListResponse + */ + public static NICListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NICListResponse.class); + } + + /** + * Convert an instance of NICListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/Network.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/Network.java new file mode 100644 index 00000000..a0196a55 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/Network.java @@ -0,0 +1,614 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; +import java.util.UUID; + +/** + * Object that represents a network. If no routing table is specified, the default routing table is + * used. + */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class Network { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_DHCP = "dhcp"; + + @SerializedName(SERIALIZED_NAME_DHCP) + @javax.annotation.Nullable private Boolean dhcp; + + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private UUID id; + + public static final String SERIALIZED_NAME_IPV4 = "ipv4"; + + @SerializedName(SERIALIZED_NAME_IPV4) + @javax.annotation.Nullable private NetworkIPv4 ipv4; + + public static final String SERIALIZED_NAME_IPV6 = "ipv6"; + + @SerializedName(SERIALIZED_NAME_IPV6) + @javax.annotation.Nullable private NetworkIPv6 ipv6; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_ROUTED = "routed"; + + @SerializedName(SERIALIZED_NAME_ROUTED) + @javax.annotation.Nullable private Boolean routed; + + public static final String SERIALIZED_NAME_ROUTING_TABLE_ID = "routingTableId"; + + @SerializedName(SERIALIZED_NAME_ROUTING_TABLE_ID) + @javax.annotation.Nullable private UUID routingTableId; + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nonnull + private String status; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable private OffsetDateTime updatedAt; + + public Network() {} + + public Network(OffsetDateTime createdAt, OffsetDateTime updatedAt) { + this(); + this.createdAt = createdAt; + this.updatedAt = updatedAt; + } + + /** + * Date-time when resource was created. + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public Network dhcp(@javax.annotation.Nullable Boolean dhcp) { + this.dhcp = dhcp; + return this; + } + + /** + * Enable or disable DHCP for a network. + * + * @return dhcp + */ + @javax.annotation.Nullable public Boolean getDhcp() { + return dhcp; + } + + public void setDhcp(@javax.annotation.Nullable Boolean dhcp) { + this.dhcp = dhcp; + } + + public Network id(@javax.annotation.Nonnull UUID id) { + this.id = id; + return this; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nonnull + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull UUID id) { + this.id = id; + } + + public Network ipv4(@javax.annotation.Nullable NetworkIPv4 ipv4) { + this.ipv4 = ipv4; + return this; + } + + /** + * Get ipv4 + * + * @return ipv4 + */ + @javax.annotation.Nullable public NetworkIPv4 getIpv4() { + return ipv4; + } + + public void setIpv4(@javax.annotation.Nullable NetworkIPv4 ipv4) { + this.ipv4 = ipv4; + } + + public Network ipv6(@javax.annotation.Nullable NetworkIPv6 ipv6) { + this.ipv6 = ipv6; + return this; + } + + /** + * Get ipv6 + * + * @return ipv6 + */ + @javax.annotation.Nullable public NetworkIPv6 getIpv6() { + return ipv6; + } + + public void setIpv6(@javax.annotation.Nullable NetworkIPv6 ipv6) { + this.ipv6 = ipv6; + } + + public Network labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public Network 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 Network routed(@javax.annotation.Nullable Boolean routed) { + this.routed = routed; + return this; + } + + /** + * Shows if the network is routed and therefore accessible from other networks. + * + * @return routed + */ + @javax.annotation.Nullable public Boolean getRouted() { + return routed; + } + + public void setRouted(@javax.annotation.Nullable Boolean routed) { + this.routed = routed; + } + + public Network routingTableId(@javax.annotation.Nullable UUID routingTableId) { + this.routingTableId = routingTableId; + return this; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return routingTableId + */ + @javax.annotation.Nullable public UUID getRoutingTableId() { + return routingTableId; + } + + public void setRoutingTableId(@javax.annotation.Nullable UUID routingTableId) { + this.routingTableId = routingTableId; + } + + public Network status(@javax.annotation.Nonnull String status) { + this.status = status; + return this; + } + + /** + * The state of a resource object. Possible values: `CREATING`, `CREATED`, + * `DELETING`, `DELETED`, `FAILED`, `UPDATED`, + * `UPDATING`. + * + * @return status + */ + @javax.annotation.Nonnull + public String getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nonnull String status) { + this.status = status; + } + + /** + * Date-time when resource was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nullable public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * 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 Network instance itself + */ + public Network 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; + } + Network network = (Network) o; + return Objects.equals(this.createdAt, network.createdAt) + && Objects.equals(this.dhcp, network.dhcp) + && Objects.equals(this.id, network.id) + && Objects.equals(this.ipv4, network.ipv4) + && Objects.equals(this.ipv6, network.ipv6) + && Objects.equals(this.labels, network.labels) + && Objects.equals(this.name, network.name) + && Objects.equals(this.routed, network.routed) + && Objects.equals(this.routingTableId, network.routingTableId) + && Objects.equals(this.status, network.status) + && Objects.equals(this.updatedAt, network.updatedAt) + && Objects.equals(this.additionalProperties, network.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + createdAt, + dhcp, + id, + ipv4, + ipv6, + labels, + name, + routed, + routingTableId, + status, + updatedAt, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Network {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" dhcp: ").append(toIndentedString(dhcp)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" ipv4: ").append(toIndentedString(ipv4)).append("\n"); + sb.append(" ipv6: ").append(toIndentedString(ipv6)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" routed: ").append(toIndentedString(routed)).append("\n"); + sb.append(" routingTableId: ").append(toIndentedString(routingTableId)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).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( + "createdAt", + "dhcp", + "id", + "ipv4", + "ipv6", + "labels", + "name", + "routed", + "routingTableId", + "status", + "updatedAt")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("id", "name", "status")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Network + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Network.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 Network is not found in the empty JSON string", + Network.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Network.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("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + // validate the optional field `ipv4` + if (jsonObj.get("ipv4") != null && !jsonObj.get("ipv4").isJsonNull()) { + NetworkIPv4.validateJsonElement(jsonObj.get("ipv4")); + } + // validate the optional field `ipv6` + if (jsonObj.get("ipv6") != null && !jsonObj.get("ipv6").isJsonNull()) { + NetworkIPv6.validateJsonElement(jsonObj.get("ipv6")); + } + 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("routingTableId") != null && !jsonObj.get("routingTableId").isJsonNull()) + && !jsonObj.get("routingTableId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `routingTableId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("routingTableId").toString())); + } + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `status` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("status").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Network.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Network' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(Network.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, Network 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 Network read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Network 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 Network given an JSON string + * + * @param jsonString JSON string + * @return An instance of Network + * @throws IOException if the JSON string is invalid with respect to Network + */ + public static Network fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Network.class); + } + + /** + * Convert an instance of Network to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/NetworkArea.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/NetworkArea.java new file mode 100644 index 00000000..db7cece1 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/NetworkArea.java @@ -0,0 +1,422 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; +import java.util.UUID; + +/** Object that represents a network area. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class NetworkArea { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_PROJECT_COUNT = "projectCount"; + + @SerializedName(SERIALIZED_NAME_PROJECT_COUNT) + @javax.annotation.Nullable private Long projectCount; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable private OffsetDateTime updatedAt; + + public NetworkArea() {} + + public NetworkArea( + OffsetDateTime createdAt, UUID id, Long projectCount, OffsetDateTime updatedAt) { + this(); + this.createdAt = createdAt; + this.id = id; + this.projectCount = projectCount; + this.updatedAt = updatedAt; + } + + /** + * Date-time when resource was created. + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + public NetworkArea labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public NetworkArea 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; + } + + /** + * The amount of projects currently referencing a specific area. minimum: 0 + * + * @return projectCount + */ + @javax.annotation.Nullable public Long getProjectCount() { + return projectCount; + } + + /** + * Date-time when resource was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nullable public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * 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 NetworkArea instance itself + */ + public NetworkArea 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; + } + NetworkArea networkArea = (NetworkArea) o; + return Objects.equals(this.createdAt, networkArea.createdAt) + && Objects.equals(this.id, networkArea.id) + && Objects.equals(this.labels, networkArea.labels) + && Objects.equals(this.name, networkArea.name) + && Objects.equals(this.projectCount, networkArea.projectCount) + && Objects.equals(this.updatedAt, networkArea.updatedAt) + && Objects.equals(this.additionalProperties, networkArea.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + createdAt, id, labels, name, projectCount, updatedAt, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NetworkArea {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" projectCount: ").append(toIndentedString(projectCount)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).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( + "createdAt", "id", "labels", "name", "projectCount", "updatedAt")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name")); + } + + /** + * 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 NetworkArea + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NetworkArea.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 NetworkArea is not found in the empty JSON string", + NetworkArea.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : NetworkArea.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("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if (!jsonObj.get("name").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())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!NetworkArea.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NetworkArea' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(NetworkArea.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, NetworkArea 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 NetworkArea read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + NetworkArea 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 NetworkArea given an JSON string + * + * @param jsonString JSON string + * @return An instance of NetworkArea + * @throws IOException if the JSON string is invalid with respect to NetworkArea + */ + public static NetworkArea fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NetworkArea.class); + } + + /** + * Convert an instance of NetworkArea to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/NetworkAreaListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/NetworkAreaListResponse.java new file mode 100644 index 00000000..5472b738 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/NetworkAreaListResponse.java @@ -0,0 +1,327 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** Network area list response. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class NetworkAreaListResponse { + public static final String SERIALIZED_NAME_ITEMS = "items"; + + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public NetworkAreaListResponse() {} + + public NetworkAreaListResponse items(@javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public NetworkAreaListResponse addItemsItem(NetworkArea itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list of network areas. + * + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NetworkAreaListResponse instance itself + */ + public NetworkAreaListResponse 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; + } + NetworkAreaListResponse networkAreaListResponse = (NetworkAreaListResponse) o; + return Objects.equals(this.items, networkAreaListResponse.items) + && Objects.equals( + this.additionalProperties, networkAreaListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NetworkAreaListResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("items")); + } + + /** + * 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 NetworkAreaListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NetworkAreaListResponse.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 NetworkAreaListResponse is not found in the empty JSON string", + NetworkAreaListResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : NetworkAreaListResponse.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("items").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `items` to be an array in the JSON string but got `%s`", + jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + NetworkArea.validateJsonElement(jsonArrayitems.get(i)); + } + ; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!NetworkAreaListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NetworkAreaListResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(NetworkAreaListResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, NetworkAreaListResponse 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 NetworkAreaListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + NetworkAreaListResponse 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 NetworkAreaListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of NetworkAreaListResponse + * @throws IOException if the JSON string is invalid with respect to NetworkAreaListResponse + */ + public static NetworkAreaListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NetworkAreaListResponse.class); + } + + /** + * Convert an instance of NetworkAreaListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/NetworkIPv4.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/NetworkIPv4.java new file mode 100644 index 00000000..41d71075 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/NetworkIPv4.java @@ -0,0 +1,444 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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.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; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Object that represents the IPv4 part of a network. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class NetworkIPv4 { + public static final String SERIALIZED_NAME_GATEWAY = "gateway"; + + @SerializedName(SERIALIZED_NAME_GATEWAY) + @javax.annotation.Nullable private String gateway; + + public static final String SERIALIZED_NAME_NAMESERVERS = "nameservers"; + + @SerializedName(SERIALIZED_NAME_NAMESERVERS) + @javax.annotation.Nullable private List nameservers = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PREFIXES = "prefixes"; + + @SerializedName(SERIALIZED_NAME_PREFIXES) + @javax.annotation.Nonnull + private List prefixes = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PUBLIC_IP = "publicIp"; + + @SerializedName(SERIALIZED_NAME_PUBLIC_IP) + @javax.annotation.Nullable private String publicIp; + + public NetworkIPv4() {} + + public NetworkIPv4(String publicIp) { + this(); + this.publicIp = publicIp; + } + + public NetworkIPv4 gateway(@javax.annotation.Nullable String gateway) { + this.gateway = gateway; + return this; + } + + /** + * The IPv4 gateway of a network. If not specified the first IP of the network will be assigned + * as the gateway. If 'null' is sent, then the network doesn't have a gateway. + * + * @return gateway + */ + @javax.annotation.Nullable public String getGateway() { + return gateway; + } + + public void setGateway(@javax.annotation.Nullable String gateway) { + this.gateway = gateway; + } + + public NetworkIPv4 nameservers(@javax.annotation.Nullable List nameservers) { + this.nameservers = nameservers; + return this; + } + + public NetworkIPv4 addNameserversItem(String nameserversItem) { + if (this.nameservers == null) { + this.nameservers = new ArrayList<>(); + } + this.nameservers.add(nameserversItem); + return this; + } + + /** + * A list containing DNS Servers/Nameservers for IPv4. + * + * @return nameservers + */ + @javax.annotation.Nullable public List getNameservers() { + return nameservers; + } + + public void setNameservers(@javax.annotation.Nullable List nameservers) { + this.nameservers = nameservers; + } + + public NetworkIPv4 prefixes(@javax.annotation.Nonnull List prefixes) { + this.prefixes = prefixes; + return this; + } + + public NetworkIPv4 addPrefixesItem(String prefixesItem) { + if (this.prefixes == null) { + this.prefixes = new ArrayList<>(); + } + this.prefixes.add(prefixesItem); + return this; + } + + /** + * Get prefixes + * + * @return prefixes + */ + @javax.annotation.Nonnull + public List getPrefixes() { + return prefixes; + } + + public void setPrefixes(@javax.annotation.Nonnull List prefixes) { + this.prefixes = prefixes; + } + + /** + * String that represents an IPv4 address. + * + * @return publicIp + */ + @javax.annotation.Nullable public String getPublicIp() { + return publicIp; + } + + /** + * 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 NetworkIPv4 instance itself + */ + public NetworkIPv4 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; + } + NetworkIPv4 networkIPv4 = (NetworkIPv4) o; + return Objects.equals(this.gateway, networkIPv4.gateway) + && Objects.equals(this.nameservers, networkIPv4.nameservers) + && Objects.equals(this.prefixes, networkIPv4.prefixes) + && Objects.equals(this.publicIp, networkIPv4.publicIp) + && Objects.equals(this.additionalProperties, networkIPv4.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(gateway, nameservers, prefixes, publicIp, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NetworkIPv4 {\n"); + sb.append(" gateway: ").append(toIndentedString(gateway)).append("\n"); + sb.append(" nameservers: ").append(toIndentedString(nameservers)).append("\n"); + sb.append(" prefixes: ").append(toIndentedString(prefixes)).append("\n"); + sb.append(" publicIp: ").append(toIndentedString(publicIp)).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("gateway", "nameservers", "prefixes", "publicIp")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("prefixes")); + } + + /** + * 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 NetworkIPv4 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NetworkIPv4.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 NetworkIPv4 is not found in the empty JSON string", + NetworkIPv4.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : NetworkIPv4.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("gateway") != null && !jsonObj.get("gateway").isJsonNull()) + && !jsonObj.get("gateway").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `gateway` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("gateway").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("nameservers") != null + && !jsonObj.get("nameservers").isJsonNull() + && !jsonObj.get("nameservers").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `nameservers` to be an array in the JSON string but got `%s`", + jsonObj.get("nameservers").toString())); + } + // ensure the required json array is present + if (jsonObj.get("prefixes") == null) { + throw new IllegalArgumentException( + "Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("prefixes").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `prefixes` to be an array in the JSON string but got `%s`", + jsonObj.get("prefixes").toString())); + } + if ((jsonObj.get("publicIp") != null && !jsonObj.get("publicIp").isJsonNull()) + && !jsonObj.get("publicIp").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `publicIp` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("publicIp").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!NetworkIPv4.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NetworkIPv4' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(NetworkIPv4.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, NetworkIPv4 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 NetworkIPv4 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + NetworkIPv4 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 NetworkIPv4 given an JSON string + * + * @param jsonString JSON string + * @return An instance of NetworkIPv4 + * @throws IOException if the JSON string is invalid with respect to NetworkIPv4 + */ + public static NetworkIPv4 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NetworkIPv4.class); + } + + /** + * Convert an instance of NetworkIPv4 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/NetworkIPv6.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/NetworkIPv6.java new file mode 100644 index 00000000..6240b713 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/NetworkIPv6.java @@ -0,0 +1,413 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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.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; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Object that represents the IPv6 part of a network. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class NetworkIPv6 { + public static final String SERIALIZED_NAME_GATEWAY = "gateway"; + + @SerializedName(SERIALIZED_NAME_GATEWAY) + @javax.annotation.Nullable private String gateway; + + public static final String SERIALIZED_NAME_NAMESERVERS = "nameservers"; + + @SerializedName(SERIALIZED_NAME_NAMESERVERS) + @javax.annotation.Nullable private List nameservers = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PREFIXES = "prefixes"; + + @SerializedName(SERIALIZED_NAME_PREFIXES) + @javax.annotation.Nonnull + private List prefixes = new ArrayList<>(); + + public NetworkIPv6() {} + + public NetworkIPv6 gateway(@javax.annotation.Nullable String gateway) { + this.gateway = gateway; + return this; + } + + /** + * The IPv6 gateway of a network. If not specified the first IP of the network will be assigned + * as the gateway. If 'null' is sent, then the network doesn't have a gateway. + * + * @return gateway + */ + @javax.annotation.Nullable public String getGateway() { + return gateway; + } + + public void setGateway(@javax.annotation.Nullable String gateway) { + this.gateway = gateway; + } + + public NetworkIPv6 nameservers(@javax.annotation.Nullable List nameservers) { + this.nameservers = nameservers; + return this; + } + + public NetworkIPv6 addNameserversItem(String nameserversItem) { + if (this.nameservers == null) { + this.nameservers = new ArrayList<>(); + } + this.nameservers.add(nameserversItem); + return this; + } + + /** + * A list containing DNS Servers/Nameservers for IPv6. + * + * @return nameservers + */ + @javax.annotation.Nullable public List getNameservers() { + return nameservers; + } + + public void setNameservers(@javax.annotation.Nullable List nameservers) { + this.nameservers = nameservers; + } + + public NetworkIPv6 prefixes(@javax.annotation.Nonnull List prefixes) { + this.prefixes = prefixes; + return this; + } + + public NetworkIPv6 addPrefixesItem(String prefixesItem) { + if (this.prefixes == null) { + this.prefixes = new ArrayList<>(); + } + this.prefixes.add(prefixesItem); + return this; + } + + /** + * Get prefixes + * + * @return prefixes + */ + @javax.annotation.Nonnull + public List getPrefixes() { + return prefixes; + } + + public void setPrefixes(@javax.annotation.Nonnull List prefixes) { + this.prefixes = prefixes; + } + + /** + * 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 NetworkIPv6 instance itself + */ + public NetworkIPv6 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; + } + NetworkIPv6 networkIPv6 = (NetworkIPv6) o; + return Objects.equals(this.gateway, networkIPv6.gateway) + && Objects.equals(this.nameservers, networkIPv6.nameservers) + && Objects.equals(this.prefixes, networkIPv6.prefixes) + && Objects.equals(this.additionalProperties, networkIPv6.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(gateway, nameservers, prefixes, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NetworkIPv6 {\n"); + sb.append(" gateway: ").append(toIndentedString(gateway)).append("\n"); + sb.append(" nameservers: ").append(toIndentedString(nameservers)).append("\n"); + sb.append(" prefixes: ").append(toIndentedString(prefixes)).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("gateway", "nameservers", "prefixes")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("prefixes")); + } + + /** + * 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 NetworkIPv6 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NetworkIPv6.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 NetworkIPv6 is not found in the empty JSON string", + NetworkIPv6.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : NetworkIPv6.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("gateway") != null && !jsonObj.get("gateway").isJsonNull()) + && !jsonObj.get("gateway").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `gateway` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("gateway").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("nameservers") != null + && !jsonObj.get("nameservers").isJsonNull() + && !jsonObj.get("nameservers").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `nameservers` to be an array in the JSON string but got `%s`", + jsonObj.get("nameservers").toString())); + } + // ensure the required json array is present + if (jsonObj.get("prefixes") == null) { + throw new IllegalArgumentException( + "Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("prefixes").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `prefixes` to be an array in the JSON string but got `%s`", + jsonObj.get("prefixes").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!NetworkIPv6.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NetworkIPv6' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(NetworkIPv6.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, NetworkIPv6 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 NetworkIPv6 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + NetworkIPv6 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 NetworkIPv6 given an JSON string + * + * @param jsonString JSON string + * @return An instance of NetworkIPv6 + * @throws IOException if the JSON string is invalid with respect to NetworkIPv6 + */ + public static NetworkIPv6 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NetworkIPv6.class); + } + + /** + * Convert an instance of NetworkIPv6 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/NetworkListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/NetworkListResponse.java new file mode 100644 index 00000000..2bff6c50 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/NetworkListResponse.java @@ -0,0 +1,326 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** Network list response. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class NetworkListResponse { + public static final String SERIALIZED_NAME_ITEMS = "items"; + + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public NetworkListResponse() {} + + public NetworkListResponse items(@javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public NetworkListResponse addItemsItem(Network itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list of networks. + * + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NetworkListResponse instance itself + */ + public NetworkListResponse 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; + } + NetworkListResponse networkListResponse = (NetworkListResponse) o; + return Objects.equals(this.items, networkListResponse.items) + && Objects.equals( + this.additionalProperties, networkListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NetworkListResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("items")); + } + + /** + * 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 NetworkListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NetworkListResponse.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 NetworkListResponse is not found in the empty JSON string", + NetworkListResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : NetworkListResponse.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("items").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `items` to be an array in the JSON string but got `%s`", + jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + Network.validateJsonElement(jsonArrayitems.get(i)); + } + ; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!NetworkListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NetworkListResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(NetworkListResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, NetworkListResponse 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 NetworkListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + NetworkListResponse 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 NetworkListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of NetworkListResponse + * @throws IOException if the JSON string is invalid with respect to NetworkListResponse + */ + public static NetworkListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NetworkListResponse.class); + } + + /** + * Convert an instance of NetworkListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/NetworkRange.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/NetworkRange.java new file mode 100644 index 00000000..5624dd5d --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/NetworkRange.java @@ -0,0 +1,372 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; +import java.util.UUID; + +/** Object that represents a network range. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class NetworkRange { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_PREFIX = "prefix"; + + @SerializedName(SERIALIZED_NAME_PREFIX) + @javax.annotation.Nonnull + private String prefix; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable private OffsetDateTime updatedAt; + + public NetworkRange() {} + + public NetworkRange(OffsetDateTime createdAt, UUID id, OffsetDateTime updatedAt) { + this(); + this.createdAt = createdAt; + this.id = id; + this.updatedAt = updatedAt; + } + + /** + * Date-time when resource was created. + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + public NetworkRange prefix(@javax.annotation.Nonnull String prefix) { + this.prefix = prefix; + return this; + } + + /** + * Classless Inter-Domain Routing (CIDR). + * + * @return prefix + */ + @javax.annotation.Nonnull + public String getPrefix() { + return prefix; + } + + public void setPrefix(@javax.annotation.Nonnull String prefix) { + this.prefix = prefix; + } + + /** + * Date-time when resource was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nullable public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * 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 NetworkRange instance itself + */ + public NetworkRange 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; + } + NetworkRange networkRange = (NetworkRange) o; + return Objects.equals(this.createdAt, networkRange.createdAt) + && Objects.equals(this.id, networkRange.id) + && Objects.equals(this.prefix, networkRange.prefix) + && Objects.equals(this.updatedAt, networkRange.updatedAt) + && Objects.equals(this.additionalProperties, networkRange.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, id, prefix, updatedAt, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NetworkRange {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" prefix: ").append(toIndentedString(prefix)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).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("createdAt", "id", "prefix", "updatedAt")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("prefix")); + } + + /** + * 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 NetworkRange + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NetworkRange.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 NetworkRange is not found in the empty JSON string", + NetworkRange.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : NetworkRange.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("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if (!jsonObj.get("prefix").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `prefix` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("prefix").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!NetworkRange.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NetworkRange' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(NetworkRange.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, NetworkRange 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 NetworkRange read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + NetworkRange 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 NetworkRange given an JSON string + * + * @param jsonString JSON string + * @return An instance of NetworkRange + * @throws IOException if the JSON string is invalid with respect to NetworkRange + */ + public static NetworkRange fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NetworkRange.class); + } + + /** + * Convert an instance of NetworkRange to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/NetworkRangeListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/NetworkRangeListResponse.java new file mode 100644 index 00000000..c6ee9f40 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/NetworkRangeListResponse.java @@ -0,0 +1,327 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** Network Range list response. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class NetworkRangeListResponse { + public static final String SERIALIZED_NAME_ITEMS = "items"; + + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public NetworkRangeListResponse() {} + + public NetworkRangeListResponse items(@javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public NetworkRangeListResponse addItemsItem(NetworkRange itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list of network ranges. + * + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the NetworkRangeListResponse instance itself + */ + public NetworkRangeListResponse 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; + } + NetworkRangeListResponse networkRangeListResponse = (NetworkRangeListResponse) o; + return Objects.equals(this.items, networkRangeListResponse.items) + && Objects.equals( + this.additionalProperties, networkRangeListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NetworkRangeListResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("items")); + } + + /** + * 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 NetworkRangeListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NetworkRangeListResponse.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 NetworkRangeListResponse is not found in the empty JSON string", + NetworkRangeListResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : NetworkRangeListResponse.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("items").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `items` to be an array in the JSON string but got `%s`", + jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + NetworkRange.validateJsonElement(jsonArrayitems.get(i)); + } + ; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!NetworkRangeListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NetworkRangeListResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(NetworkRangeListResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, NetworkRangeListResponse 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 NetworkRangeListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + NetworkRangeListResponse 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 NetworkRangeListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of NetworkRangeListResponse + * @throws IOException if the JSON string is invalid with respect to NetworkRangeListResponse + */ + public static NetworkRangeListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NetworkRangeListResponse.class); + } + + /** + * Convert an instance of NetworkRangeListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/NexthopBlackhole.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/NexthopBlackhole.java new file mode 100644 index 00000000..56c669a2 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/NexthopBlackhole.java @@ -0,0 +1,307 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** Object that represents a blackhole route. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class NexthopBlackhole { + public static final String SERIALIZED_NAME_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private String type; + + public NexthopBlackhole() {} + + public NexthopBlackhole 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 NexthopBlackhole instance itself + */ + public NexthopBlackhole 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; + } + NexthopBlackhole nexthopBlackhole = (NexthopBlackhole) o; + return Objects.equals(this.type, nexthopBlackhole.type) + && Objects.equals(this.additionalProperties, nexthopBlackhole.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NexthopBlackhole {\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("type")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("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 NexthopBlackhole + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NexthopBlackhole.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 NexthopBlackhole is not found in the empty JSON string", + NexthopBlackhole.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : NexthopBlackhole.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("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 (!NexthopBlackhole.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NexthopBlackhole' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(NexthopBlackhole.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, NexthopBlackhole 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 NexthopBlackhole read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + NexthopBlackhole 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 NexthopBlackhole given an JSON string + * + * @param jsonString JSON string + * @return An instance of NexthopBlackhole + * @throws IOException if the JSON string is invalid with respect to NexthopBlackhole + */ + public static NexthopBlackhole fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NexthopBlackhole.class); + } + + /** + * Convert an instance of NexthopBlackhole to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/NexthopIPv4.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/NexthopIPv4.java new file mode 100644 index 00000000..3ac220d5 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/NexthopIPv4.java @@ -0,0 +1,340 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** Object that represents an IPv4 address. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class NexthopIPv4 { + public static final String SERIALIZED_NAME_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private String type; + + public static final String SERIALIZED_NAME_VALUE = "value"; + + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nonnull + private String value; + + public NexthopIPv4() {} + + public NexthopIPv4 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; + } + + public NexthopIPv4 value(@javax.annotation.Nonnull String value) { + this.value = value; + return this; + } + + /** + * An IPv4 address. + * + * @return value + */ + @javax.annotation.Nonnull + public String getValue() { + return value; + } + + public void setValue(@javax.annotation.Nonnull String value) { + this.value = value; + } + + /** + * 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 NexthopIPv4 instance itself + */ + public NexthopIPv4 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; + } + NexthopIPv4 nexthopIPv4 = (NexthopIPv4) o; + return Objects.equals(this.type, nexthopIPv4.type) + && Objects.equals(this.value, nexthopIPv4.value) + && Objects.equals(this.additionalProperties, nexthopIPv4.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(type, value, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NexthopIPv4 {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).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("type", "value")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("type", "value")); + } + + /** + * 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 NexthopIPv4 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NexthopIPv4.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 NexthopIPv4 is not found in the empty JSON string", + NexthopIPv4.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : NexthopIPv4.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("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())); + } + if (!jsonObj.get("value").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `value` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("value").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!NexthopIPv4.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NexthopIPv4' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(NexthopIPv4.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, NexthopIPv4 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 NexthopIPv4 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + NexthopIPv4 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 NexthopIPv4 given an JSON string + * + * @param jsonString JSON string + * @return An instance of NexthopIPv4 + * @throws IOException if the JSON string is invalid with respect to NexthopIPv4 + */ + public static NexthopIPv4 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NexthopIPv4.class); + } + + /** + * Convert an instance of NexthopIPv4 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/NexthopIPv6.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/NexthopIPv6.java new file mode 100644 index 00000000..ca6e4981 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/NexthopIPv6.java @@ -0,0 +1,340 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** Object that represents an IPv6 address. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class NexthopIPv6 { + public static final String SERIALIZED_NAME_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private String type; + + public static final String SERIALIZED_NAME_VALUE = "value"; + + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nonnull + private String value; + + public NexthopIPv6() {} + + public NexthopIPv6 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; + } + + public NexthopIPv6 value(@javax.annotation.Nonnull String value) { + this.value = value; + return this; + } + + /** + * An IPv6 address. + * + * @return value + */ + @javax.annotation.Nonnull + public String getValue() { + return value; + } + + public void setValue(@javax.annotation.Nonnull String value) { + this.value = value; + } + + /** + * 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 NexthopIPv6 instance itself + */ + public NexthopIPv6 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; + } + NexthopIPv6 nexthopIPv6 = (NexthopIPv6) o; + return Objects.equals(this.type, nexthopIPv6.type) + && Objects.equals(this.value, nexthopIPv6.value) + && Objects.equals(this.additionalProperties, nexthopIPv6.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(type, value, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NexthopIPv6 {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).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("type", "value")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("type", "value")); + } + + /** + * 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 NexthopIPv6 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NexthopIPv6.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 NexthopIPv6 is not found in the empty JSON string", + NexthopIPv6.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : NexthopIPv6.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("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())); + } + if (!jsonObj.get("value").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `value` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("value").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!NexthopIPv6.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NexthopIPv6' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(NexthopIPv6.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, NexthopIPv6 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 NexthopIPv6 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + NexthopIPv6 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 NexthopIPv6 given an JSON string + * + * @param jsonString JSON string + * @return An instance of NexthopIPv6 + * @throws IOException if the JSON string is invalid with respect to NexthopIPv6 + */ + public static NexthopIPv6 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NexthopIPv6.class); + } + + /** + * Convert an instance of NexthopIPv6 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/NexthopInternet.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/NexthopInternet.java new file mode 100644 index 00000000..c6a9adec --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/NexthopInternet.java @@ -0,0 +1,307 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** Object that represents a route to the internet. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class NexthopInternet { + public static final String SERIALIZED_NAME_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private String type; + + public NexthopInternet() {} + + public NexthopInternet 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 NexthopInternet instance itself + */ + public NexthopInternet 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; + } + NexthopInternet nexthopInternet = (NexthopInternet) o; + return Objects.equals(this.type, nexthopInternet.type) + && Objects.equals(this.additionalProperties, nexthopInternet.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NexthopInternet {\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("type")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("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 NexthopInternet + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NexthopInternet.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 NexthopInternet is not found in the empty JSON string", + NexthopInternet.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : NexthopInternet.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("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 (!NexthopInternet.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NexthopInternet' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(NexthopInternet.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, NexthopInternet 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 NexthopInternet read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + NexthopInternet 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 NexthopInternet given an JSON string + * + * @param jsonString JSON string + * @return An instance of NexthopInternet + * @throws IOException if the JSON string is invalid with respect to NexthopInternet + */ + public static NexthopInternet fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NexthopInternet.class); + } + + /** + * Convert an instance of NexthopInternet to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/PartialUpdateNetworkAreaPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/PartialUpdateNetworkAreaPayload.java new file mode 100644 index 00000000..0f0c3058 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/PartialUpdateNetworkAreaPayload.java @@ -0,0 +1,332 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** Object that represents the network area update request. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class PartialUpdateNetworkAreaPayload { + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; + + public PartialUpdateNetworkAreaPayload() {} + + public PartialUpdateNetworkAreaPayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public PartialUpdateNetworkAreaPayload name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Get name + * + * @return name + */ + @javax.annotation.Nullable public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * 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 PartialUpdateNetworkAreaPayload instance itself + */ + public PartialUpdateNetworkAreaPayload 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; + } + PartialUpdateNetworkAreaPayload partialUpdateNetworkAreaPayload = + (PartialUpdateNetworkAreaPayload) o; + return Objects.equals(this.labels, partialUpdateNetworkAreaPayload.labels) + && Objects.equals(this.name, partialUpdateNetworkAreaPayload.name) + && Objects.equals( + this.additionalProperties, + partialUpdateNetworkAreaPayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(labels, name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PartialUpdateNetworkAreaPayload {\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("labels", "name")); + + // 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 + * PartialUpdateNetworkAreaPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PartialUpdateNetworkAreaPayload.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 PartialUpdateNetworkAreaPayload is not found in the empty JSON string", + PartialUpdateNetworkAreaPayload.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `name` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PartialUpdateNetworkAreaPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PartialUpdateNetworkAreaPayload' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(PartialUpdateNetworkAreaPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, PartialUpdateNetworkAreaPayload 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 PartialUpdateNetworkAreaPayload read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PartialUpdateNetworkAreaPayload 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 PartialUpdateNetworkAreaPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of PartialUpdateNetworkAreaPayload + * @throws IOException if the JSON string is invalid with respect to + * PartialUpdateNetworkAreaPayload + */ + public static PartialUpdateNetworkAreaPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PartialUpdateNetworkAreaPayload.class); + } + + /** + * Convert an instance of PartialUpdateNetworkAreaPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/PartialUpdateNetworkPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/PartialUpdateNetworkPayload.java new file mode 100644 index 00000000..f30adb34 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/PartialUpdateNetworkPayload.java @@ -0,0 +1,481 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +/** Object that represents the request body for a network update. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class PartialUpdateNetworkPayload { + public static final String SERIALIZED_NAME_DHCP = "dhcp"; + + @SerializedName(SERIALIZED_NAME_DHCP) + @javax.annotation.Nullable private Boolean dhcp; + + public static final String SERIALIZED_NAME_IPV4 = "ipv4"; + + @SerializedName(SERIALIZED_NAME_IPV4) + @javax.annotation.Nullable private UpdateNetworkIPv4Body ipv4; + + public static final String SERIALIZED_NAME_IPV6 = "ipv6"; + + @SerializedName(SERIALIZED_NAME_IPV6) + @javax.annotation.Nullable private UpdateNetworkIPv6Body ipv6; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; + + public static final String SERIALIZED_NAME_ROUTED = "routed"; + + @SerializedName(SERIALIZED_NAME_ROUTED) + @javax.annotation.Nullable private Boolean routed; + + public static final String SERIALIZED_NAME_ROUTING_TABLE_ID = "routingTableId"; + + @SerializedName(SERIALIZED_NAME_ROUTING_TABLE_ID) + @javax.annotation.Nullable private UUID routingTableId; + + public PartialUpdateNetworkPayload() {} + + public PartialUpdateNetworkPayload dhcp(@javax.annotation.Nullable Boolean dhcp) { + this.dhcp = dhcp; + return this; + } + + /** + * Enable or disable DHCP for a network. + * + * @return dhcp + */ + @javax.annotation.Nullable public Boolean getDhcp() { + return dhcp; + } + + public void setDhcp(@javax.annotation.Nullable Boolean dhcp) { + this.dhcp = dhcp; + } + + public PartialUpdateNetworkPayload ipv4(@javax.annotation.Nullable UpdateNetworkIPv4Body ipv4) { + this.ipv4 = ipv4; + return this; + } + + /** + * Get ipv4 + * + * @return ipv4 + */ + @javax.annotation.Nullable public UpdateNetworkIPv4Body getIpv4() { + return ipv4; + } + + public void setIpv4(@javax.annotation.Nullable UpdateNetworkIPv4Body ipv4) { + this.ipv4 = ipv4; + } + + public PartialUpdateNetworkPayload ipv6(@javax.annotation.Nullable UpdateNetworkIPv6Body ipv6) { + this.ipv6 = ipv6; + return this; + } + + /** + * Get ipv6 + * + * @return ipv6 + */ + @javax.annotation.Nullable public UpdateNetworkIPv6Body getIpv6() { + return ipv6; + } + + public void setIpv6(@javax.annotation.Nullable UpdateNetworkIPv6Body ipv6) { + this.ipv6 = ipv6; + } + + public PartialUpdateNetworkPayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public PartialUpdateNetworkPayload name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nullable public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + public PartialUpdateNetworkPayload routed(@javax.annotation.Nullable Boolean routed) { + this.routed = routed; + return this; + } + + /** + * Shows if the network is routed and therefore accessible from other networks. + * + * @return routed + */ + @javax.annotation.Nullable public Boolean getRouted() { + return routed; + } + + public void setRouted(@javax.annotation.Nullable Boolean routed) { + this.routed = routed; + } + + public PartialUpdateNetworkPayload routingTableId( + @javax.annotation.Nullable UUID routingTableId) { + this.routingTableId = routingTableId; + return this; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return routingTableId + */ + @javax.annotation.Nullable public UUID getRoutingTableId() { + return routingTableId; + } + + public void setRoutingTableId(@javax.annotation.Nullable UUID routingTableId) { + this.routingTableId = routingTableId; + } + + /** + * 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 PartialUpdateNetworkPayload instance itself + */ + public PartialUpdateNetworkPayload 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; + } + PartialUpdateNetworkPayload partialUpdateNetworkPayload = (PartialUpdateNetworkPayload) o; + return Objects.equals(this.dhcp, partialUpdateNetworkPayload.dhcp) + && Objects.equals(this.ipv4, partialUpdateNetworkPayload.ipv4) + && Objects.equals(this.ipv6, partialUpdateNetworkPayload.ipv6) + && Objects.equals(this.labels, partialUpdateNetworkPayload.labels) + && Objects.equals(this.name, partialUpdateNetworkPayload.name) + && Objects.equals(this.routed, partialUpdateNetworkPayload.routed) + && Objects.equals(this.routingTableId, partialUpdateNetworkPayload.routingTableId) + && Objects.equals( + this.additionalProperties, + partialUpdateNetworkPayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + dhcp, ipv4, ipv6, labels, name, routed, routingTableId, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PartialUpdateNetworkPayload {\n"); + sb.append(" dhcp: ").append(toIndentedString(dhcp)).append("\n"); + sb.append(" ipv4: ").append(toIndentedString(ipv4)).append("\n"); + sb.append(" ipv6: ").append(toIndentedString(ipv6)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" routed: ").append(toIndentedString(routed)).append("\n"); + sb.append(" routingTableId: ").append(toIndentedString(routingTableId)).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( + "dhcp", + "ipv4", + "ipv6", + "labels", + "name", + "routed", + "routingTableId")); + + // 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 + * PartialUpdateNetworkPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PartialUpdateNetworkPayload.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 PartialUpdateNetworkPayload is not found in the empty JSON string", + PartialUpdateNetworkPayload.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `ipv4` + if (jsonObj.get("ipv4") != null && !jsonObj.get("ipv4").isJsonNull()) { + UpdateNetworkIPv4Body.validateJsonElement(jsonObj.get("ipv4")); + } + // validate the optional field `ipv6` + if (jsonObj.get("ipv6") != null && !jsonObj.get("ipv6").isJsonNull()) { + UpdateNetworkIPv6Body.validateJsonElement(jsonObj.get("ipv6")); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `name` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("name").toString())); + } + if ((jsonObj.get("routingTableId") != null && !jsonObj.get("routingTableId").isJsonNull()) + && !jsonObj.get("routingTableId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `routingTableId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("routingTableId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PartialUpdateNetworkPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PartialUpdateNetworkPayload' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(PartialUpdateNetworkPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, PartialUpdateNetworkPayload 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 PartialUpdateNetworkPayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PartialUpdateNetworkPayload 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 PartialUpdateNetworkPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of PartialUpdateNetworkPayload + * @throws IOException if the JSON string is invalid with respect to PartialUpdateNetworkPayload + */ + public static PartialUpdateNetworkPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PartialUpdateNetworkPayload.class); + } + + /** + * Convert an instance of PartialUpdateNetworkPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/PortRange.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/PortRange.java new file mode 100644 index 00000000..2e82f23f --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/PortRange.java @@ -0,0 +1,329 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** + * Object that represents a range of ports (this will be omitted if it covers the full default range + * 0/1-65535). + */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class PortRange { + public static final String SERIALIZED_NAME_MAX = "max"; + + @SerializedName(SERIALIZED_NAME_MAX) + @javax.annotation.Nonnull + private Long max; + + public static final String SERIALIZED_NAME_MIN = "min"; + + @SerializedName(SERIALIZED_NAME_MIN) + @javax.annotation.Nonnull + private Long min; + + public PortRange() {} + + public PortRange max(@javax.annotation.Nonnull Long max) { + this.max = max; + return this; + } + + /** + * The maximum port number. Should be greater or equal to the minimum. minimum: 0 maximum: 65535 + * + * @return max + */ + @javax.annotation.Nonnull + public Long getMax() { + return max; + } + + public void setMax(@javax.annotation.Nonnull Long max) { + this.max = max; + } + + public PortRange min(@javax.annotation.Nonnull Long min) { + this.min = min; + return this; + } + + /** + * The minimum port number. Should be less or equal to the maximum. minimum: 0 maximum: 65535 + * + * @return min + */ + @javax.annotation.Nonnull + public Long getMin() { + return min; + } + + public void setMin(@javax.annotation.Nonnull Long min) { + this.min = min; + } + + /** + * 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 PortRange instance itself + */ + public PortRange 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; + } + PortRange portRange = (PortRange) o; + return Objects.equals(this.max, portRange.max) + && Objects.equals(this.min, portRange.min) + && Objects.equals(this.additionalProperties, portRange.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(max, min, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PortRange {\n"); + sb.append(" max: ").append(toIndentedString(max)).append("\n"); + sb.append(" min: ").append(toIndentedString(min)).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("max", "min")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("max", "min")); + } + + /** + * 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 PortRange + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PortRange.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 PortRange is not found in the empty JSON string", + PortRange.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PortRange.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "The required field `%s` is not found in the JSON string: %s", + requiredField, + jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PortRange.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PortRange' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(PortRange.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, PortRange 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 PortRange read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PortRange 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 PortRange given an JSON string + * + * @param jsonString JSON string + * @return An instance of PortRange + * @throws IOException if the JSON string is invalid with respect to PortRange + */ + public static PortRange fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PortRange.class); + } + + /** + * Convert an instance of PortRange to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/Project.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/Project.java new file mode 100644 index 00000000..4d7a51e8 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/Project.java @@ -0,0 +1,445 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; +import java.util.UUID; + +/** Object that represents a STACKIT project. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class Project { + public static final String SERIALIZED_NAME_AREA_ID = "areaId"; + + @SerializedName(SERIALIZED_NAME_AREA_ID) + @javax.annotation.Nonnull + private AreaId areaId; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private UUID id; + + public static final String SERIALIZED_NAME_INTERNET_ACCESS = "internetAccess"; + + @SerializedName(SERIALIZED_NAME_INTERNET_ACCESS) + @javax.annotation.Nullable private Boolean internetAccess; + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nonnull + private String status; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable private OffsetDateTime updatedAt; + + public Project() {} + + public Project(OffsetDateTime createdAt, OffsetDateTime updatedAt) { + this(); + this.createdAt = createdAt; + this.updatedAt = updatedAt; + } + + public Project areaId(@javax.annotation.Nonnull AreaId areaId) { + this.areaId = areaId; + return this; + } + + /** + * Get areaId + * + * @return areaId + */ + @javax.annotation.Nonnull + public AreaId getAreaId() { + return areaId; + } + + public void setAreaId(@javax.annotation.Nonnull AreaId areaId) { + this.areaId = areaId; + } + + /** + * Date-time when resource was created. + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public Project id(@javax.annotation.Nonnull UUID id) { + this.id = id; + return this; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nonnull + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull UUID id) { + this.id = id; + } + + public Project internetAccess(@javax.annotation.Nullable Boolean internetAccess) { + this.internetAccess = internetAccess; + return this; + } + + /** + * Get internetAccess + * + * @return internetAccess + */ + @javax.annotation.Nullable public Boolean getInternetAccess() { + return internetAccess; + } + + public void setInternetAccess(@javax.annotation.Nullable Boolean internetAccess) { + this.internetAccess = internetAccess; + } + + public Project status(@javax.annotation.Nonnull String status) { + this.status = status; + return this; + } + + /** + * The state of a resource object. Possible values: `CREATING`, `CREATED`, + * `DELETING`, `DELETED`, `FAILED`, `UPDATED`, + * `UPDATING`. + * + * @return status + */ + @javax.annotation.Nonnull + public String getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nonnull String status) { + this.status = status; + } + + /** + * Date-time when resource was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nullable public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * 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 Project instance itself + */ + public Project 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; + } + Project project = (Project) o; + return Objects.equals(this.areaId, project.areaId) + && Objects.equals(this.createdAt, project.createdAt) + && Objects.equals(this.id, project.id) + && Objects.equals(this.internetAccess, project.internetAccess) + && Objects.equals(this.status, project.status) + && Objects.equals(this.updatedAt, project.updatedAt) + && Objects.equals(this.additionalProperties, project.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + areaId, createdAt, id, internetAccess, status, updatedAt, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Project {\n"); + sb.append(" areaId: ").append(toIndentedString(areaId)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" internetAccess: ").append(toIndentedString(internetAccess)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).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( + "areaId", + "createdAt", + "id", + "internetAccess", + "status", + "updatedAt")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("areaId", "id", "status")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Project + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Project.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 Project is not found in the empty JSON string", + Project.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Project.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 `areaId` + AreaId.validateJsonElement(jsonObj.get("areaId")); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `status` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("status").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Project.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Project' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(Project.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, Project 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 Project read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Project 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 Project given an JSON string + * + * @param jsonString JSON string + * @return An instance of Project + * @throws IOException if the JSON string is invalid with respect to Project + */ + public static Project fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Project.class); + } + + /** + * Convert an instance of Project to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ProjectListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ProjectListResponse.java new file mode 100644 index 00000000..ca4aac57 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ProjectListResponse.java @@ -0,0 +1,322 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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.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; +import java.util.UUID; + +/** Project list response. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class ProjectListResponse { + public static final String SERIALIZED_NAME_ITEMS = "items"; + + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public ProjectListResponse() {} + + public ProjectListResponse items(@javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public ProjectListResponse addItemsItem(UUID itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list of STACKIT projects. + * + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ProjectListResponse instance itself + */ + public ProjectListResponse 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; + } + ProjectListResponse projectListResponse = (ProjectListResponse) o; + return Objects.equals(this.items, projectListResponse.items) + && Objects.equals( + this.additionalProperties, projectListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProjectListResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("items")); + } + + /** + * 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 ProjectListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProjectListResponse.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 ProjectListResponse is not found in the empty JSON string", + ProjectListResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ProjectListResponse.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 required json array is present + if (jsonObj.get("items") == null) { + throw new IllegalArgumentException( + "Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("items").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `items` to be an array in the JSON string but got `%s`", + jsonObj.get("items").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProjectListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProjectListResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ProjectListResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ProjectListResponse 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 ProjectListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ProjectListResponse 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 ProjectListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProjectListResponse + * @throws IOException if the JSON string is invalid with respect to ProjectListResponse + */ + public static ProjectListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProjectListResponse.class); + } + + /** + * Convert an instance of ProjectListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/Protocol.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/Protocol.java new file mode 100644 index 00000000..103bdcb8 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/Protocol.java @@ -0,0 +1,323 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** The schema for a protocol of a security group rule. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class Protocol { + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; + + public static final String SERIALIZED_NAME_NUMBER = "number"; + + @SerializedName(SERIALIZED_NAME_NUMBER) + @javax.annotation.Nullable private Long number; + + public Protocol() {} + + public Protocol name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The protocol name which the rule should match. Possible values: `ah`, + * `dccp`, `egp`, `esp`, `gre`, `icmp`, + * `igmp`, `ipip`, `ipv6-encap`, `ipv6-frag`, + * `ipv6-icmp`, `ipv6-nonxt`, `ipv6-opts`, `ipv6-route`, + * `ospf`, `pgm`, `rsvp`, `sctp`, `tcp`, + * `udp`, `udplite`, `vrrp`. + * + * @return name + */ + @javax.annotation.Nullable public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + public Protocol number(@javax.annotation.Nullable Long number) { + this.number = number; + return this; + } + + /** + * The protocol number which the rule should match. minimum: 0 maximum: 255 + * + * @return number + */ + @javax.annotation.Nullable public Long getNumber() { + return number; + } + + public void setNumber(@javax.annotation.Nullable Long number) { + this.number = number; + } + + /** + * 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 Protocol instance itself + */ + public Protocol 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; + } + Protocol protocol = (Protocol) o; + return Objects.equals(this.name, protocol.name) + && Objects.equals(this.number, protocol.number) + && Objects.equals(this.additionalProperties, protocol.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(name, number, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Protocol {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" number: ").append(toIndentedString(number)).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", "number")); + + // 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 Protocol + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Protocol.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 Protocol is not found in the empty JSON string", + Protocol.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `name` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Protocol.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Protocol' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(Protocol.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, Protocol 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 Protocol read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Protocol 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 Protocol given an JSON string + * + * @param jsonString JSON string + * @return An instance of Protocol + * @throws IOException if the JSON string is invalid with respect to Protocol + */ + public static Protocol fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Protocol.class); + } + + /** + * Convert an instance of Protocol to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/PublicIp.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/PublicIp.java new file mode 100644 index 00000000..26ec3f27 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/PublicIp.java @@ -0,0 +1,396 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Object that represents a public IP. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class PublicIp { + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_IP = "ip"; + + @SerializedName(SERIALIZED_NAME_IP) + @javax.annotation.Nullable private String ip; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NETWORK_INTERFACE = "networkInterface"; + + @SerializedName(SERIALIZED_NAME_NETWORK_INTERFACE) + @javax.annotation.Nullable private UUID networkInterface; + + public PublicIp() {} + + public PublicIp(UUID id, String ip) { + this(); + this.id = id; + this.ip = ip; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + /** + * String that represents an IPv4 address. + * + * @return ip + */ + @javax.annotation.Nullable public String getIp() { + return ip; + } + + public PublicIp labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public PublicIp networkInterface(@javax.annotation.Nullable UUID networkInterface) { + this.networkInterface = networkInterface; + return this; + } + + /** + * Associate the public IP with a network interface (ID). + * + * @return networkInterface + */ + @javax.annotation.Nullable public UUID getNetworkInterface() { + return networkInterface; + } + + public void setNetworkInterface(@javax.annotation.Nullable UUID networkInterface) { + this.networkInterface = networkInterface; + } + + /** + * 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 PublicIp instance itself + */ + public PublicIp 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; + } + PublicIp publicIp = (PublicIp) o; + return Objects.equals(this.id, publicIp.id) + && Objects.equals(this.ip, publicIp.ip) + && Objects.equals(this.labels, publicIp.labels) + && Objects.equals(this.networkInterface, publicIp.networkInterface) + && Objects.equals(this.additionalProperties, publicIp.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(id, ip, labels, networkInterface, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PublicIp {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" ip: ").append(toIndentedString(ip)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" networkInterface: ").append(toIndentedString(networkInterface)).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("id", "ip", "labels", "networkInterface")); + + // 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 PublicIp + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PublicIp.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 PublicIp is not found in the empty JSON string", + PublicIp.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if ((jsonObj.get("ip") != null && !jsonObj.get("ip").isJsonNull()) + && !jsonObj.get("ip").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `ip` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("ip").toString())); + } + if ((jsonObj.get("networkInterface") != null + && !jsonObj.get("networkInterface").isJsonNull()) + && !jsonObj.get("networkInterface").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `networkInterface` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("networkInterface").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PublicIp.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PublicIp' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(PublicIp.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, PublicIp 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 PublicIp read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PublicIp 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 PublicIp given an JSON string + * + * @param jsonString JSON string + * @return An instance of PublicIp + * @throws IOException if the JSON string is invalid with respect to PublicIp + */ + public static PublicIp fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PublicIp.class); + } + + /** + * Convert an instance of PublicIp to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/PublicIpListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/PublicIpListResponse.java new file mode 100644 index 00000000..ae208bf8 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/PublicIpListResponse.java @@ -0,0 +1,326 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** Public IP list response. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class PublicIpListResponse { + public static final String SERIALIZED_NAME_ITEMS = "items"; + + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public PublicIpListResponse() {} + + public PublicIpListResponse items(@javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public PublicIpListResponse addItemsItem(PublicIp itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list of public IPs. + * + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PublicIpListResponse instance itself + */ + public PublicIpListResponse 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; + } + PublicIpListResponse publicIpListResponse = (PublicIpListResponse) o; + return Objects.equals(this.items, publicIpListResponse.items) + && Objects.equals( + this.additionalProperties, publicIpListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PublicIpListResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("items")); + } + + /** + * 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 PublicIpListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PublicIpListResponse.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 PublicIpListResponse is not found in the empty JSON string", + PublicIpListResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PublicIpListResponse.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("items").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `items` to be an array in the JSON string but got `%s`", + jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + PublicIp.validateJsonElement(jsonArrayitems.get(i)); + } + ; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PublicIpListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PublicIpListResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(PublicIpListResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, PublicIpListResponse 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 PublicIpListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PublicIpListResponse 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 PublicIpListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of PublicIpListResponse + * @throws IOException if the JSON string is invalid with respect to PublicIpListResponse + */ + public static PublicIpListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PublicIpListResponse.class); + } + + /** + * Convert an instance of PublicIpListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/PublicNetwork.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/PublicNetwork.java new file mode 100644 index 00000000..214b676e --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/PublicNetwork.java @@ -0,0 +1,340 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** Public network. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class PublicNetwork { + public static final String SERIALIZED_NAME_CIDR = "cidr"; + + @SerializedName(SERIALIZED_NAME_CIDR) + @javax.annotation.Nonnull + private String cidr; + + public static final String SERIALIZED_NAME_REGION = "region"; + + @SerializedName(SERIALIZED_NAME_REGION) + @javax.annotation.Nonnull + private String region; + + public PublicNetwork() {} + + public PublicNetwork cidr(@javax.annotation.Nonnull String cidr) { + this.cidr = cidr; + return this; + } + + /** + * Classless Inter-Domain Routing (CIDR). + * + * @return cidr + */ + @javax.annotation.Nonnull + public String getCidr() { + return cidr; + } + + public void setCidr(@javax.annotation.Nonnull String cidr) { + this.cidr = cidr; + } + + public PublicNetwork region(@javax.annotation.Nonnull String region) { + this.region = region; + return this; + } + + /** + * Name of the region. + * + * @return region + */ + @javax.annotation.Nonnull + public String getRegion() { + return region; + } + + public void setRegion(@javax.annotation.Nonnull String region) { + this.region = region; + } + + /** + * 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 PublicNetwork instance itself + */ + public PublicNetwork 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; + } + PublicNetwork publicNetwork = (PublicNetwork) o; + return Objects.equals(this.cidr, publicNetwork.cidr) + && Objects.equals(this.region, publicNetwork.region) + && Objects.equals(this.additionalProperties, publicNetwork.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(cidr, region, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PublicNetwork {\n"); + sb.append(" cidr: ").append(toIndentedString(cidr)).append("\n"); + sb.append(" region: ").append(toIndentedString(region)).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("cidr", "region")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("cidr", "region")); + } + + /** + * 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 PublicNetwork + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PublicNetwork.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 PublicNetwork is not found in the empty JSON string", + PublicNetwork.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PublicNetwork.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("cidr").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `cidr` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("cidr").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())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PublicNetwork.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PublicNetwork' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(PublicNetwork.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, PublicNetwork 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 PublicNetwork read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PublicNetwork 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 PublicNetwork given an JSON string + * + * @param jsonString JSON string + * @return An instance of PublicNetwork + * @throws IOException if the JSON string is invalid with respect to PublicNetwork + */ + public static PublicNetwork fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PublicNetwork.class); + } + + /** + * Convert an instance of PublicNetwork to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/PublicNetworkListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/PublicNetworkListResponse.java new file mode 100644 index 00000000..510d0800 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/PublicNetworkListResponse.java @@ -0,0 +1,327 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** Public network list response. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class PublicNetworkListResponse { + public static final String SERIALIZED_NAME_ITEMS = "items"; + + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public PublicNetworkListResponse() {} + + public PublicNetworkListResponse items(@javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public PublicNetworkListResponse addItemsItem(PublicNetwork itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list of public networks. + * + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PublicNetworkListResponse instance itself + */ + public PublicNetworkListResponse 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; + } + PublicNetworkListResponse publicNetworkListResponse = (PublicNetworkListResponse) o; + return Objects.equals(this.items, publicNetworkListResponse.items) + && Objects.equals( + this.additionalProperties, publicNetworkListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PublicNetworkListResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("items")); + } + + /** + * 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 PublicNetworkListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PublicNetworkListResponse.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 PublicNetworkListResponse is not found in the empty JSON string", + PublicNetworkListResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PublicNetworkListResponse.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("items").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `items` to be an array in the JSON string but got `%s`", + jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + PublicNetwork.validateJsonElement(jsonArrayitems.get(i)); + } + ; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PublicNetworkListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PublicNetworkListResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(PublicNetworkListResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, PublicNetworkListResponse 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 PublicNetworkListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PublicNetworkListResponse 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 PublicNetworkListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of PublicNetworkListResponse + * @throws IOException if the JSON string is invalid with respect to PublicNetworkListResponse + */ + public static PublicNetworkListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PublicNetworkListResponse.class); + } + + /** + * Convert an instance of PublicNetworkListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/Quota.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/Quota.java new file mode 100644 index 00000000..79c590f3 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/Quota.java @@ -0,0 +1,326 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** Object that represents a single resource quota. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class Quota { + public static final String SERIALIZED_NAME_LIMIT = "limit"; + + @SerializedName(SERIALIZED_NAME_LIMIT) + @javax.annotation.Nonnull + private Long limit; + + public static final String SERIALIZED_NAME_USAGE = "usage"; + + @SerializedName(SERIALIZED_NAME_USAGE) + @javax.annotation.Nonnull + private Long usage; + + public Quota() {} + + public Quota limit(@javax.annotation.Nonnull Long limit) { + this.limit = limit; + return this; + } + + /** + * Get limit + * + * @return limit + */ + @javax.annotation.Nonnull + public Long getLimit() { + return limit; + } + + public void setLimit(@javax.annotation.Nonnull Long limit) { + this.limit = limit; + } + + public Quota usage(@javax.annotation.Nonnull Long usage) { + this.usage = usage; + return this; + } + + /** + * Get usage + * + * @return usage + */ + @javax.annotation.Nonnull + public Long getUsage() { + return usage; + } + + public void setUsage(@javax.annotation.Nonnull Long usage) { + this.usage = usage; + } + + /** + * 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 Quota instance itself + */ + public Quota 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; + } + Quota quota = (Quota) o; + return Objects.equals(this.limit, quota.limit) + && Objects.equals(this.usage, quota.usage) + && Objects.equals(this.additionalProperties, quota.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(limit, usage, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Quota {\n"); + sb.append(" limit: ").append(toIndentedString(limit)).append("\n"); + sb.append(" usage: ").append(toIndentedString(usage)).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("limit", "usage")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("limit", "usage")); + } + + /** + * 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 Quota + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Quota.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 Quota is not found in the empty JSON string", + Quota.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Quota.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "The required field `%s` is not found in the JSON string: %s", + requiredField, + jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Quota.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Quota' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(Quota.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, Quota 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 Quota read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Quota 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 Quota given an JSON string + * + * @param jsonString JSON string + * @return An instance of Quota + * @throws IOException if the JSON string is invalid with respect to Quota + */ + public static Quota fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Quota.class); + } + + /** + * Convert an instance of Quota to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/QuotaList.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/QuotaList.java new file mode 100644 index 00000000..594fbe56 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/QuotaList.java @@ -0,0 +1,663 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** Object that represents the quotas for a project. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class QuotaList { + public static final String SERIALIZED_NAME_BACKUP_GIGABYTES = "backupGigabytes"; + + @SerializedName(SERIALIZED_NAME_BACKUP_GIGABYTES) + @javax.annotation.Nonnull + private Quota backupGigabytes; + + public static final String SERIALIZED_NAME_BACKUPS = "backups"; + + @SerializedName(SERIALIZED_NAME_BACKUPS) + @javax.annotation.Nonnull + private Quota backups; + + public static final String SERIALIZED_NAME_GIGABYTES = "gigabytes"; + + @SerializedName(SERIALIZED_NAME_GIGABYTES) + @javax.annotation.Nonnull + private Quota gigabytes; + + public static final String SERIALIZED_NAME_NETWORKS = "networks"; + + @SerializedName(SERIALIZED_NAME_NETWORKS) + @javax.annotation.Nonnull + private Quota networks; + + public static final String SERIALIZED_NAME_NICS = "nics"; + + @SerializedName(SERIALIZED_NAME_NICS) + @javax.annotation.Nonnull + private Quota nics; + + public static final String SERIALIZED_NAME_PUBLIC_IPS = "publicIps"; + + @SerializedName(SERIALIZED_NAME_PUBLIC_IPS) + @javax.annotation.Nonnull + private Quota publicIps; + + public static final String SERIALIZED_NAME_RAM = "ram"; + + @SerializedName(SERIALIZED_NAME_RAM) + @javax.annotation.Nonnull + private Quota ram; + + public static final String SERIALIZED_NAME_SECURITY_GROUP_RULES = "securityGroupRules"; + + @SerializedName(SERIALIZED_NAME_SECURITY_GROUP_RULES) + @javax.annotation.Nonnull + private Quota securityGroupRules; + + public static final String SERIALIZED_NAME_SECURITY_GROUPS = "securityGroups"; + + @SerializedName(SERIALIZED_NAME_SECURITY_GROUPS) + @javax.annotation.Nonnull + private Quota securityGroups; + + public static final String SERIALIZED_NAME_SNAPSHOTS = "snapshots"; + + @SerializedName(SERIALIZED_NAME_SNAPSHOTS) + @javax.annotation.Nonnull + private Quota snapshots; + + public static final String SERIALIZED_NAME_VCPU = "vcpu"; + + @SerializedName(SERIALIZED_NAME_VCPU) + @javax.annotation.Nonnull + private Quota vcpu; + + public static final String SERIALIZED_NAME_VOLUMES = "volumes"; + + @SerializedName(SERIALIZED_NAME_VOLUMES) + @javax.annotation.Nonnull + private Quota volumes; + + public QuotaList() {} + + public QuotaList backupGigabytes(@javax.annotation.Nonnull Quota backupGigabytes) { + this.backupGigabytes = backupGigabytes; + return this; + } + + /** + * Total size in GiB of backups. + * + * @return backupGigabytes + */ + @javax.annotation.Nonnull + public Quota getBackupGigabytes() { + return backupGigabytes; + } + + public void setBackupGigabytes(@javax.annotation.Nonnull Quota backupGigabytes) { + this.backupGigabytes = backupGigabytes; + } + + public QuotaList backups(@javax.annotation.Nonnull Quota backups) { + this.backups = backups; + return this; + } + + /** + * Number of backups. + * + * @return backups + */ + @javax.annotation.Nonnull + public Quota getBackups() { + return backups; + } + + public void setBackups(@javax.annotation.Nonnull Quota backups) { + this.backups = backups; + } + + public QuotaList gigabytes(@javax.annotation.Nonnull Quota gigabytes) { + this.gigabytes = gigabytes; + return this; + } + + /** + * Total size in GiB of volumes and snapshots. + * + * @return gigabytes + */ + @javax.annotation.Nonnull + public Quota getGigabytes() { + return gigabytes; + } + + public void setGigabytes(@javax.annotation.Nonnull Quota gigabytes) { + this.gigabytes = gigabytes; + } + + public QuotaList networks(@javax.annotation.Nonnull Quota networks) { + this.networks = networks; + return this; + } + + /** + * Number of networks. + * + * @return networks + */ + @javax.annotation.Nonnull + public Quota getNetworks() { + return networks; + } + + public void setNetworks(@javax.annotation.Nonnull Quota networks) { + this.networks = networks; + } + + public QuotaList nics(@javax.annotation.Nonnull Quota nics) { + this.nics = nics; + return this; + } + + /** + * Number of network interfaces. + * + * @return nics + */ + @javax.annotation.Nonnull + public Quota getNics() { + return nics; + } + + public void setNics(@javax.annotation.Nonnull Quota nics) { + this.nics = nics; + } + + public QuotaList publicIps(@javax.annotation.Nonnull Quota publicIps) { + this.publicIps = publicIps; + return this; + } + + /** + * Number of public IP addresses. + * + * @return publicIps + */ + @javax.annotation.Nonnull + public Quota getPublicIps() { + return publicIps; + } + + public void setPublicIps(@javax.annotation.Nonnull Quota publicIps) { + this.publicIps = publicIps; + } + + public QuotaList ram(@javax.annotation.Nonnull Quota ram) { + this.ram = ram; + return this; + } + + /** + * Amount of server RAM in MiB. + * + * @return ram + */ + @javax.annotation.Nonnull + public Quota getRam() { + return ram; + } + + public void setRam(@javax.annotation.Nonnull Quota ram) { + this.ram = ram; + } + + public QuotaList securityGroupRules(@javax.annotation.Nonnull Quota securityGroupRules) { + this.securityGroupRules = securityGroupRules; + return this; + } + + /** + * Number of security group rules. + * + * @return securityGroupRules + */ + @javax.annotation.Nonnull + public Quota getSecurityGroupRules() { + return securityGroupRules; + } + + public void setSecurityGroupRules(@javax.annotation.Nonnull Quota securityGroupRules) { + this.securityGroupRules = securityGroupRules; + } + + public QuotaList securityGroups(@javax.annotation.Nonnull Quota securityGroups) { + this.securityGroups = securityGroups; + return this; + } + + /** + * Number of security groups. + * + * @return securityGroups + */ + @javax.annotation.Nonnull + public Quota getSecurityGroups() { + return securityGroups; + } + + public void setSecurityGroups(@javax.annotation.Nonnull Quota securityGroups) { + this.securityGroups = securityGroups; + } + + public QuotaList snapshots(@javax.annotation.Nonnull Quota snapshots) { + this.snapshots = snapshots; + return this; + } + + /** + * Number of snapshots. + * + * @return snapshots + */ + @javax.annotation.Nonnull + public Quota getSnapshots() { + return snapshots; + } + + public void setSnapshots(@javax.annotation.Nonnull Quota snapshots) { + this.snapshots = snapshots; + } + + public QuotaList vcpu(@javax.annotation.Nonnull Quota vcpu) { + this.vcpu = vcpu; + return this; + } + + /** + * Number of server cores. + * + * @return vcpu + */ + @javax.annotation.Nonnull + public Quota getVcpu() { + return vcpu; + } + + public void setVcpu(@javax.annotation.Nonnull Quota vcpu) { + this.vcpu = vcpu; + } + + public QuotaList volumes(@javax.annotation.Nonnull Quota volumes) { + this.volumes = volumes; + return this; + } + + /** + * Number of volumes. + * + * @return volumes + */ + @javax.annotation.Nonnull + public Quota getVolumes() { + return volumes; + } + + public void setVolumes(@javax.annotation.Nonnull Quota volumes) { + this.volumes = volumes; + } + + /** + * 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 QuotaList instance itself + */ + public QuotaList 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; + } + QuotaList quotaList = (QuotaList) o; + return Objects.equals(this.backupGigabytes, quotaList.backupGigabytes) + && Objects.equals(this.backups, quotaList.backups) + && Objects.equals(this.gigabytes, quotaList.gigabytes) + && Objects.equals(this.networks, quotaList.networks) + && Objects.equals(this.nics, quotaList.nics) + && Objects.equals(this.publicIps, quotaList.publicIps) + && Objects.equals(this.ram, quotaList.ram) + && Objects.equals(this.securityGroupRules, quotaList.securityGroupRules) + && Objects.equals(this.securityGroups, quotaList.securityGroups) + && Objects.equals(this.snapshots, quotaList.snapshots) + && Objects.equals(this.vcpu, quotaList.vcpu) + && Objects.equals(this.volumes, quotaList.volumes) + && Objects.equals(this.additionalProperties, quotaList.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + backupGigabytes, + backups, + gigabytes, + networks, + nics, + publicIps, + ram, + securityGroupRules, + securityGroups, + snapshots, + vcpu, + volumes, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class QuotaList {\n"); + sb.append(" backupGigabytes: ").append(toIndentedString(backupGigabytes)).append("\n"); + sb.append(" backups: ").append(toIndentedString(backups)).append("\n"); + sb.append(" gigabytes: ").append(toIndentedString(gigabytes)).append("\n"); + sb.append(" networks: ").append(toIndentedString(networks)).append("\n"); + sb.append(" nics: ").append(toIndentedString(nics)).append("\n"); + sb.append(" publicIps: ").append(toIndentedString(publicIps)).append("\n"); + sb.append(" ram: ").append(toIndentedString(ram)).append("\n"); + sb.append(" securityGroupRules: ") + .append(toIndentedString(securityGroupRules)) + .append("\n"); + sb.append(" securityGroups: ").append(toIndentedString(securityGroups)).append("\n"); + sb.append(" snapshots: ").append(toIndentedString(snapshots)).append("\n"); + sb.append(" vcpu: ").append(toIndentedString(vcpu)).append("\n"); + sb.append(" volumes: ").append(toIndentedString(volumes)).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( + "backupGigabytes", + "backups", + "gigabytes", + "networks", + "nics", + "publicIps", + "ram", + "securityGroupRules", + "securityGroups", + "snapshots", + "vcpu", + "volumes")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = + new HashSet( + Arrays.asList( + "backupGigabytes", + "backups", + "gigabytes", + "networks", + "nics", + "publicIps", + "ram", + "securityGroupRules", + "securityGroups", + "snapshots", + "vcpu", + "volumes")); + } + + /** + * 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 QuotaList + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!QuotaList.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 QuotaList is not found in the empty JSON string", + QuotaList.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : QuotaList.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 `backupGigabytes` + Quota.validateJsonElement(jsonObj.get("backupGigabytes")); + // validate the required field `backups` + Quota.validateJsonElement(jsonObj.get("backups")); + // validate the required field `gigabytes` + Quota.validateJsonElement(jsonObj.get("gigabytes")); + // validate the required field `networks` + Quota.validateJsonElement(jsonObj.get("networks")); + // validate the required field `nics` + Quota.validateJsonElement(jsonObj.get("nics")); + // validate the required field `publicIps` + Quota.validateJsonElement(jsonObj.get("publicIps")); + // validate the required field `ram` + Quota.validateJsonElement(jsonObj.get("ram")); + // validate the required field `securityGroupRules` + Quota.validateJsonElement(jsonObj.get("securityGroupRules")); + // validate the required field `securityGroups` + Quota.validateJsonElement(jsonObj.get("securityGroups")); + // validate the required field `snapshots` + Quota.validateJsonElement(jsonObj.get("snapshots")); + // validate the required field `vcpu` + Quota.validateJsonElement(jsonObj.get("vcpu")); + // validate the required field `volumes` + Quota.validateJsonElement(jsonObj.get("volumes")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!QuotaList.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'QuotaList' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(QuotaList.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, QuotaList 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 QuotaList read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + QuotaList 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 QuotaList given an JSON string + * + * @param jsonString JSON string + * @return An instance of QuotaList + * @throws IOException if the JSON string is invalid with respect to QuotaList + */ + public static QuotaList fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, QuotaList.class); + } + + /** + * Convert an instance of QuotaList to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/QuotaListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/QuotaListResponse.java new file mode 100644 index 00000000..24818cbe --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/QuotaListResponse.java @@ -0,0 +1,303 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** Quotas list response. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class QuotaListResponse { + public static final String SERIALIZED_NAME_QUOTAS = "quotas"; + + @SerializedName(SERIALIZED_NAME_QUOTAS) + @javax.annotation.Nonnull + private QuotaList quotas; + + public QuotaListResponse() {} + + public QuotaListResponse quotas(@javax.annotation.Nonnull QuotaList quotas) { + this.quotas = quotas; + return this; + } + + /** + * Get quotas + * + * @return quotas + */ + @javax.annotation.Nonnull + public QuotaList getQuotas() { + return quotas; + } + + public void setQuotas(@javax.annotation.Nonnull QuotaList quotas) { + this.quotas = quotas; + } + + /** + * 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 QuotaListResponse instance itself + */ + public QuotaListResponse 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; + } + QuotaListResponse quotaListResponse = (QuotaListResponse) o; + return Objects.equals(this.quotas, quotaListResponse.quotas) + && Objects.equals( + this.additionalProperties, quotaListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(quotas, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class QuotaListResponse {\n"); + sb.append(" quotas: ").append(toIndentedString(quotas)).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("quotas")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("quotas")); + } + + /** + * 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 QuotaListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!QuotaListResponse.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 QuotaListResponse is not found in the empty JSON string", + QuotaListResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : QuotaListResponse.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 `quotas` + QuotaList.validateJsonElement(jsonObj.get("quotas")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!QuotaListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'QuotaListResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(QuotaListResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, QuotaListResponse 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 QuotaListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + QuotaListResponse 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 QuotaListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of QuotaListResponse + * @throws IOException if the JSON string is invalid with respect to QuotaListResponse + */ + public static QuotaListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, QuotaListResponse.class); + } + + /** + * Convert an instance of QuotaListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/RegionalArea.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/RegionalArea.java new file mode 100644 index 00000000..e7886758 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/RegionalArea.java @@ -0,0 +1,320 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** The basic properties of a regional network area. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class RegionalArea { + public static final String SERIALIZED_NAME_IPV4 = "ipv4"; + + @SerializedName(SERIALIZED_NAME_IPV4) + @javax.annotation.Nullable private RegionalAreaIPv4 ipv4; + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable private String status; + + public RegionalArea() {} + + public RegionalArea(String status) { + this(); + this.status = status; + } + + public RegionalArea ipv4(@javax.annotation.Nullable RegionalAreaIPv4 ipv4) { + this.ipv4 = ipv4; + return this; + } + + /** + * Get ipv4 + * + * @return ipv4 + */ + @javax.annotation.Nullable public RegionalAreaIPv4 getIpv4() { + return ipv4; + } + + public void setIpv4(@javax.annotation.Nullable RegionalAreaIPv4 ipv4) { + this.ipv4 = ipv4; + } + + /** + * The state of a resource object. Possible values: `CREATING`, `CREATED`, + * `DELETING`, `DELETED`, `FAILED`, `UPDATED`, + * `UPDATING`. + * + * @return status + */ + @javax.annotation.Nullable public String getStatus() { + return status; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the RegionalArea instance itself + */ + public RegionalArea 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; + } + RegionalArea regionalArea = (RegionalArea) o; + return Objects.equals(this.ipv4, regionalArea.ipv4) + && Objects.equals(this.status, regionalArea.status) + && Objects.equals(this.additionalProperties, regionalArea.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(ipv4, status, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RegionalArea {\n"); + sb.append(" ipv4: ").append(toIndentedString(ipv4)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("ipv4", "status")); + + // 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 RegionalArea + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RegionalArea.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 RegionalArea is not found in the empty JSON string", + RegionalArea.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `ipv4` + if (jsonObj.get("ipv4") != null && !jsonObj.get("ipv4").isJsonNull()) { + RegionalAreaIPv4.validateJsonElement(jsonObj.get("ipv4")); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) + && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `status` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("status").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RegionalArea.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RegionalArea' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(RegionalArea.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, RegionalArea 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 RegionalArea read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + RegionalArea 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 RegionalArea given an JSON string + * + * @param jsonString JSON string + * @return An instance of RegionalArea + * @throws IOException if the JSON string is invalid with respect to RegionalArea + */ + public static RegionalArea fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RegionalArea.class); + } + + /** + * Convert an instance of RegionalArea to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/RegionalAreaIPv4.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/RegionalAreaIPv4.java new file mode 100644 index 00000000..cc71c3a6 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/RegionalAreaIPv4.java @@ -0,0 +1,509 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** The regional IPv4 config of a network area. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class RegionalAreaIPv4 { + public static final String SERIALIZED_NAME_DEFAULT_NAMESERVERS = "defaultNameservers"; + + @SerializedName(SERIALIZED_NAME_DEFAULT_NAMESERVERS) + @javax.annotation.Nullable private List defaultNameservers = new ArrayList<>(); + + public static final String SERIALIZED_NAME_DEFAULT_PREFIX_LEN = "defaultPrefixLen"; + + @SerializedName(SERIALIZED_NAME_DEFAULT_PREFIX_LEN) + @javax.annotation.Nonnull + private Long defaultPrefixLen = 25l; + + public static final String SERIALIZED_NAME_MAX_PREFIX_LEN = "maxPrefixLen"; + + @SerializedName(SERIALIZED_NAME_MAX_PREFIX_LEN) + @javax.annotation.Nonnull + private Long maxPrefixLen = 29l; + + public static final String SERIALIZED_NAME_MIN_PREFIX_LEN = "minPrefixLen"; + + @SerializedName(SERIALIZED_NAME_MIN_PREFIX_LEN) + @javax.annotation.Nonnull + private Long minPrefixLen = 24l; + + public static final String SERIALIZED_NAME_NETWORK_RANGES = "networkRanges"; + + @SerializedName(SERIALIZED_NAME_NETWORK_RANGES) + @javax.annotation.Nonnull + private List networkRanges = new ArrayList<>(); + + public static final String SERIALIZED_NAME_TRANSFER_NETWORK = "transferNetwork"; + + @SerializedName(SERIALIZED_NAME_TRANSFER_NETWORK) + @javax.annotation.Nonnull + private String transferNetwork; + + public RegionalAreaIPv4() {} + + public RegionalAreaIPv4 defaultNameservers( + @javax.annotation.Nullable List defaultNameservers) { + this.defaultNameservers = defaultNameservers; + return this; + } + + public RegionalAreaIPv4 addDefaultNameserversItem(String defaultNameserversItem) { + if (this.defaultNameservers == null) { + this.defaultNameservers = new ArrayList<>(); + } + this.defaultNameservers.add(defaultNameserversItem); + return this; + } + + /** + * Get defaultNameservers + * + * @return defaultNameservers + */ + @javax.annotation.Nullable public List getDefaultNameservers() { + return defaultNameservers; + } + + public void setDefaultNameservers(@javax.annotation.Nullable List defaultNameservers) { + this.defaultNameservers = defaultNameservers; + } + + public RegionalAreaIPv4 defaultPrefixLen(@javax.annotation.Nonnull Long defaultPrefixLen) { + this.defaultPrefixLen = defaultPrefixLen; + return this; + } + + /** + * The default prefix length for networks in the network area. minimum: 24 maximum: 29 + * + * @return defaultPrefixLen + */ + @javax.annotation.Nonnull + public Long getDefaultPrefixLen() { + return defaultPrefixLen; + } + + public void setDefaultPrefixLen(@javax.annotation.Nonnull Long defaultPrefixLen) { + this.defaultPrefixLen = defaultPrefixLen; + } + + public RegionalAreaIPv4 maxPrefixLen(@javax.annotation.Nonnull Long maxPrefixLen) { + this.maxPrefixLen = maxPrefixLen; + return this; + } + + /** + * The maximal prefix length for networks in the network area. minimum: 24 maximum: 29 + * + * @return maxPrefixLen + */ + @javax.annotation.Nonnull + public Long getMaxPrefixLen() { + return maxPrefixLen; + } + + public void setMaxPrefixLen(@javax.annotation.Nonnull Long maxPrefixLen) { + this.maxPrefixLen = maxPrefixLen; + } + + public RegionalAreaIPv4 minPrefixLen(@javax.annotation.Nonnull Long minPrefixLen) { + this.minPrefixLen = minPrefixLen; + return this; + } + + /** + * The minimal prefix length for networks in the network area. minimum: 8 maximum: 29 + * + * @return minPrefixLen + */ + @javax.annotation.Nonnull + public Long getMinPrefixLen() { + return minPrefixLen; + } + + public void setMinPrefixLen(@javax.annotation.Nonnull Long minPrefixLen) { + this.minPrefixLen = minPrefixLen; + } + + public RegionalAreaIPv4 networkRanges( + @javax.annotation.Nonnull List networkRanges) { + this.networkRanges = networkRanges; + return this; + } + + public RegionalAreaIPv4 addNetworkRangesItem(NetworkRange networkRangesItem) { + if (this.networkRanges == null) { + this.networkRanges = new ArrayList<>(); + } + this.networkRanges.add(networkRangesItem); + return this; + } + + /** + * A list of network ranges. + * + * @return networkRanges + */ + @javax.annotation.Nonnull + public List getNetworkRanges() { + return networkRanges; + } + + public void setNetworkRanges(@javax.annotation.Nonnull List networkRanges) { + this.networkRanges = networkRanges; + } + + public RegionalAreaIPv4 transferNetwork(@javax.annotation.Nonnull String transferNetwork) { + this.transferNetwork = transferNetwork; + return this; + } + + /** + * IPv4 Classless Inter-Domain Routing (CIDR). + * + * @return transferNetwork + */ + @javax.annotation.Nonnull + public String getTransferNetwork() { + return transferNetwork; + } + + public void setTransferNetwork(@javax.annotation.Nonnull String transferNetwork) { + this.transferNetwork = transferNetwork; + } + + /** + * 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 RegionalAreaIPv4 instance itself + */ + public RegionalAreaIPv4 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; + } + RegionalAreaIPv4 regionalAreaIPv4 = (RegionalAreaIPv4) o; + return Objects.equals(this.defaultNameservers, regionalAreaIPv4.defaultNameservers) + && Objects.equals(this.defaultPrefixLen, regionalAreaIPv4.defaultPrefixLen) + && Objects.equals(this.maxPrefixLen, regionalAreaIPv4.maxPrefixLen) + && Objects.equals(this.minPrefixLen, regionalAreaIPv4.minPrefixLen) + && Objects.equals(this.networkRanges, regionalAreaIPv4.networkRanges) + && Objects.equals(this.transferNetwork, regionalAreaIPv4.transferNetwork) + && Objects.equals(this.additionalProperties, regionalAreaIPv4.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + defaultNameservers, + defaultPrefixLen, + maxPrefixLen, + minPrefixLen, + networkRanges, + transferNetwork, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RegionalAreaIPv4 {\n"); + sb.append(" defaultNameservers: ") + .append(toIndentedString(defaultNameservers)) + .append("\n"); + sb.append(" defaultPrefixLen: ").append(toIndentedString(defaultPrefixLen)).append("\n"); + sb.append(" maxPrefixLen: ").append(toIndentedString(maxPrefixLen)).append("\n"); + sb.append(" minPrefixLen: ").append(toIndentedString(minPrefixLen)).append("\n"); + sb.append(" networkRanges: ").append(toIndentedString(networkRanges)).append("\n"); + sb.append(" transferNetwork: ").append(toIndentedString(transferNetwork)).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( + "defaultNameservers", + "defaultPrefixLen", + "maxPrefixLen", + "minPrefixLen", + "networkRanges", + "transferNetwork")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = + new HashSet( + Arrays.asList( + "defaultPrefixLen", + "maxPrefixLen", + "minPrefixLen", + "networkRanges", + "transferNetwork")); + } + + /** + * 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 RegionalAreaIPv4 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RegionalAreaIPv4.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 RegionalAreaIPv4 is not found in the empty JSON string", + RegionalAreaIPv4.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RegionalAreaIPv4.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 optional json data is an array if present + if (jsonObj.get("defaultNameservers") != null + && !jsonObj.get("defaultNameservers").isJsonNull() + && !jsonObj.get("defaultNameservers").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `defaultNameservers` to be an array in the JSON string but got `%s`", + jsonObj.get("defaultNameservers").toString())); + } + // ensure the json data is an array + if (!jsonObj.get("networkRanges").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `networkRanges` to be an array in the JSON string but got `%s`", + jsonObj.get("networkRanges").toString())); + } + + JsonArray jsonArraynetworkRanges = jsonObj.getAsJsonArray("networkRanges"); + // validate the required field `networkRanges` (array) + for (int i = 0; i < jsonArraynetworkRanges.size(); i++) { + NetworkRange.validateJsonElement(jsonArraynetworkRanges.get(i)); + } + ; + if (!jsonObj.get("transferNetwork").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `transferNetwork` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("transferNetwork").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RegionalAreaIPv4.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RegionalAreaIPv4' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(RegionalAreaIPv4.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, RegionalAreaIPv4 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 RegionalAreaIPv4 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + RegionalAreaIPv4 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 RegionalAreaIPv4 given an JSON string + * + * @param jsonString JSON string + * @return An instance of RegionalAreaIPv4 + * @throws IOException if the JSON string is invalid with respect to RegionalAreaIPv4 + */ + public static RegionalAreaIPv4 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RegionalAreaIPv4.class); + } + + /** + * Convert an instance of RegionalAreaIPv4 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/RegionalAreaListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/RegionalAreaListResponse.java new file mode 100644 index 00000000..08328866 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/RegionalAreaListResponse.java @@ -0,0 +1,311 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** Regional area list response. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class RegionalAreaListResponse { + public static final String SERIALIZED_NAME_REGIONS = "regions"; + + @SerializedName(SERIALIZED_NAME_REGIONS) + @javax.annotation.Nonnull + private Map regions = new HashMap<>(); + + public RegionalAreaListResponse() {} + + public RegionalAreaListResponse regions( + @javax.annotation.Nonnull Map regions) { + this.regions = regions; + return this; + } + + public RegionalAreaListResponse putRegionsItem(String key, RegionalArea regionsItem) { + if (this.regions == null) { + this.regions = new HashMap<>(); + } + this.regions.put(key, regionsItem); + return this; + } + + /** + * Get regions + * + * @return regions + */ + @javax.annotation.Nonnull + public Map getRegions() { + return regions; + } + + public void setRegions(@javax.annotation.Nonnull Map regions) { + this.regions = regions; + } + + /** + * 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 RegionalAreaListResponse instance itself + */ + public RegionalAreaListResponse 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; + } + RegionalAreaListResponse regionalAreaListResponse = (RegionalAreaListResponse) o; + return Objects.equals(this.regions, regionalAreaListResponse.regions) + && Objects.equals( + this.additionalProperties, regionalAreaListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(regions, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RegionalAreaListResponse {\n"); + sb.append(" regions: ").append(toIndentedString(regions)).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("regions")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("regions")); + } + + /** + * 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 RegionalAreaListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RegionalAreaListResponse.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 RegionalAreaListResponse is not found in the empty JSON string", + RegionalAreaListResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RegionalAreaListResponse.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "The required field `%s` is not found in the JSON string: %s", + requiredField, + jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RegionalAreaListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RegionalAreaListResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(RegionalAreaListResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, RegionalAreaListResponse 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 RegionalAreaListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + RegionalAreaListResponse 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 RegionalAreaListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of RegionalAreaListResponse + * @throws IOException if the JSON string is invalid with respect to RegionalAreaListResponse + */ + public static RegionalAreaListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RegionalAreaListResponse.class); + } + + /** + * Convert an instance of RegionalAreaListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/Request.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/Request.java new file mode 100644 index 00000000..8ac6c889 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/Request.java @@ -0,0 +1,521 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** Object that represents a request. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class Request { + public static final String SERIALIZED_NAME_DETAILS = "details"; + + @SerializedName(SERIALIZED_NAME_DETAILS) + @javax.annotation.Nullable private String details; + + public static final String SERIALIZED_NAME_REQUEST_ACTION = "requestAction"; + + @SerializedName(SERIALIZED_NAME_REQUEST_ACTION) + @javax.annotation.Nonnull + private String requestAction; + + public static final String SERIALIZED_NAME_REQUEST_ID = "requestId"; + + @SerializedName(SERIALIZED_NAME_REQUEST_ID) + @javax.annotation.Nonnull + private String requestId; + + public static final String SERIALIZED_NAME_REQUEST_TYPE = "requestType"; + + @SerializedName(SERIALIZED_NAME_REQUEST_TYPE) + @javax.annotation.Nonnull + private String requestType; + + public static final String SERIALIZED_NAME_RESOURCES = "resources"; + + @SerializedName(SERIALIZED_NAME_RESOURCES) + @javax.annotation.Nonnull + private List resources = new ArrayList<>(); + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nonnull + private String status; + + public Request() {} + + public Request details(@javax.annotation.Nullable String details) { + this.details = details; + return this; + } + + /** + * Get details + * + * @return details + */ + @javax.annotation.Nullable public String getDetails() { + return details; + } + + public void setDetails(@javax.annotation.Nullable String details) { + this.details = details; + } + + public Request requestAction(@javax.annotation.Nonnull String requestAction) { + this.requestAction = requestAction; + return this; + } + + /** + * Object that represents a resource action. Possible values: `CREATE`, + * `DELETE`, `UPDATE`. + * + * @return requestAction + */ + @javax.annotation.Nonnull + public String getRequestAction() { + return requestAction; + } + + public void setRequestAction(@javax.annotation.Nonnull String requestAction) { + this.requestAction = requestAction; + } + + public Request requestId(@javax.annotation.Nonnull String requestId) { + this.requestId = requestId; + return this; + } + + /** + * Identifier (ID) representing a single API request. + * + * @return requestId + */ + @javax.annotation.Nonnull + public String getRequestId() { + return requestId; + } + + public void setRequestId(@javax.annotation.Nonnull String requestId) { + this.requestId = requestId; + } + + public Request requestType(@javax.annotation.Nonnull String requestType) { + this.requestType = requestType; + return this; + } + + /** + * Object that represents a resource type. Possible values: `BACKUP`, + * `IMAGE`, `NETWORK`, `NETWORKAREA`, `NIC`, + * `PROJECT`, `ROUTE`, `SERVER`, `SERVICEACCOUNT`, + * `SNAPSHOT`, `VIRTUALIP`, `VOLUME`. + * + * @return requestType + */ + @javax.annotation.Nonnull + public String getRequestType() { + return requestType; + } + + public void setRequestType(@javax.annotation.Nonnull String requestType) { + this.requestType = requestType; + } + + public Request resources(@javax.annotation.Nonnull List resources) { + this.resources = resources; + return this; + } + + public Request addResourcesItem(RequestResource resourcesItem) { + if (this.resources == null) { + this.resources = new ArrayList<>(); + } + this.resources.add(resourcesItem); + return this; + } + + /** + * Get resources + * + * @return resources + */ + @javax.annotation.Nonnull + public List getResources() { + return resources; + } + + public void setResources(@javax.annotation.Nonnull List resources) { + this.resources = resources; + } + + public Request status(@javax.annotation.Nonnull String status) { + this.status = status; + return this; + } + + /** + * The state of a resource object. Possible values: `CREATING`, `CREATED`, + * `DELETING`, `DELETED`, `FAILED`, `UPDATED`, + * `UPDATING`. + * + * @return status + */ + @javax.annotation.Nonnull + public String getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nonnull String status) { + this.status = status; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Request instance itself + */ + public Request 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; + } + Request request = (Request) o; + return Objects.equals(this.details, request.details) + && Objects.equals(this.requestAction, request.requestAction) + && Objects.equals(this.requestId, request.requestId) + && Objects.equals(this.requestType, request.requestType) + && Objects.equals(this.resources, request.resources) + && Objects.equals(this.status, request.status) + && Objects.equals(this.additionalProperties, request.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + details, + requestAction, + requestId, + requestType, + resources, + status, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Request {\n"); + sb.append(" details: ").append(toIndentedString(details)).append("\n"); + sb.append(" requestAction: ").append(toIndentedString(requestAction)).append("\n"); + sb.append(" requestId: ").append(toIndentedString(requestId)).append("\n"); + sb.append(" requestType: ").append(toIndentedString(requestType)).append("\n"); + sb.append(" resources: ").append(toIndentedString(resources)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = + new HashSet( + Arrays.asList( + "details", + "requestAction", + "requestId", + "requestType", + "resources", + "status")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = + new HashSet( + Arrays.asList( + "requestAction", + "requestId", + "requestType", + "resources", + "status")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Request + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Request.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 Request is not found in the empty JSON string", + Request.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Request.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("details") != null && !jsonObj.get("details").isJsonNull()) + && !jsonObj.get("details").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `details` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("details").toString())); + } + if (!jsonObj.get("requestAction").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `requestAction` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("requestAction").toString())); + } + if (!jsonObj.get("requestId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `requestId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("requestId").toString())); + } + if (!jsonObj.get("requestType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `requestType` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("requestType").toString())); + } + // ensure the json data is an array + if (!jsonObj.get("resources").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `resources` to be an array in the JSON string but got `%s`", + jsonObj.get("resources").toString())); + } + + JsonArray jsonArrayresources = jsonObj.getAsJsonArray("resources"); + // validate the required field `resources` (array) + for (int i = 0; i < jsonArrayresources.size(); i++) { + RequestResource.validateJsonElement(jsonArrayresources.get(i)); + } + ; + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `status` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("status").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Request.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Request' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(Request.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, Request 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 Request read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Request 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 Request given an JSON string + * + * @param jsonString JSON string + * @return An instance of Request + * @throws IOException if the JSON string is invalid with respect to Request + */ + public static Request fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Request.class); + } + + /** + * Convert an instance of Request to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/RequestResource.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/RequestResource.java new file mode 100644 index 00000000..151e9d8f --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/RequestResource.java @@ -0,0 +1,381 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +/** Object that represents a resource as part of a request. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class RequestResource { + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private UUID id; + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nonnull + private String status; + + public static final String SERIALIZED_NAME_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private String type; + + public RequestResource() {} + + public RequestResource id(@javax.annotation.Nonnull UUID id) { + this.id = id; + return this; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nonnull + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull UUID id) { + this.id = id; + } + + public RequestResource status(@javax.annotation.Nonnull String status) { + this.status = status; + return this; + } + + /** + * The state of a resource object. Possible values: `CREATING`, `CREATED`, + * `DELETING`, `DELETED`, `FAILED`, `UPDATED`, + * `UPDATING`. + * + * @return status + */ + @javax.annotation.Nonnull + public String getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nonnull String status) { + this.status = status; + } + + public RequestResource type(@javax.annotation.Nonnull String type) { + this.type = type; + return this; + } + + /** + * Object that represents a resource type. Possible values: `BACKUP`, + * `IMAGE`, `NETWORK`, `NETWORKAREA`, `NIC`, + * `PROJECT`, `ROUTE`, `SERVER`, `SERVICEACCOUNT`, + * `SNAPSHOT`, `VIRTUALIP`, `VOLUME`. + * + * @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 RequestResource instance itself + */ + public RequestResource 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; + } + RequestResource requestResource = (RequestResource) o; + return Objects.equals(this.id, requestResource.id) + && Objects.equals(this.status, requestResource.status) + && Objects.equals(this.type, requestResource.type) + && Objects.equals(this.additionalProperties, requestResource.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, status, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RequestResource {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).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("id", "status", "type")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("id", "status", "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 RequestResource + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RequestResource.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 RequestResource is not found in the empty JSON string", + RequestResource.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RequestResource.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("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `status` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("status").toString())); + } + 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 (!RequestResource.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RequestResource' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(RequestResource.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, RequestResource 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 RequestResource read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + RequestResource 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 RequestResource given an JSON string + * + * @param jsonString JSON string + * @return An instance of RequestResource + * @throws IOException if the JSON string is invalid with respect to RequestResource + */ + public static RequestResource fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RequestResource.class); + } + + /** + * Convert an instance of RequestResource to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/RescueServerPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/RescueServerPayload.java new file mode 100644 index 00000000..8c2c0c38 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/RescueServerPayload.java @@ -0,0 +1,309 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +/** RescueServerPayload */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class RescueServerPayload { + public static final String SERIALIZED_NAME_IMAGE = "image"; + + @SerializedName(SERIALIZED_NAME_IMAGE) + @javax.annotation.Nonnull + private UUID image; + + public RescueServerPayload() {} + + public RescueServerPayload image(@javax.annotation.Nonnull UUID image) { + this.image = image; + return this; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return image + */ + @javax.annotation.Nonnull + public UUID getImage() { + return image; + } + + public void setImage(@javax.annotation.Nonnull UUID image) { + this.image = image; + } + + /** + * 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 RescueServerPayload instance itself + */ + public RescueServerPayload 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; + } + RescueServerPayload rescueServerPayload = (RescueServerPayload) o; + return Objects.equals(this.image, rescueServerPayload.image) + && Objects.equals( + this.additionalProperties, rescueServerPayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(image, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RescueServerPayload {\n"); + sb.append(" image: ").append(toIndentedString(image)).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("image")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("image")); + } + + /** + * 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 RescueServerPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RescueServerPayload.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 RescueServerPayload is not found in the empty JSON string", + RescueServerPayload.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RescueServerPayload.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("image").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `image` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("image").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RescueServerPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RescueServerPayload' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(RescueServerPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, RescueServerPayload 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 RescueServerPayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + RescueServerPayload 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 RescueServerPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of RescueServerPayload + * @throws IOException if the JSON string is invalid with respect to RescueServerPayload + */ + public static RescueServerPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RescueServerPayload.class); + } + + /** + * Convert an instance of RescueServerPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ResizeServerPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ResizeServerPayload.java new file mode 100644 index 00000000..21031c63 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ResizeServerPayload.java @@ -0,0 +1,308 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** ResizeServerPayload */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class ResizeServerPayload { + public static final String SERIALIZED_NAME_MACHINE_TYPE = "machineType"; + + @SerializedName(SERIALIZED_NAME_MACHINE_TYPE) + @javax.annotation.Nonnull + private String machineType; + + public ResizeServerPayload() {} + + public ResizeServerPayload machineType(@javax.annotation.Nonnull String machineType) { + this.machineType = machineType; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return machineType + */ + @javax.annotation.Nonnull + public String getMachineType() { + return machineType; + } + + public void setMachineType(@javax.annotation.Nonnull String machineType) { + this.machineType = machineType; + } + + /** + * 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 ResizeServerPayload instance itself + */ + public ResizeServerPayload 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; + } + ResizeServerPayload resizeServerPayload = (ResizeServerPayload) o; + return Objects.equals(this.machineType, resizeServerPayload.machineType) + && Objects.equals( + this.additionalProperties, resizeServerPayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(machineType, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ResizeServerPayload {\n"); + sb.append(" machineType: ").append(toIndentedString(machineType)).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("machineType")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("machineType")); + } + + /** + * 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 ResizeServerPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ResizeServerPayload.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 ResizeServerPayload is not found in the empty JSON string", + ResizeServerPayload.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ResizeServerPayload.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("machineType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `machineType` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("machineType").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ResizeServerPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ResizeServerPayload' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ResizeServerPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ResizeServerPayload 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 ResizeServerPayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ResizeServerPayload 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 ResizeServerPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of ResizeServerPayload + * @throws IOException if the JSON string is invalid with respect to ResizeServerPayload + */ + public static ResizeServerPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ResizeServerPayload.class); + } + + /** + * Convert an instance of ResizeServerPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ResizeVolumePayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ResizeVolumePayload.java new file mode 100644 index 00000000..922f1036 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ResizeVolumePayload.java @@ -0,0 +1,301 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** ResizeVolumePayload */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class ResizeVolumePayload { + public static final String SERIALIZED_NAME_SIZE = "size"; + + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nonnull + private Long size; + + public ResizeVolumePayload() {} + + public ResizeVolumePayload size(@javax.annotation.Nonnull Long size) { + this.size = size; + return this; + } + + /** + * Size in Gigabyte. + * + * @return size + */ + @javax.annotation.Nonnull + public Long getSize() { + return size; + } + + public void setSize(@javax.annotation.Nonnull Long size) { + this.size = size; + } + + /** + * 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 ResizeVolumePayload instance itself + */ + public ResizeVolumePayload 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; + } + ResizeVolumePayload resizeVolumePayload = (ResizeVolumePayload) o; + return Objects.equals(this.size, resizeVolumePayload.size) + && Objects.equals( + this.additionalProperties, resizeVolumePayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(size, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ResizeVolumePayload {\n"); + sb.append(" size: ").append(toIndentedString(size)).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("size")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("size")); + } + + /** + * 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 ResizeVolumePayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ResizeVolumePayload.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 ResizeVolumePayload is not found in the empty JSON string", + ResizeVolumePayload.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ResizeVolumePayload.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "The required field `%s` is not found in the JSON string: %s", + requiredField, + jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ResizeVolumePayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ResizeVolumePayload' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ResizeVolumePayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ResizeVolumePayload 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 ResizeVolumePayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ResizeVolumePayload 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 ResizeVolumePayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of ResizeVolumePayload + * @throws IOException if the JSON string is invalid with respect to ResizeVolumePayload + */ + public static ResizeVolumePayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ResizeVolumePayload.class); + } + + /** + * Convert an instance of ResizeVolumePayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/Route.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/Route.java new file mode 100644 index 00000000..a78f843f --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/Route.java @@ -0,0 +1,433 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; +import java.util.UUID; + +/** Object represents a network route. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class Route { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_DESTINATION = "destination"; + + @SerializedName(SERIALIZED_NAME_DESTINATION) + @javax.annotation.Nonnull + private RouteDestination destination; + + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NEXTHOP = "nexthop"; + + @SerializedName(SERIALIZED_NAME_NEXTHOP) + @javax.annotation.Nonnull + private RouteNexthop nexthop; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable private OffsetDateTime updatedAt; + + public Route() {} + + public Route(OffsetDateTime createdAt, UUID id, OffsetDateTime updatedAt) { + this(); + this.createdAt = createdAt; + this.id = id; + this.updatedAt = updatedAt; + } + + /** + * Date-time when resource was created. + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public Route destination(@javax.annotation.Nonnull RouteDestination destination) { + this.destination = destination; + return this; + } + + /** + * Get destination + * + * @return destination + */ + @javax.annotation.Nonnull + public RouteDestination getDestination() { + return destination; + } + + public void setDestination(@javax.annotation.Nonnull RouteDestination destination) { + this.destination = destination; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + public Route labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public Route nexthop(@javax.annotation.Nonnull RouteNexthop nexthop) { + this.nexthop = nexthop; + return this; + } + + /** + * Get nexthop + * + * @return nexthop + */ + @javax.annotation.Nonnull + public RouteNexthop getNexthop() { + return nexthop; + } + + public void setNexthop(@javax.annotation.Nonnull RouteNexthop nexthop) { + this.nexthop = nexthop; + } + + /** + * Date-time when resource was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nullable public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * 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 Route instance itself + */ + public Route 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; + } + Route route = (Route) o; + return Objects.equals(this.createdAt, route.createdAt) + && Objects.equals(this.destination, route.destination) + && Objects.equals(this.id, route.id) + && Objects.equals(this.labels, route.labels) + && Objects.equals(this.nexthop, route.nexthop) + && Objects.equals(this.updatedAt, route.updatedAt) + && Objects.equals(this.additionalProperties, route.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + createdAt, destination, id, labels, nexthop, updatedAt, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Route {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" destination: ").append(toIndentedString(destination)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" nexthop: ").append(toIndentedString(nexthop)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).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( + "createdAt", + "destination", + "id", + "labels", + "nexthop", + "updatedAt")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("destination", "nexthop")); + } + + /** + * 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 Route + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Route.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 Route is not found in the empty JSON string", + Route.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Route.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 `destination` + RouteDestination.validateJsonElement(jsonObj.get("destination")); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + // validate the required field `nexthop` + RouteNexthop.validateJsonElement(jsonObj.get("nexthop")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Route.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Route' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(Route.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, Route 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 Route read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Route 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 Route given an JSON string + * + * @param jsonString JSON string + * @return An instance of Route + * @throws IOException if the JSON string is invalid with respect to Route + */ + public static Route fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Route.class); + } + + /** + * Convert an instance of Route to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/RouteDestination.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/RouteDestination.java new file mode 100644 index 00000000..69e412f6 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/RouteDestination.java @@ -0,0 +1,290 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +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 RouteDestination extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(RouteDestination.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RouteDestination.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RouteDestination' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterDestinationCIDRv4 = + gson.getDelegateAdapter(this, TypeToken.get(DestinationCIDRv4.class)); + final TypeAdapter adapterDestinationCIDRv6 = + gson.getDelegateAdapter(this, TypeToken.get(DestinationCIDRv6.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, RouteDestination value) + throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `DestinationCIDRv4` + if (value.getActualInstance() instanceof DestinationCIDRv4) { + JsonElement element = + adapterDestinationCIDRv4.toJsonTree( + (DestinationCIDRv4) value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `DestinationCIDRv6` + if (value.getActualInstance() instanceof DestinationCIDRv6) { + JsonElement element = + adapterDestinationCIDRv6.toJsonTree( + (DestinationCIDRv6) value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException( + "Failed to serialize as the type doesn't match oneOf schemas: DestinationCIDRv4, DestinationCIDRv6"); + } + + @Override + public RouteDestination read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize DestinationCIDRv4 + try { + // validate the JSON object to see if any exception is thrown + DestinationCIDRv4.validateJsonElement(jsonElement); + actualAdapter = adapterDestinationCIDRv4; + match++; + log.log( + Level.FINER, + "Input data matches schema 'DestinationCIDRv4'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for DestinationCIDRv4 failed with `%s`.", + e.getMessage())); + log.log( + Level.FINER, + "Input data does not match schema 'DestinationCIDRv4'", + e); + } + // deserialize DestinationCIDRv6 + try { + // validate the JSON object to see if any exception is thrown + DestinationCIDRv6.validateJsonElement(jsonElement); + actualAdapter = adapterDestinationCIDRv6; + match++; + log.log( + Level.FINER, + "Input data matches schema 'DestinationCIDRv6'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for DestinationCIDRv6 failed with `%s`.", + e.getMessage())); + log.log( + Level.FINER, + "Input data does not match schema 'DestinationCIDRv6'", + e); + } + + if (match == 1) { + RouteDestination ret = new RouteDestination(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException( + String.format( + java.util.Locale.ROOT, + "Failed deserialization for RouteDestination: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", + match, + errorMessages, + jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public RouteDestination() { + super("oneOf", Boolean.FALSE); + } + + public RouteDestination(Object o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("DestinationCIDRv4", DestinationCIDRv4.class); + schemas.put("DestinationCIDRv6", DestinationCIDRv6.class); + } + + @Override + public Map> getSchemas() { + return RouteDestination.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: DestinationCIDRv4, DestinationCIDRv6 + * + *

It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof DestinationCIDRv4) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof DestinationCIDRv6) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException( + "Invalid instance type. Must be DestinationCIDRv4, DestinationCIDRv6"); + } + + /** + * Get the actual instance, which can be the following: DestinationCIDRv4, DestinationCIDRv6 + * + * @return The actual instance (DestinationCIDRv4, DestinationCIDRv6) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `DestinationCIDRv4`. If the actual instance is not + * `DestinationCIDRv4`, the ClassCastException will be thrown. + * + * @return The actual instance of `DestinationCIDRv4` + * @throws ClassCastException if the instance is not `DestinationCIDRv4` + */ + public DestinationCIDRv4 getDestinationCIDRv4() throws ClassCastException { + return (DestinationCIDRv4) super.getActualInstance(); + } + + /** + * Get the actual instance of `DestinationCIDRv6`. If the actual instance is not + * `DestinationCIDRv6`, the ClassCastException will be thrown. + * + * @return The actual instance of `DestinationCIDRv6` + * @throws ClassCastException if the instance is not `DestinationCIDRv6` + */ + public DestinationCIDRv6 getDestinationCIDRv6() throws ClassCastException { + return (DestinationCIDRv6) 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 RouteDestination + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with DestinationCIDRv4 + try { + DestinationCIDRv4.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for DestinationCIDRv4 failed with `%s`.", + e.getMessage())); + // continue to the next one + } + // validate the json string with DestinationCIDRv6 + try { + DestinationCIDRv6.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for DestinationCIDRv6 failed with `%s`.", + e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException( + String.format( + java.util.Locale.ROOT, + "The JSON string is invalid for RouteDestination with oneOf schemas: DestinationCIDRv4, DestinationCIDRv6. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", + validCount, + errorMessages, + jsonElement.toString())); + } + } + + /** + * Create an instance of RouteDestination given an JSON string + * + * @param jsonString JSON string + * @return An instance of RouteDestination + * @throws IOException if the JSON string is invalid with respect to RouteDestination + */ + public static RouteDestination fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RouteDestination.class); + } + + /** + * Convert an instance of RouteDestination to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/RouteListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/RouteListResponse.java new file mode 100644 index 00000000..c8a77925 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/RouteListResponse.java @@ -0,0 +1,326 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** Route list response. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class RouteListResponse { + public static final String SERIALIZED_NAME_ITEMS = "items"; + + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public RouteListResponse() {} + + public RouteListResponse items(@javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public RouteListResponse addItemsItem(Route itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list of routes. + * + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the RouteListResponse instance itself + */ + public RouteListResponse 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; + } + RouteListResponse routeListResponse = (RouteListResponse) o; + return Objects.equals(this.items, routeListResponse.items) + && Objects.equals( + this.additionalProperties, routeListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RouteListResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("items")); + } + + /** + * 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 RouteListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RouteListResponse.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 RouteListResponse is not found in the empty JSON string", + RouteListResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RouteListResponse.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("items").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `items` to be an array in the JSON string but got `%s`", + jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + Route.validateJsonElement(jsonArrayitems.get(i)); + } + ; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RouteListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RouteListResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(RouteListResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, RouteListResponse 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 RouteListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + RouteListResponse 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 RouteListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of RouteListResponse + * @throws IOException if the JSON string is invalid with respect to RouteListResponse + */ + public static RouteListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RouteListResponse.class); + } + + /** + * Convert an instance of RouteListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/RouteNexthop.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/RouteNexthop.java new file mode 100644 index 00000000..c583c9a7 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/RouteNexthop.java @@ -0,0 +1,404 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +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 RouteNexthop extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(RouteNexthop.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RouteNexthop.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RouteNexthop' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterNexthopIPv4 = + gson.getDelegateAdapter(this, TypeToken.get(NexthopIPv4.class)); + final TypeAdapter adapterNexthopIPv6 = + gson.getDelegateAdapter(this, TypeToken.get(NexthopIPv6.class)); + final TypeAdapter adapterNexthopInternet = + gson.getDelegateAdapter(this, TypeToken.get(NexthopInternet.class)); + final TypeAdapter adapterNexthopBlackhole = + gson.getDelegateAdapter(this, TypeToken.get(NexthopBlackhole.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, RouteNexthop value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `NexthopIPv4` + if (value.getActualInstance() instanceof NexthopIPv4) { + JsonElement element = + adapterNexthopIPv4.toJsonTree( + (NexthopIPv4) value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `NexthopIPv6` + if (value.getActualInstance() instanceof NexthopIPv6) { + JsonElement element = + adapterNexthopIPv6.toJsonTree( + (NexthopIPv6) value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `NexthopInternet` + if (value.getActualInstance() instanceof NexthopInternet) { + JsonElement element = + adapterNexthopInternet.toJsonTree( + (NexthopInternet) value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `NexthopBlackhole` + if (value.getActualInstance() instanceof NexthopBlackhole) { + JsonElement element = + adapterNexthopBlackhole.toJsonTree( + (NexthopBlackhole) value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException( + "Failed to serialize as the type doesn't match oneOf schemas: NexthopBlackhole, NexthopIPv4, NexthopIPv6, NexthopInternet"); + } + + @Override + public RouteNexthop read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize NexthopIPv4 + try { + // validate the JSON object to see if any exception is thrown + NexthopIPv4.validateJsonElement(jsonElement); + actualAdapter = adapterNexthopIPv4; + match++; + log.log(Level.FINER, "Input data matches schema 'NexthopIPv4'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for NexthopIPv4 failed with `%s`.", + e.getMessage())); + log.log( + Level.FINER, + "Input data does not match schema 'NexthopIPv4'", + e); + } + // deserialize NexthopIPv6 + try { + // validate the JSON object to see if any exception is thrown + NexthopIPv6.validateJsonElement(jsonElement); + actualAdapter = adapterNexthopIPv6; + match++; + log.log(Level.FINER, "Input data matches schema 'NexthopIPv6'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for NexthopIPv6 failed with `%s`.", + e.getMessage())); + log.log( + Level.FINER, + "Input data does not match schema 'NexthopIPv6'", + e); + } + // deserialize NexthopInternet + try { + // validate the JSON object to see if any exception is thrown + NexthopInternet.validateJsonElement(jsonElement); + actualAdapter = adapterNexthopInternet; + match++; + log.log(Level.FINER, "Input data matches schema 'NexthopInternet'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for NexthopInternet failed with `%s`.", + e.getMessage())); + log.log( + Level.FINER, + "Input data does not match schema 'NexthopInternet'", + e); + } + // deserialize NexthopBlackhole + try { + // validate the JSON object to see if any exception is thrown + NexthopBlackhole.validateJsonElement(jsonElement); + actualAdapter = adapterNexthopBlackhole; + match++; + log.log( + Level.FINER, + "Input data matches schema 'NexthopBlackhole'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for NexthopBlackhole failed with `%s`.", + e.getMessage())); + log.log( + Level.FINER, + "Input data does not match schema 'NexthopBlackhole'", + e); + } + + if (match == 1) { + RouteNexthop ret = new RouteNexthop(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException( + String.format( + java.util.Locale.ROOT, + "Failed deserialization for RouteNexthop: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", + match, + errorMessages, + jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public RouteNexthop() { + super("oneOf", Boolean.FALSE); + } + + public RouteNexthop(Object o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("NexthopIPv4", NexthopIPv4.class); + schemas.put("NexthopIPv6", NexthopIPv6.class); + schemas.put("NexthopInternet", NexthopInternet.class); + schemas.put("NexthopBlackhole", NexthopBlackhole.class); + } + + @Override + public Map> getSchemas() { + return RouteNexthop.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: NexthopBlackhole, NexthopIPv4, NexthopIPv6, NexthopInternet + * + *

It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof NexthopIPv4) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof NexthopIPv6) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof NexthopInternet) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof NexthopBlackhole) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException( + "Invalid instance type. Must be NexthopBlackhole, NexthopIPv4, NexthopIPv6, NexthopInternet"); + } + + /** + * Get the actual instance, which can be the following: NexthopBlackhole, NexthopIPv4, + * NexthopIPv6, NexthopInternet + * + * @return The actual instance (NexthopBlackhole, NexthopIPv4, NexthopIPv6, NexthopInternet) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `NexthopIPv4`. If the actual instance is not `NexthopIPv4`, the + * ClassCastException will be thrown. + * + * @return The actual instance of `NexthopIPv4` + * @throws ClassCastException if the instance is not `NexthopIPv4` + */ + public NexthopIPv4 getNexthopIPv4() throws ClassCastException { + return (NexthopIPv4) super.getActualInstance(); + } + + /** + * Get the actual instance of `NexthopIPv6`. If the actual instance is not `NexthopIPv6`, the + * ClassCastException will be thrown. + * + * @return The actual instance of `NexthopIPv6` + * @throws ClassCastException if the instance is not `NexthopIPv6` + */ + public NexthopIPv6 getNexthopIPv6() throws ClassCastException { + return (NexthopIPv6) super.getActualInstance(); + } + + /** + * Get the actual instance of `NexthopInternet`. If the actual instance is not + * `NexthopInternet`, the ClassCastException will be thrown. + * + * @return The actual instance of `NexthopInternet` + * @throws ClassCastException if the instance is not `NexthopInternet` + */ + public NexthopInternet getNexthopInternet() throws ClassCastException { + return (NexthopInternet) super.getActualInstance(); + } + + /** + * Get the actual instance of `NexthopBlackhole`. If the actual instance is not + * `NexthopBlackhole`, the ClassCastException will be thrown. + * + * @return The actual instance of `NexthopBlackhole` + * @throws ClassCastException if the instance is not `NexthopBlackhole` + */ + public NexthopBlackhole getNexthopBlackhole() throws ClassCastException { + return (NexthopBlackhole) 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 RouteNexthop + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with NexthopIPv4 + try { + NexthopIPv4.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for NexthopIPv4 failed with `%s`.", + e.getMessage())); + // continue to the next one + } + // validate the json string with NexthopIPv6 + try { + NexthopIPv6.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for NexthopIPv6 failed with `%s`.", + e.getMessage())); + // continue to the next one + } + // validate the json string with NexthopInternet + try { + NexthopInternet.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for NexthopInternet failed with `%s`.", + e.getMessage())); + // continue to the next one + } + // validate the json string with NexthopBlackhole + try { + NexthopBlackhole.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for NexthopBlackhole failed with `%s`.", + e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException( + String.format( + java.util.Locale.ROOT, + "The JSON string is invalid for RouteNexthop with oneOf schemas: NexthopBlackhole, NexthopIPv4, NexthopIPv6, NexthopInternet. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", + validCount, + errorMessages, + jsonElement.toString())); + } + } + + /** + * Create an instance of RouteNexthop given an JSON string + * + * @param jsonString JSON string + * @return An instance of RouteNexthop + * @throws IOException if the JSON string is invalid with respect to RouteNexthop + */ + public static RouteNexthop fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RouteNexthop.class); + } + + /** + * Convert an instance of RouteNexthop to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/RoutingTable.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/RoutingTable.java new file mode 100644 index 00000000..1dec0b90 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/RoutingTable.java @@ -0,0 +1,525 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; +import java.util.UUID; + +/** An object representing a routing table. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class RoutingTable { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_DEFAULT = "default"; + + @SerializedName(SERIALIZED_NAME_DEFAULT) + @javax.annotation.Nullable private Boolean _default = true; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable private String description; + + public static final String SERIALIZED_NAME_DYNAMIC_ROUTES = "dynamicRoutes"; + + @SerializedName(SERIALIZED_NAME_DYNAMIC_ROUTES) + @javax.annotation.Nullable private Boolean dynamicRoutes = true; + + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_SYSTEM_ROUTES = "systemRoutes"; + + @SerializedName(SERIALIZED_NAME_SYSTEM_ROUTES) + @javax.annotation.Nullable private Boolean systemRoutes = true; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable private OffsetDateTime updatedAt; + + public RoutingTable() {} + + public RoutingTable( + OffsetDateTime createdAt, Boolean _default, UUID id, OffsetDateTime updatedAt) { + this(); + this.createdAt = createdAt; + this._default = _default; + this.id = id; + this.updatedAt = updatedAt; + } + + /** + * Date-time when resource was created. + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * This is the default routing table. It can't be deleted and is used if the user does not + * specify it otherwise. + * + * @return _default + */ + @javax.annotation.Nullable public Boolean getDefault() { + return _default; + } + + public RoutingTable description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Description Object. Allows string up to 255 Characters. + * + * @return description + */ + @javax.annotation.Nullable public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + public RoutingTable dynamicRoutes(@javax.annotation.Nullable Boolean dynamicRoutes) { + this.dynamicRoutes = dynamicRoutes; + return this; + } + + /** + * A config setting for a routing table which allows propagation of dynamic routes to this + * routing table. + * + * @return dynamicRoutes + */ + @javax.annotation.Nullable public Boolean getDynamicRoutes() { + return dynamicRoutes; + } + + public void setDynamicRoutes(@javax.annotation.Nullable Boolean dynamicRoutes) { + this.dynamicRoutes = dynamicRoutes; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + public RoutingTable labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public RoutingTable name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + public RoutingTable systemRoutes(@javax.annotation.Nullable Boolean systemRoutes) { + this.systemRoutes = systemRoutes; + return this; + } + + /** + * A config setting for a routing table which allows installation of automatic system routes for + * connectivity between projects in the same SNA. + * + * @return systemRoutes + */ + @javax.annotation.Nullable public Boolean getSystemRoutes() { + return systemRoutes; + } + + public void setSystemRoutes(@javax.annotation.Nullable Boolean systemRoutes) { + this.systemRoutes = systemRoutes; + } + + /** + * Date-time when resource was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nullable public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * 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 RoutingTable instance itself + */ + public RoutingTable 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; + } + RoutingTable routingTable = (RoutingTable) o; + return Objects.equals(this.createdAt, routingTable.createdAt) + && Objects.equals(this._default, routingTable._default) + && Objects.equals(this.description, routingTable.description) + && Objects.equals(this.dynamicRoutes, routingTable.dynamicRoutes) + && Objects.equals(this.id, routingTable.id) + && Objects.equals(this.labels, routingTable.labels) + && Objects.equals(this.name, routingTable.name) + && Objects.equals(this.systemRoutes, routingTable.systemRoutes) + && Objects.equals(this.updatedAt, routingTable.updatedAt) + && Objects.equals(this.additionalProperties, routingTable.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + createdAt, + _default, + description, + dynamicRoutes, + id, + labels, + name, + systemRoutes, + updatedAt, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RoutingTable {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" _default: ").append(toIndentedString(_default)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" dynamicRoutes: ").append(toIndentedString(dynamicRoutes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" systemRoutes: ").append(toIndentedString(systemRoutes)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).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( + "createdAt", + "default", + "description", + "dynamicRoutes", + "id", + "labels", + "name", + "systemRoutes", + "updatedAt")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name")); + } + + /** + * 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 RoutingTable + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RoutingTable.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 RoutingTable is not found in the empty JSON string", + RoutingTable.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RoutingTable.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("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `description` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("description").toString())); + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if (!jsonObj.get("name").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())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RoutingTable.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RoutingTable' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(RoutingTable.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, RoutingTable 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 RoutingTable read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + RoutingTable 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 RoutingTable given an JSON string + * + * @param jsonString JSON string + * @return An instance of RoutingTable + * @throws IOException if the JSON string is invalid with respect to RoutingTable + */ + public static RoutingTable fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RoutingTable.class); + } + + /** + * Convert an instance of RoutingTable to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/RoutingTableListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/RoutingTableListResponse.java new file mode 100644 index 00000000..a3fb738e --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/RoutingTableListResponse.java @@ -0,0 +1,327 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** Routing table response. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class RoutingTableListResponse { + public static final String SERIALIZED_NAME_ITEMS = "items"; + + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public RoutingTableListResponse() {} + + public RoutingTableListResponse items(@javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public RoutingTableListResponse addItemsItem(RoutingTable itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list of routing tables. + * + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the RoutingTableListResponse instance itself + */ + public RoutingTableListResponse 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; + } + RoutingTableListResponse routingTableListResponse = (RoutingTableListResponse) o; + return Objects.equals(this.items, routingTableListResponse.items) + && Objects.equals( + this.additionalProperties, routingTableListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RoutingTableListResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("items")); + } + + /** + * 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 RoutingTableListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RoutingTableListResponse.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 RoutingTableListResponse is not found in the empty JSON string", + RoutingTableListResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RoutingTableListResponse.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("items").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `items` to be an array in the JSON string but got `%s`", + jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + RoutingTable.validateJsonElement(jsonArrayitems.get(i)); + } + ; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RoutingTableListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RoutingTableListResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(RoutingTableListResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, RoutingTableListResponse 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 RoutingTableListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + RoutingTableListResponse 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 RoutingTableListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of RoutingTableListResponse + * @throws IOException if the JSON string is invalid with respect to RoutingTableListResponse + */ + public static RoutingTableListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RoutingTableListResponse.class); + } + + /** + * Convert an instance of RoutingTableListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/SecurityGroup.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/SecurityGroup.java new file mode 100644 index 00000000..aae6dedb --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/SecurityGroup.java @@ -0,0 +1,519 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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.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; +import java.util.UUID; + +/** Object that represents a security group. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class SecurityGroup { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable private String description; + + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_RULES = "rules"; + + @SerializedName(SERIALIZED_NAME_RULES) + @javax.annotation.Nullable private List rules; + + public static final String SERIALIZED_NAME_STATEFUL = "stateful"; + + @SerializedName(SERIALIZED_NAME_STATEFUL) + @javax.annotation.Nullable private Boolean stateful = true; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable private OffsetDateTime updatedAt; + + public SecurityGroup() {} + + public SecurityGroup( + OffsetDateTime createdAt, + UUID id, + List rules, + OffsetDateTime updatedAt) { + this(); + this.createdAt = createdAt; + this.id = id; + this.rules = rules; + this.updatedAt = updatedAt; + } + + /** + * Date-time when resource was created. + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public SecurityGroup description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Description Object. Allows string up to 255 Characters. + * + * @return description + */ + @javax.annotation.Nullable public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + public SecurityGroup labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public SecurityGroup name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + /** + * A list containing security group rule objects. + * + * @return rules + */ + @javax.annotation.Nullable public List getRules() { + return rules; + } + + public SecurityGroup stateful(@javax.annotation.Nullable Boolean stateful) { + this.stateful = stateful; + return this; + } + + /** + * Shows if a security group is stateful or stateless. You can only have one type of security + * groups per network interface/server. + * + * @return stateful + */ + @javax.annotation.Nullable public Boolean getStateful() { + return stateful; + } + + public void setStateful(@javax.annotation.Nullable Boolean stateful) { + this.stateful = stateful; + } + + /** + * Date-time when resource was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nullable public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * 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 SecurityGroup instance itself + */ + public SecurityGroup 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; + } + SecurityGroup securityGroup = (SecurityGroup) o; + return Objects.equals(this.createdAt, securityGroup.createdAt) + && Objects.equals(this.description, securityGroup.description) + && Objects.equals(this.id, securityGroup.id) + && Objects.equals(this.labels, securityGroup.labels) + && Objects.equals(this.name, securityGroup.name) + && Objects.equals(this.rules, securityGroup.rules) + && Objects.equals(this.stateful, securityGroup.stateful) + && Objects.equals(this.updatedAt, securityGroup.updatedAt) + && Objects.equals(this.additionalProperties, securityGroup.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + createdAt, + description, + id, + labels, + name, + rules, + stateful, + updatedAt, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SecurityGroup {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" rules: ").append(toIndentedString(rules)).append("\n"); + sb.append(" stateful: ").append(toIndentedString(stateful)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).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( + "createdAt", + "description", + "id", + "labels", + "name", + "rules", + "stateful", + "updatedAt")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name")); + } + + /** + * 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 SecurityGroup + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SecurityGroup.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 SecurityGroup is not found in the empty JSON string", + SecurityGroup.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SecurityGroup.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("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `description` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("description").toString())); + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if (!jsonObj.get("name").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("rules") != null && !jsonObj.get("rules").isJsonNull()) { + JsonArray jsonArrayrules = jsonObj.getAsJsonArray("rules"); + if (jsonArrayrules != null) { + // ensure the json data is an array + if (!jsonObj.get("rules").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `rules` to be an array in the JSON string but got `%s`", + jsonObj.get("rules").toString())); + } + + // validate the optional field `rules` (array) + for (int i = 0; i < jsonArrayrules.size(); i++) { + SecurityGroupRule.validateJsonElement(jsonArrayrules.get(i)); + } + ; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SecurityGroup.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SecurityGroup' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(SecurityGroup.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, SecurityGroup 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 SecurityGroup read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SecurityGroup 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 SecurityGroup given an JSON string + * + * @param jsonString JSON string + * @return An instance of SecurityGroup + * @throws IOException if the JSON string is invalid with respect to SecurityGroup + */ + public static SecurityGroup fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SecurityGroup.class); + } + + /** + * Convert an instance of SecurityGroup to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/SecurityGroupListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/SecurityGroupListResponse.java new file mode 100644 index 00000000..21a7d229 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/SecurityGroupListResponse.java @@ -0,0 +1,327 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** Security group list response. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class SecurityGroupListResponse { + public static final String SERIALIZED_NAME_ITEMS = "items"; + + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public SecurityGroupListResponse() {} + + public SecurityGroupListResponse items(@javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public SecurityGroupListResponse addItemsItem(SecurityGroup itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list containing security group objects. + * + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SecurityGroupListResponse instance itself + */ + public SecurityGroupListResponse 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; + } + SecurityGroupListResponse securityGroupListResponse = (SecurityGroupListResponse) o; + return Objects.equals(this.items, securityGroupListResponse.items) + && Objects.equals( + this.additionalProperties, securityGroupListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SecurityGroupListResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("items")); + } + + /** + * 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 SecurityGroupListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SecurityGroupListResponse.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 SecurityGroupListResponse is not found in the empty JSON string", + SecurityGroupListResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SecurityGroupListResponse.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("items").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `items` to be an array in the JSON string but got `%s`", + jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + SecurityGroup.validateJsonElement(jsonArrayitems.get(i)); + } + ; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SecurityGroupListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SecurityGroupListResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(SecurityGroupListResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, SecurityGroupListResponse 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 SecurityGroupListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SecurityGroupListResponse 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 SecurityGroupListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of SecurityGroupListResponse + * @throws IOException if the JSON string is invalid with respect to SecurityGroupListResponse + */ + public static SecurityGroupListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SecurityGroupListResponse.class); + } + + /** + * Convert an instance of SecurityGroupListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/SecurityGroupRule.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/SecurityGroupRule.java new file mode 100644 index 00000000..5963baca --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/SecurityGroupRule.java @@ -0,0 +1,653 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; +import java.util.UUID; + +/** Object that represents a security group rule. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class SecurityGroupRule { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable private String description; + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + + @SerializedName(SERIALIZED_NAME_DIRECTION) + @javax.annotation.Nonnull + private String direction; + + public static final String SERIALIZED_NAME_ETHERTYPE = "ethertype"; + + @SerializedName(SERIALIZED_NAME_ETHERTYPE) + @javax.annotation.Nullable private String ethertype = "IPv4"; + + public static final String SERIALIZED_NAME_ICMP_PARAMETERS = "icmpParameters"; + + @SerializedName(SERIALIZED_NAME_ICMP_PARAMETERS) + @javax.annotation.Nullable private ICMPParameters icmpParameters; + + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_IP_RANGE = "ipRange"; + + @SerializedName(SERIALIZED_NAME_IP_RANGE) + @javax.annotation.Nullable private String ipRange; + + public static final String SERIALIZED_NAME_PORT_RANGE = "portRange"; + + @SerializedName(SERIALIZED_NAME_PORT_RANGE) + @javax.annotation.Nullable private PortRange portRange; + + public static final String SERIALIZED_NAME_REMOTE_SECURITY_GROUP_ID = "remoteSecurityGroupId"; + + @SerializedName(SERIALIZED_NAME_REMOTE_SECURITY_GROUP_ID) + @javax.annotation.Nullable private UUID remoteSecurityGroupId; + + public static final String SERIALIZED_NAME_SECURITY_GROUP_ID = "securityGroupId"; + + @SerializedName(SERIALIZED_NAME_SECURITY_GROUP_ID) + @javax.annotation.Nullable private UUID securityGroupId; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable private OffsetDateTime updatedAt; + + public static final String SERIALIZED_NAME_PROTOCOL = "protocol"; + + @SerializedName(SERIALIZED_NAME_PROTOCOL) + @javax.annotation.Nullable private Protocol protocol; + + public SecurityGroupRule() {} + + public SecurityGroupRule( + OffsetDateTime createdAt, UUID id, UUID securityGroupId, OffsetDateTime updatedAt) { + this(); + this.createdAt = createdAt; + this.id = id; + this.securityGroupId = securityGroupId; + this.updatedAt = updatedAt; + } + + /** + * Date-time when resource was created. + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public SecurityGroupRule description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Description Object. Allows string up to 255 Characters. + * + * @return description + */ + @javax.annotation.Nullable public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + public SecurityGroupRule direction(@javax.annotation.Nonnull String direction) { + this.direction = direction; + return this; + } + + /** + * The direction of the traffic which the rule should match. Possible values: + * `ingress`, `egress`. + * + * @return direction + */ + @javax.annotation.Nonnull + public String getDirection() { + return direction; + } + + public void setDirection(@javax.annotation.Nonnull String direction) { + this.direction = direction; + } + + public SecurityGroupRule ethertype(@javax.annotation.Nullable String ethertype) { + this.ethertype = ethertype; + return this; + } + + /** + * The ethertype which the rule should match. Possible values: `IPv4`, + * `IPv6`. + * + * @return ethertype + */ + @javax.annotation.Nullable public String getEthertype() { + return ethertype; + } + + public void setEthertype(@javax.annotation.Nullable String ethertype) { + this.ethertype = ethertype; + } + + public SecurityGroupRule icmpParameters( + @javax.annotation.Nullable ICMPParameters icmpParameters) { + this.icmpParameters = icmpParameters; + return this; + } + + /** + * Get icmpParameters + * + * @return icmpParameters + */ + @javax.annotation.Nullable public ICMPParameters getIcmpParameters() { + return icmpParameters; + } + + public void setIcmpParameters(@javax.annotation.Nullable ICMPParameters icmpParameters) { + this.icmpParameters = icmpParameters; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + public SecurityGroupRule ipRange(@javax.annotation.Nullable String ipRange) { + this.ipRange = ipRange; + return this; + } + + /** + * The remote IP range which the rule should match. + * + * @return ipRange + */ + @javax.annotation.Nullable public String getIpRange() { + return ipRange; + } + + public void setIpRange(@javax.annotation.Nullable String ipRange) { + this.ipRange = ipRange; + } + + public SecurityGroupRule portRange(@javax.annotation.Nullable PortRange portRange) { + this.portRange = portRange; + return this; + } + + /** + * Get portRange + * + * @return portRange + */ + @javax.annotation.Nullable public PortRange getPortRange() { + return portRange; + } + + public void setPortRange(@javax.annotation.Nullable PortRange portRange) { + this.portRange = portRange; + } + + public SecurityGroupRule remoteSecurityGroupId( + @javax.annotation.Nullable UUID remoteSecurityGroupId) { + this.remoteSecurityGroupId = remoteSecurityGroupId; + return this; + } + + /** + * The remote security group which the rule should match. + * + * @return remoteSecurityGroupId + */ + @javax.annotation.Nullable public UUID getRemoteSecurityGroupId() { + return remoteSecurityGroupId; + } + + public void setRemoteSecurityGroupId(@javax.annotation.Nullable UUID remoteSecurityGroupId) { + this.remoteSecurityGroupId = remoteSecurityGroupId; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return securityGroupId + */ + @javax.annotation.Nullable public UUID getSecurityGroupId() { + return securityGroupId; + } + + /** + * Date-time when resource was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nullable public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public SecurityGroupRule protocol(@javax.annotation.Nullable Protocol protocol) { + this.protocol = protocol; + return this; + } + + /** + * Get protocol + * + * @return protocol + */ + @javax.annotation.Nullable public Protocol getProtocol() { + return protocol; + } + + public void setProtocol(@javax.annotation.Nullable Protocol protocol) { + this.protocol = protocol; + } + + /** + * 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 SecurityGroupRule instance itself + */ + public SecurityGroupRule 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; + } + SecurityGroupRule securityGroupRule = (SecurityGroupRule) o; + return Objects.equals(this.createdAt, securityGroupRule.createdAt) + && Objects.equals(this.description, securityGroupRule.description) + && Objects.equals(this.direction, securityGroupRule.direction) + && Objects.equals(this.ethertype, securityGroupRule.ethertype) + && Objects.equals(this.icmpParameters, securityGroupRule.icmpParameters) + && Objects.equals(this.id, securityGroupRule.id) + && Objects.equals(this.ipRange, securityGroupRule.ipRange) + && Objects.equals(this.portRange, securityGroupRule.portRange) + && Objects.equals( + this.remoteSecurityGroupId, securityGroupRule.remoteSecurityGroupId) + && Objects.equals(this.securityGroupId, securityGroupRule.securityGroupId) + && Objects.equals(this.updatedAt, securityGroupRule.updatedAt) + && Objects.equals(this.protocol, securityGroupRule.protocol) + && Objects.equals( + this.additionalProperties, securityGroupRule.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + createdAt, + description, + direction, + ethertype, + icmpParameters, + id, + ipRange, + portRange, + remoteSecurityGroupId, + securityGroupId, + updatedAt, + protocol, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SecurityGroupRule {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" ethertype: ").append(toIndentedString(ethertype)).append("\n"); + sb.append(" icmpParameters: ").append(toIndentedString(icmpParameters)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" ipRange: ").append(toIndentedString(ipRange)).append("\n"); + sb.append(" portRange: ").append(toIndentedString(portRange)).append("\n"); + sb.append(" remoteSecurityGroupId: ") + .append(toIndentedString(remoteSecurityGroupId)) + .append("\n"); + sb.append(" securityGroupId: ").append(toIndentedString(securityGroupId)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" protocol: ").append(toIndentedString(protocol)).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( + "createdAt", + "description", + "direction", + "ethertype", + "icmpParameters", + "id", + "ipRange", + "portRange", + "remoteSecurityGroupId", + "securityGroupId", + "updatedAt", + "protocol")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("direction")); + } + + /** + * 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 SecurityGroupRule + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SecurityGroupRule.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 SecurityGroupRule is not found in the empty JSON string", + SecurityGroupRule.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SecurityGroupRule.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("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `description` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("description").toString())); + } + if (!jsonObj.get("direction").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `direction` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("direction").toString())); + } + if ((jsonObj.get("ethertype") != null && !jsonObj.get("ethertype").isJsonNull()) + && !jsonObj.get("ethertype").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `ethertype` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("ethertype").toString())); + } + // validate the optional field `icmpParameters` + if (jsonObj.get("icmpParameters") != null && !jsonObj.get("icmpParameters").isJsonNull()) { + ICMPParameters.validateJsonElement(jsonObj.get("icmpParameters")); + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if ((jsonObj.get("ipRange") != null && !jsonObj.get("ipRange").isJsonNull()) + && !jsonObj.get("ipRange").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `ipRange` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("ipRange").toString())); + } + // validate the optional field `portRange` + if (jsonObj.get("portRange") != null && !jsonObj.get("portRange").isJsonNull()) { + PortRange.validateJsonElement(jsonObj.get("portRange")); + } + if ((jsonObj.get("remoteSecurityGroupId") != null + && !jsonObj.get("remoteSecurityGroupId").isJsonNull()) + && !jsonObj.get("remoteSecurityGroupId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `remoteSecurityGroupId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("remoteSecurityGroupId").toString())); + } + if ((jsonObj.get("securityGroupId") != null && !jsonObj.get("securityGroupId").isJsonNull()) + && !jsonObj.get("securityGroupId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `securityGroupId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("securityGroupId").toString())); + } + // validate the optional field `protocol` + if (jsonObj.get("protocol") != null && !jsonObj.get("protocol").isJsonNull()) { + Protocol.validateJsonElement(jsonObj.get("protocol")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SecurityGroupRule.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SecurityGroupRule' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(SecurityGroupRule.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, SecurityGroupRule 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 SecurityGroupRule read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SecurityGroupRule 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 SecurityGroupRule given an JSON string + * + * @param jsonString JSON string + * @return An instance of SecurityGroupRule + * @throws IOException if the JSON string is invalid with respect to SecurityGroupRule + */ + public static SecurityGroupRule fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SecurityGroupRule.class); + } + + /** + * Convert an instance of SecurityGroupRule to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/SecurityGroupRuleListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/SecurityGroupRuleListResponse.java new file mode 100644 index 00000000..d116b421 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/SecurityGroupRuleListResponse.java @@ -0,0 +1,335 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** Security group rule list response. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class SecurityGroupRuleListResponse { + public static final String SERIALIZED_NAME_ITEMS = "items"; + + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public SecurityGroupRuleListResponse() {} + + public SecurityGroupRuleListResponse items( + @javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public SecurityGroupRuleListResponse addItemsItem(SecurityGroupRule itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list containing security group rule objects. + * + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SecurityGroupRuleListResponse instance itself + */ + public SecurityGroupRuleListResponse 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; + } + SecurityGroupRuleListResponse securityGroupRuleListResponse = + (SecurityGroupRuleListResponse) o; + return Objects.equals(this.items, securityGroupRuleListResponse.items) + && Objects.equals( + this.additionalProperties, + securityGroupRuleListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SecurityGroupRuleListResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("items")); + } + + /** + * 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 + * SecurityGroupRuleListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SecurityGroupRuleListResponse.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 SecurityGroupRuleListResponse is not found in the empty JSON string", + SecurityGroupRuleListResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SecurityGroupRuleListResponse.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("items").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `items` to be an array in the JSON string but got `%s`", + jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + SecurityGroupRule.validateJsonElement(jsonArrayitems.get(i)); + } + ; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SecurityGroupRuleListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SecurityGroupRuleListResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(SecurityGroupRuleListResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, SecurityGroupRuleListResponse 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 SecurityGroupRuleListResponse read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SecurityGroupRuleListResponse 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 SecurityGroupRuleListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of SecurityGroupRuleListResponse + * @throws IOException if the JSON string is invalid with respect to + * SecurityGroupRuleListResponse + */ + public static SecurityGroupRuleListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SecurityGroupRuleListResponse.class); + } + + /** + * Convert an instance of SecurityGroupRuleListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/SecurityGroupRuleProtocol.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/SecurityGroupRuleProtocol.java new file mode 100644 index 00000000..f19bcba2 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/SecurityGroupRuleProtocol.java @@ -0,0 +1,292 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** The internet protocol which the rule matches. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class SecurityGroupRuleProtocol { + public static final String SERIALIZED_NAME_PROTOCOL = "protocol"; + + @SerializedName(SERIALIZED_NAME_PROTOCOL) + @javax.annotation.Nullable private Protocol protocol; + + public SecurityGroupRuleProtocol() {} + + public SecurityGroupRuleProtocol protocol(@javax.annotation.Nullable Protocol protocol) { + this.protocol = protocol; + return this; + } + + /** + * Get protocol + * + * @return protocol + */ + @javax.annotation.Nullable public Protocol getProtocol() { + return protocol; + } + + public void setProtocol(@javax.annotation.Nullable Protocol protocol) { + this.protocol = protocol; + } + + /** + * 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 SecurityGroupRuleProtocol instance itself + */ + public SecurityGroupRuleProtocol 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; + } + SecurityGroupRuleProtocol securityGroupRuleProtocol = (SecurityGroupRuleProtocol) o; + return Objects.equals(this.protocol, securityGroupRuleProtocol.protocol) + && Objects.equals( + this.additionalProperties, securityGroupRuleProtocol.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(protocol, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SecurityGroupRuleProtocol {\n"); + sb.append(" protocol: ").append(toIndentedString(protocol)).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("protocol")); + + // 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 SecurityGroupRuleProtocol + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SecurityGroupRuleProtocol.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 SecurityGroupRuleProtocol is not found in the empty JSON string", + SecurityGroupRuleProtocol.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `protocol` + if (jsonObj.get("protocol") != null && !jsonObj.get("protocol").isJsonNull()) { + Protocol.validateJsonElement(jsonObj.get("protocol")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SecurityGroupRuleProtocol.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SecurityGroupRuleProtocol' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(SecurityGroupRuleProtocol.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, SecurityGroupRuleProtocol 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 SecurityGroupRuleProtocol read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SecurityGroupRuleProtocol 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 SecurityGroupRuleProtocol given an JSON string + * + * @param jsonString JSON string + * @return An instance of SecurityGroupRuleProtocol + * @throws IOException if the JSON string is invalid with respect to SecurityGroupRuleProtocol + */ + public static SecurityGroupRuleProtocol fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SecurityGroupRuleProtocol.class); + } + + /** + * Convert an instance of SecurityGroupRuleProtocol to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/Server.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/Server.java new file mode 100644 index 00000000..3345721f --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/Server.java @@ -0,0 +1,1091 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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.time.OffsetDateTime; +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; +import java.util.UUID; + +/** Representation of a single server object. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class Server { + public static final String SERIALIZED_NAME_AFFINITY_GROUP = "affinityGroup"; + + @SerializedName(SERIALIZED_NAME_AFFINITY_GROUP) + @javax.annotation.Nullable private UUID affinityGroup; + + public static final String SERIALIZED_NAME_AGENT = "agent"; + + @SerializedName(SERIALIZED_NAME_AGENT) + @javax.annotation.Nullable private ServerAgent agent; + + public static final String SERIALIZED_NAME_AVAILABILITY_ZONE = "availabilityZone"; + + @SerializedName(SERIALIZED_NAME_AVAILABILITY_ZONE) + @javax.annotation.Nullable private String availabilityZone; + + public static final String SERIALIZED_NAME_BOOT_VOLUME = "bootVolume"; + + @SerializedName(SERIALIZED_NAME_BOOT_VOLUME) + @javax.annotation.Nullable private BootVolume bootVolume; + + public static final String SERIALIZED_NAME_CONFIG_DRIVE = "configDrive"; + + @SerializedName(SERIALIZED_NAME_CONFIG_DRIVE) + @javax.annotation.Nullable private Boolean configDrive = false; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_ERROR_MESSAGE = "errorMessage"; + + @SerializedName(SERIALIZED_NAME_ERROR_MESSAGE) + @javax.annotation.Nullable private String errorMessage; + + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_IMAGE_ID = "imageId"; + + @SerializedName(SERIALIZED_NAME_IMAGE_ID) + @javax.annotation.Nullable private UUID imageId; + + public static final String SERIALIZED_NAME_KEYPAIR_NAME = "keypairName"; + + @SerializedName(SERIALIZED_NAME_KEYPAIR_NAME) + @javax.annotation.Nullable private String keypairName; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_LAUNCHED_AT = "launchedAt"; + + @SerializedName(SERIALIZED_NAME_LAUNCHED_AT) + @javax.annotation.Nullable private OffsetDateTime launchedAt; + + public static final String SERIALIZED_NAME_MACHINE_TYPE = "machineType"; + + @SerializedName(SERIALIZED_NAME_MACHINE_TYPE) + @javax.annotation.Nonnull + private String machineType; + + public static final String SERIALIZED_NAME_MAINTENANCE_WINDOW = "maintenanceWindow"; + + @SerializedName(SERIALIZED_NAME_MAINTENANCE_WINDOW) + @javax.annotation.Nullable private ServerMaintenance maintenanceWindow; + + public static final String SERIALIZED_NAME_METADATA = "metadata"; + + @SerializedName(SERIALIZED_NAME_METADATA) + @javax.annotation.Nullable private Object metadata; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_NETWORKING = "networking"; + + @SerializedName(SERIALIZED_NAME_NETWORKING) + @javax.annotation.Nullable private ServerNetworking networking; + + public static final String SERIALIZED_NAME_NICS = "nics"; + + @SerializedName(SERIALIZED_NAME_NICS) + @javax.annotation.Nullable private List nics; + + public static final String SERIALIZED_NAME_POWER_STATUS = "powerStatus"; + + @SerializedName(SERIALIZED_NAME_POWER_STATUS) + @javax.annotation.Nullable private String powerStatus; + + public static final String SERIALIZED_NAME_SECURITY_GROUPS = "securityGroups"; + + @SerializedName(SERIALIZED_NAME_SECURITY_GROUPS) + @javax.annotation.Nullable private List securityGroups; + + public static final String SERIALIZED_NAME_SERVICE_ACCOUNT_MAILS = "serviceAccountMails"; + + @SerializedName(SERIALIZED_NAME_SERVICE_ACCOUNT_MAILS) + @javax.annotation.Nullable private List serviceAccountMails; + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable private String status; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable private OffsetDateTime updatedAt; + + public static final String SERIALIZED_NAME_USER_DATA = "userData"; + + @SerializedName(SERIALIZED_NAME_USER_DATA) + @javax.annotation.Nullable private byte[] userData; + + public static final String SERIALIZED_NAME_VOLUMES = "volumes"; + + @SerializedName(SERIALIZED_NAME_VOLUMES) + @javax.annotation.Nullable private List volumes; + + public Server() {} + + public Server( + OffsetDateTime createdAt, + String errorMessage, + UUID id, + OffsetDateTime launchedAt, + ServerMaintenance maintenanceWindow, + List nics, + String powerStatus, + String status, + OffsetDateTime updatedAt) { + this(); + this.createdAt = createdAt; + this.errorMessage = errorMessage; + this.id = id; + this.launchedAt = launchedAt; + this.maintenanceWindow = maintenanceWindow; + this.nics = nics; + this.powerStatus = powerStatus; + this.status = status; + this.updatedAt = updatedAt; + } + + public Server affinityGroup(@javax.annotation.Nullable UUID affinityGroup) { + this.affinityGroup = affinityGroup; + return this; + } + + /** + * The affinity group the server is assigned to. + * + * @return affinityGroup + */ + @javax.annotation.Nullable public UUID getAffinityGroup() { + return affinityGroup; + } + + public void setAffinityGroup(@javax.annotation.Nullable UUID affinityGroup) { + this.affinityGroup = affinityGroup; + } + + public Server agent(@javax.annotation.Nullable ServerAgent agent) { + this.agent = agent; + return this; + } + + /** + * Get agent + * + * @return agent + */ + @javax.annotation.Nullable public ServerAgent getAgent() { + return agent; + } + + public void setAgent(@javax.annotation.Nullable ServerAgent agent) { + this.agent = agent; + } + + public Server availabilityZone(@javax.annotation.Nullable String availabilityZone) { + this.availabilityZone = availabilityZone; + return this; + } + + /** + * This is the availability zone requested during server creation. If none is provided during + * the creation request and an existing volume will be used as boot volume it will be set to the + * same availability zone as the volume. For requests with no volumes involved it will be set to + * the metro availability zone. + * + * @return availabilityZone + */ + @javax.annotation.Nullable public String getAvailabilityZone() { + return availabilityZone; + } + + public void setAvailabilityZone(@javax.annotation.Nullable String availabilityZone) { + this.availabilityZone = availabilityZone; + } + + public Server bootVolume(@javax.annotation.Nullable BootVolume bootVolume) { + this.bootVolume = bootVolume; + return this; + } + + /** + * Get bootVolume + * + * @return bootVolume + */ + @javax.annotation.Nullable public BootVolume getBootVolume() { + return bootVolume; + } + + public void setBootVolume(@javax.annotation.Nullable BootVolume bootVolume) { + this.bootVolume = bootVolume; + } + + public Server configDrive(@javax.annotation.Nullable Boolean configDrive) { + this.configDrive = configDrive; + return this; + } + + /** + * When true the server is created with a config drive. + * + * @return configDrive + */ + @javax.annotation.Nullable public Boolean getConfigDrive() { + return configDrive; + } + + public void setConfigDrive(@javax.annotation.Nullable Boolean configDrive) { + this.configDrive = configDrive; + } + + /** + * Date-time when resource was created. + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * An error message. + * + * @return errorMessage + */ + @javax.annotation.Nullable public String getErrorMessage() { + return errorMessage; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + public Server imageId(@javax.annotation.Nullable UUID imageId) { + this.imageId = imageId; + return this; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return imageId + */ + @javax.annotation.Nullable public UUID getImageId() { + return imageId; + } + + public void setImageId(@javax.annotation.Nullable UUID imageId) { + this.imageId = imageId; + } + + public Server keypairName(@javax.annotation.Nullable String keypairName) { + this.keypairName = keypairName; + return this; + } + + /** + * The SSH keypair used during the server creation. + * + * @return keypairName + */ + @javax.annotation.Nullable public String getKeypairName() { + return keypairName; + } + + public void setKeypairName(@javax.annotation.Nullable String keypairName) { + this.keypairName = keypairName; + } + + public Server labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + /** + * Date-time when resource was launched. + * + * @return launchedAt + */ + @javax.annotation.Nullable public OffsetDateTime getLaunchedAt() { + return launchedAt; + } + + public Server machineType(@javax.annotation.Nonnull String machineType) { + this.machineType = machineType; + return this; + } + + /** + * Name of the machine type the server shall belong to. + * + * @return machineType + */ + @javax.annotation.Nonnull + public String getMachineType() { + return machineType; + } + + public void setMachineType(@javax.annotation.Nonnull String machineType) { + this.machineType = machineType; + } + + /** + * Get maintenanceWindow + * + * @return maintenanceWindow + */ + @javax.annotation.Nullable public ServerMaintenance getMaintenanceWindow() { + return maintenanceWindow; + } + + public Server metadata(@javax.annotation.Nullable Object metadata) { + this.metadata = metadata; + return this; + } + + /** + * Object that represents the metadata of an object. Regex for keys: `^[a-zA-Z0-9-_:. + * ]{1,255}$`. Regex for values: `^.{0,255}$`. Providing a `null` value + * for a key will remove that key. + * + * @return metadata + */ + @javax.annotation.Nullable public Object getMetadata() { + return metadata; + } + + public void setMetadata(@javax.annotation.Nullable Object metadata) { + this.metadata = metadata; + } + + public Server name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * The name for a Server. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + public Server networking(@javax.annotation.Nullable ServerNetworking networking) { + this.networking = networking; + return this; + } + + /** + * Get networking + * + * @return networking + */ + @javax.annotation.Nullable public ServerNetworking getNetworking() { + return networking; + } + + public void setNetworking(@javax.annotation.Nullable ServerNetworking networking) { + this.networking = networking; + } + + /** + * The list of network interfaces (NICs) attached to the server. Only shown when detailed + * information is requested. + * + * @return nics + */ + @javax.annotation.Nullable public List getNics() { + return nics; + } + + /** + * The power status of a server. Possible values: `CRASHED`, `ERROR`, + * `RUNNING`, `STOPPED`. + * + * @return powerStatus + */ + @javax.annotation.Nullable public String getPowerStatus() { + return powerStatus; + } + + public Server securityGroups(@javax.annotation.Nullable List securityGroups) { + this.securityGroups = securityGroups; + return this; + } + + public Server addSecurityGroupsItem(String securityGroupsItem) { + if (this.securityGroups == null) { + this.securityGroups = new ArrayList<>(); + } + this.securityGroups.add(securityGroupsItem); + return this; + } + + /** + * The initial security groups for the server creation. + * + * @return securityGroups + */ + @javax.annotation.Nullable public List getSecurityGroups() { + return securityGroups; + } + + public void setSecurityGroups(@javax.annotation.Nullable List securityGroups) { + this.securityGroups = securityGroups; + } + + public Server serviceAccountMails(@javax.annotation.Nullable List serviceAccountMails) { + this.serviceAccountMails = serviceAccountMails; + return this; + } + + public Server addServiceAccountMailsItem(String serviceAccountMailsItem) { + if (this.serviceAccountMails == null) { + this.serviceAccountMails = new ArrayList<>(); + } + this.serviceAccountMails.add(serviceAccountMailsItem); + return this; + } + + /** + * A list of service account mails. Only shown when detailed information is requested. + * + * @return serviceAccountMails + */ + @javax.annotation.Nullable public List getServiceAccountMails() { + return serviceAccountMails; + } + + public void setServiceAccountMails( + @javax.annotation.Nullable List serviceAccountMails) { + this.serviceAccountMails = serviceAccountMails; + } + + /** + * The status of a server object. Possible values: `ACTIVE`, `BACKING-UP`, + * `CREATING`, `DEALLOCATED`, `DEALLOCATING`, `DELETED`, + * `DELETING`, `ERROR`, `INACTIVE`, `MIGRATING`, + * `PAUSED`, `REBOOT`, `REBOOTING`, `REBUILD`, + * `REBUILDING`, `RESCUE`, `RESCUING`, `RESIZING`, + * `RESTORING`, `SNAPSHOTTING`, `STARTING`, `STOPPING`, + * `UNRESCUING`, `UPDATING`. + * + * @return status + */ + @javax.annotation.Nullable public String getStatus() { + return status; + } + + /** + * Date-time when resource was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nullable public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public Server userData(@javax.annotation.Nullable byte[] userData) { + this.userData = userData; + return this; + } + + /** + * User Data that is provided to the server. Must be base64 encoded and is passed via cloud-init + * to the server. Only shown when detailed information is requested. + * + * @return userData + */ + @javax.annotation.Nullable public byte[] getUserData() { + return userData; + } + + public void setUserData(@javax.annotation.Nullable byte[] userData) { + this.userData = userData; + } + + public Server volumes(@javax.annotation.Nullable List volumes) { + this.volumes = volumes; + return this; + } + + public Server addVolumesItem(UUID volumesItem) { + if (this.volumes == null) { + this.volumes = new ArrayList<>(); + } + this.volumes.add(volumesItem); + return this; + } + + /** + * The list of volumes attached to the server. + * + * @return volumes + */ + @javax.annotation.Nullable public List getVolumes() { + return volumes; + } + + public void setVolumes(@javax.annotation.Nullable List volumes) { + this.volumes = volumes; + } + + /** + * 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 Server instance itself + */ + public Server 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; + } + Server server = (Server) o; + return Objects.equals(this.affinityGroup, server.affinityGroup) + && Objects.equals(this.agent, server.agent) + && Objects.equals(this.availabilityZone, server.availabilityZone) + && Objects.equals(this.bootVolume, server.bootVolume) + && Objects.equals(this.configDrive, server.configDrive) + && Objects.equals(this.createdAt, server.createdAt) + && Objects.equals(this.errorMessage, server.errorMessage) + && Objects.equals(this.id, server.id) + && Objects.equals(this.imageId, server.imageId) + && Objects.equals(this.keypairName, server.keypairName) + && Objects.equals(this.labels, server.labels) + && Objects.equals(this.launchedAt, server.launchedAt) + && Objects.equals(this.machineType, server.machineType) + && Objects.equals(this.maintenanceWindow, server.maintenanceWindow) + && Objects.equals(this.metadata, server.metadata) + && Objects.equals(this.name, server.name) + && Objects.equals(this.networking, server.networking) + && Objects.equals(this.nics, server.nics) + && Objects.equals(this.powerStatus, server.powerStatus) + && Objects.equals(this.securityGroups, server.securityGroups) + && Objects.equals(this.serviceAccountMails, server.serviceAccountMails) + && Objects.equals(this.status, server.status) + && Objects.equals(this.updatedAt, server.updatedAt) + && Arrays.equals(this.userData, server.userData) + && Objects.equals(this.volumes, server.volumes) + && Objects.equals(this.additionalProperties, server.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + affinityGroup, + agent, + availabilityZone, + bootVolume, + configDrive, + createdAt, + errorMessage, + id, + imageId, + keypairName, + labels, + launchedAt, + machineType, + maintenanceWindow, + metadata, + name, + networking, + nics, + powerStatus, + securityGroups, + serviceAccountMails, + status, + updatedAt, + Arrays.hashCode(userData), + volumes, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Server {\n"); + sb.append(" affinityGroup: ").append(toIndentedString(affinityGroup)).append("\n"); + sb.append(" agent: ").append(toIndentedString(agent)).append("\n"); + sb.append(" availabilityZone: ").append(toIndentedString(availabilityZone)).append("\n"); + sb.append(" bootVolume: ").append(toIndentedString(bootVolume)).append("\n"); + sb.append(" configDrive: ").append(toIndentedString(configDrive)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" errorMessage: ").append(toIndentedString(errorMessage)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" imageId: ").append(toIndentedString(imageId)).append("\n"); + sb.append(" keypairName: ").append(toIndentedString(keypairName)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" launchedAt: ").append(toIndentedString(launchedAt)).append("\n"); + sb.append(" machineType: ").append(toIndentedString(machineType)).append("\n"); + sb.append(" maintenanceWindow: ") + .append(toIndentedString(maintenanceWindow)) + .append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" networking: ").append(toIndentedString(networking)).append("\n"); + sb.append(" nics: ").append(toIndentedString(nics)).append("\n"); + sb.append(" powerStatus: ").append(toIndentedString(powerStatus)).append("\n"); + sb.append(" securityGroups: ").append(toIndentedString(securityGroups)).append("\n"); + sb.append(" serviceAccountMails: ") + .append(toIndentedString(serviceAccountMails)) + .append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" userData: ").append(toIndentedString(userData)).append("\n"); + sb.append(" volumes: ").append(toIndentedString(volumes)).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( + "affinityGroup", + "agent", + "availabilityZone", + "bootVolume", + "configDrive", + "createdAt", + "errorMessage", + "id", + "imageId", + "keypairName", + "labels", + "launchedAt", + "machineType", + "maintenanceWindow", + "metadata", + "name", + "networking", + "nics", + "powerStatus", + "securityGroups", + "serviceAccountMails", + "status", + "updatedAt", + "userData", + "volumes")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("machineType", "name")); + } + + /** + * 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 Server + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Server.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 Server is not found in the empty JSON string", + Server.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Server.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("affinityGroup") != null && !jsonObj.get("affinityGroup").isJsonNull()) + && !jsonObj.get("affinityGroup").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `affinityGroup` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("affinityGroup").toString())); + } + // validate the optional field `agent` + if (jsonObj.get("agent") != null && !jsonObj.get("agent").isJsonNull()) { + ServerAgent.validateJsonElement(jsonObj.get("agent")); + } + if ((jsonObj.get("availabilityZone") != null + && !jsonObj.get("availabilityZone").isJsonNull()) + && !jsonObj.get("availabilityZone").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `availabilityZone` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("availabilityZone").toString())); + } + // validate the optional field `bootVolume` + if (jsonObj.get("bootVolume") != null && !jsonObj.get("bootVolume").isJsonNull()) { + BootVolume.validateJsonElement(jsonObj.get("bootVolume")); + } + if ((jsonObj.get("errorMessage") != null && !jsonObj.get("errorMessage").isJsonNull()) + && !jsonObj.get("errorMessage").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `errorMessage` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("errorMessage").toString())); + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if ((jsonObj.get("imageId") != null && !jsonObj.get("imageId").isJsonNull()) + && !jsonObj.get("imageId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `imageId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("imageId").toString())); + } + if ((jsonObj.get("keypairName") != null && !jsonObj.get("keypairName").isJsonNull()) + && !jsonObj.get("keypairName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `keypairName` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("keypairName").toString())); + } + if (!jsonObj.get("machineType").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `machineType` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("machineType").toString())); + } + // validate the optional field `maintenanceWindow` + if (jsonObj.get("maintenanceWindow") != null + && !jsonObj.get("maintenanceWindow").isJsonNull()) { + ServerMaintenance.validateJsonElement(jsonObj.get("maintenanceWindow")); + } + 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())); + } + // validate the optional field `networking` + if (jsonObj.get("networking") != null && !jsonObj.get("networking").isJsonNull()) { + ServerNetworking.validateJsonElement(jsonObj.get("networking")); + } + if (jsonObj.get("nics") != null && !jsonObj.get("nics").isJsonNull()) { + JsonArray jsonArraynics = jsonObj.getAsJsonArray("nics"); + if (jsonArraynics != null) { + // ensure the json data is an array + if (!jsonObj.get("nics").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `nics` to be an array in the JSON string but got `%s`", + jsonObj.get("nics").toString())); + } + + // validate the optional field `nics` (array) + for (int i = 0; i < jsonArraynics.size(); i++) { + ServerNetwork.validateJsonElement(jsonArraynics.get(i)); + } + ; + } + } + if ((jsonObj.get("powerStatus") != null && !jsonObj.get("powerStatus").isJsonNull()) + && !jsonObj.get("powerStatus").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `powerStatus` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("powerStatus").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("securityGroups") != null + && !jsonObj.get("securityGroups").isJsonNull() + && !jsonObj.get("securityGroups").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `securityGroups` to be an array in the JSON string but got `%s`", + jsonObj.get("securityGroups").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("serviceAccountMails") != null + && !jsonObj.get("serviceAccountMails").isJsonNull() + && !jsonObj.get("serviceAccountMails").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `serviceAccountMails` to be an array in the JSON string but got `%s`", + jsonObj.get("serviceAccountMails").toString())); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) + && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `status` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("status").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("volumes") != null + && !jsonObj.get("volumes").isJsonNull() + && !jsonObj.get("volumes").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `volumes` to be an array in the JSON string but got `%s`", + jsonObj.get("volumes").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Server.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Server' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(Server.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, Server 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 Server read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Server 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 Server given an JSON string + * + * @param jsonString JSON string + * @return An instance of Server + * @throws IOException if the JSON string is invalid with respect to Server + */ + public static Server fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Server.class); + } + + /** + * Convert an instance of Server to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ServerAgent.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ServerAgent.java new file mode 100644 index 00000000..c95e01d7 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ServerAgent.java @@ -0,0 +1,288 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** STACKIT server agent options for a server. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class ServerAgent { + public static final String SERIALIZED_NAME_PROVISIONED = "provisioned"; + + @SerializedName(SERIALIZED_NAME_PROVISIONED) + @javax.annotation.Nullable private Boolean provisioned; + + public ServerAgent() {} + + public ServerAgent provisioned(@javax.annotation.Nullable Boolean provisioned) { + this.provisioned = provisioned; + return this; + } + + /** + * Configure the STACKIT server agent provisioning during the first boot of the server. Only + * works when booting from an images that supports the STACKIT server agent. When + * `false` the agent IS NOT installed. When `true` the agent IS installed. + * When its not set the result depend on the used image and its default provisioning setting. + * + * @return provisioned + */ + @javax.annotation.Nullable public Boolean getProvisioned() { + return provisioned; + } + + public void setProvisioned(@javax.annotation.Nullable Boolean provisioned) { + this.provisioned = provisioned; + } + + /** + * 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 ServerAgent instance itself + */ + public ServerAgent 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; + } + ServerAgent serverAgent = (ServerAgent) o; + return Objects.equals(this.provisioned, serverAgent.provisioned) + && Objects.equals(this.additionalProperties, serverAgent.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(provisioned, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ServerAgent {\n"); + sb.append(" provisioned: ").append(toIndentedString(provisioned)).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("provisioned")); + + // 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 ServerAgent + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ServerAgent.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 ServerAgent is not found in the empty JSON string", + ServerAgent.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ServerAgent.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ServerAgent' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ServerAgent.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ServerAgent 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 ServerAgent read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ServerAgent 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 ServerAgent given an JSON string + * + * @param jsonString JSON string + * @return An instance of ServerAgent + * @throws IOException if the JSON string is invalid with respect to ServerAgent + */ + public static ServerAgent fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ServerAgent.class); + } + + /** + * Convert an instance of ServerAgent to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ServerConsoleUrl.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ServerConsoleUrl.java new file mode 100644 index 00000000..d1c2accb --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ServerConsoleUrl.java @@ -0,0 +1,307 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** Object that represents a server console URL. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class ServerConsoleUrl { + public static final String SERIALIZED_NAME_URL = "url"; + + @SerializedName(SERIALIZED_NAME_URL) + @javax.annotation.Nonnull + private String url; + + public ServerConsoleUrl() {} + + public ServerConsoleUrl url(@javax.annotation.Nonnull String url) { + this.url = url; + return this; + } + + /** + * Get url + * + * @return url + */ + @javax.annotation.Nonnull + public String getUrl() { + return url; + } + + public void setUrl(@javax.annotation.Nonnull String url) { + this.url = url; + } + + /** + * 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 ServerConsoleUrl instance itself + */ + public ServerConsoleUrl 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; + } + ServerConsoleUrl serverConsoleUrl = (ServerConsoleUrl) o; + return Objects.equals(this.url, serverConsoleUrl.url) + && Objects.equals(this.additionalProperties, serverConsoleUrl.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(url, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ServerConsoleUrl {\n"); + sb.append(" url: ").append(toIndentedString(url)).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("url")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("url")); + } + + /** + * 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 ServerConsoleUrl + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ServerConsoleUrl.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 ServerConsoleUrl is not found in the empty JSON string", + ServerConsoleUrl.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ServerConsoleUrl.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("url").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `url` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("url").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ServerConsoleUrl.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ServerConsoleUrl' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ServerConsoleUrl.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ServerConsoleUrl 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 ServerConsoleUrl read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ServerConsoleUrl 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 ServerConsoleUrl given an JSON string + * + * @param jsonString JSON string + * @return An instance of ServerConsoleUrl + * @throws IOException if the JSON string is invalid with respect to ServerConsoleUrl + */ + public static ServerConsoleUrl fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ServerConsoleUrl.class); + } + + /** + * Convert an instance of ServerConsoleUrl to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ServerListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ServerListResponse.java new file mode 100644 index 00000000..5274b5c7 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ServerListResponse.java @@ -0,0 +1,326 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** Response object for server list request. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class ServerListResponse { + public static final String SERIALIZED_NAME_ITEMS = "items"; + + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public ServerListResponse() {} + + public ServerListResponse items(@javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public ServerListResponse addItemsItem(Server itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list of servers. + * + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ServerListResponse instance itself + */ + public ServerListResponse 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; + } + ServerListResponse serverListResponse = (ServerListResponse) o; + return Objects.equals(this.items, serverListResponse.items) + && Objects.equals( + this.additionalProperties, serverListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ServerListResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("items")); + } + + /** + * 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 ServerListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ServerListResponse.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 ServerListResponse is not found in the empty JSON string", + ServerListResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ServerListResponse.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("items").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `items` to be an array in the JSON string but got `%s`", + jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + Server.validateJsonElement(jsonArrayitems.get(i)); + } + ; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ServerListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ServerListResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ServerListResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ServerListResponse 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 ServerListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ServerListResponse 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 ServerListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ServerListResponse + * @throws IOException if the JSON string is invalid with respect to ServerListResponse + */ + public static ServerListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ServerListResponse.class); + } + + /** + * Convert an instance of ServerListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ServerMaintenance.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ServerMaintenance.java new file mode 100644 index 00000000..48f5f7b6 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ServerMaintenance.java @@ -0,0 +1,397 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** Object that represents the information about the next planned server maintenance window. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class ServerMaintenance { + public static final String SERIALIZED_NAME_DETAILS = "details"; + + @SerializedName(SERIALIZED_NAME_DETAILS) + @javax.annotation.Nullable private String details; + + public static final String SERIALIZED_NAME_ENDS_AT = "endsAt"; + + @SerializedName(SERIALIZED_NAME_ENDS_AT) + @javax.annotation.Nonnull + private OffsetDateTime endsAt; + + public static final String SERIALIZED_NAME_STARTS_AT = "startsAt"; + + @SerializedName(SERIALIZED_NAME_STARTS_AT) + @javax.annotation.Nonnull + private OffsetDateTime startsAt; + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nonnull + private String status; + + public ServerMaintenance() {} + + public ServerMaintenance details(@javax.annotation.Nullable String details) { + this.details = details; + return this; + } + + /** + * Get details + * + * @return details + */ + @javax.annotation.Nullable public String getDetails() { + return details; + } + + public void setDetails(@javax.annotation.Nullable String details) { + this.details = details; + } + + public ServerMaintenance endsAt(@javax.annotation.Nonnull OffsetDateTime endsAt) { + this.endsAt = endsAt; + return this; + } + + /** + * End of the maintenance window. + * + * @return endsAt + */ + @javax.annotation.Nonnull + public OffsetDateTime getEndsAt() { + return endsAt; + } + + public void setEndsAt(@javax.annotation.Nonnull OffsetDateTime endsAt) { + this.endsAt = endsAt; + } + + public ServerMaintenance startsAt(@javax.annotation.Nonnull OffsetDateTime startsAt) { + this.startsAt = startsAt; + return this; + } + + /** + * Start of the maintenance window. + * + * @return startsAt + */ + @javax.annotation.Nonnull + public OffsetDateTime getStartsAt() { + return startsAt; + } + + public void setStartsAt(@javax.annotation.Nonnull OffsetDateTime startsAt) { + this.startsAt = startsAt; + } + + public ServerMaintenance status(@javax.annotation.Nonnull String status) { + this.status = status; + return this; + } + + /** + * Possible values: `PLANNED`, `ONGOING`. + * + * @return status + */ + @javax.annotation.Nonnull + public String getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nonnull String status) { + this.status = status; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ServerMaintenance instance itself + */ + public ServerMaintenance 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; + } + ServerMaintenance serverMaintenance = (ServerMaintenance) o; + return Objects.equals(this.details, serverMaintenance.details) + && Objects.equals(this.endsAt, serverMaintenance.endsAt) + && Objects.equals(this.startsAt, serverMaintenance.startsAt) + && Objects.equals(this.status, serverMaintenance.status) + && Objects.equals( + this.additionalProperties, serverMaintenance.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(details, endsAt, startsAt, status, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ServerMaintenance {\n"); + sb.append(" details: ").append(toIndentedString(details)).append("\n"); + sb.append(" endsAt: ").append(toIndentedString(endsAt)).append("\n"); + sb.append(" startsAt: ").append(toIndentedString(startsAt)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = + new HashSet(Arrays.asList("details", "endsAt", "startsAt", "status")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("endsAt", "startsAt", "status")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ServerMaintenance + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ServerMaintenance.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 ServerMaintenance is not found in the empty JSON string", + ServerMaintenance.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ServerMaintenance.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("details") != null && !jsonObj.get("details").isJsonNull()) + && !jsonObj.get("details").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `details` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("details").toString())); + } + if (!jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `status` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("status").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ServerMaintenance.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ServerMaintenance' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ServerMaintenance.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ServerMaintenance 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 ServerMaintenance read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ServerMaintenance 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 ServerMaintenance given an JSON string + * + * @param jsonString JSON string + * @return An instance of ServerMaintenance + * @throws IOException if the JSON string is invalid with respect to ServerMaintenance + */ + public static ServerMaintenance fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ServerMaintenance.class); + } + + /** + * Convert an instance of ServerMaintenance to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ServerNetwork.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ServerNetwork.java new file mode 100644 index 00000000..9f08ce8b --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ServerNetwork.java @@ -0,0 +1,660 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; +import java.util.UUID; + +/** Describes the object that matches servers to its networks. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class ServerNetwork { + public static final String SERIALIZED_NAME_ALLOWED_ADDRESSES = "allowedAddresses"; + + @SerializedName(SERIALIZED_NAME_ALLOWED_ADDRESSES) + @javax.annotation.Nullable private List allowedAddresses = new ArrayList<>(); + + public static final String SERIALIZED_NAME_IPV4 = "ipv4"; + + @SerializedName(SERIALIZED_NAME_IPV4) + @javax.annotation.Nullable private String ipv4; + + public static final String SERIALIZED_NAME_IPV6 = "ipv6"; + + @SerializedName(SERIALIZED_NAME_IPV6) + @javax.annotation.Nullable private String ipv6; + + public static final String SERIALIZED_NAME_MAC = "mac"; + + @SerializedName(SERIALIZED_NAME_MAC) + @javax.annotation.Nonnull + private String mac; + + public static final String SERIALIZED_NAME_NETWORK_ID = "networkId"; + + @SerializedName(SERIALIZED_NAME_NETWORK_ID) + @javax.annotation.Nonnull + private UUID networkId; + + public static final String SERIALIZED_NAME_NETWORK_NAME = "networkName"; + + @SerializedName(SERIALIZED_NAME_NETWORK_NAME) + @javax.annotation.Nonnull + private String networkName; + + public static final String SERIALIZED_NAME_NIC_ID = "nicId"; + + @SerializedName(SERIALIZED_NAME_NIC_ID) + @javax.annotation.Nonnull + private UUID nicId; + + public static final String SERIALIZED_NAME_NIC_SECURITY = "nicSecurity"; + + @SerializedName(SERIALIZED_NAME_NIC_SECURITY) + @javax.annotation.Nonnull + private Boolean nicSecurity; + + public static final String SERIALIZED_NAME_PUBLIC_IP = "publicIp"; + + @SerializedName(SERIALIZED_NAME_PUBLIC_IP) + @javax.annotation.Nullable private String publicIp; + + public static final String SERIALIZED_NAME_SECURITY_GROUPS = "securityGroups"; + + @SerializedName(SERIALIZED_NAME_SECURITY_GROUPS) + @javax.annotation.Nullable private List securityGroups = new ArrayList<>(); + + public ServerNetwork() {} + + public ServerNetwork allowedAddresses( + @javax.annotation.Nullable List allowedAddresses) { + this.allowedAddresses = allowedAddresses; + return this; + } + + public ServerNetwork addAllowedAddressesItem(AllowedAddressesInner allowedAddressesItem) { + if (this.allowedAddresses == null) { + this.allowedAddresses = new ArrayList<>(); + } + this.allowedAddresses.add(allowedAddressesItem); + return this; + } + + /** + * A list of IPs or CIDR notations. + * + * @return allowedAddresses + */ + @javax.annotation.Nullable public List getAllowedAddresses() { + return allowedAddresses; + } + + public void setAllowedAddresses( + @javax.annotation.Nullable List allowedAddresses) { + this.allowedAddresses = allowedAddresses; + } + + public ServerNetwork ipv4(@javax.annotation.Nullable String ipv4) { + this.ipv4 = ipv4; + return this; + } + + /** + * Object that represents an IP address. + * + * @return ipv4 + */ + @javax.annotation.Nullable public String getIpv4() { + return ipv4; + } + + public void setIpv4(@javax.annotation.Nullable String ipv4) { + this.ipv4 = ipv4; + } + + public ServerNetwork ipv6(@javax.annotation.Nullable String ipv6) { + this.ipv6 = ipv6; + return this; + } + + /** + * String that represents an IPv6 address. + * + * @return ipv6 + */ + @javax.annotation.Nullable public String getIpv6() { + return ipv6; + } + + public void setIpv6(@javax.annotation.Nullable String ipv6) { + this.ipv6 = ipv6; + } + + public ServerNetwork mac(@javax.annotation.Nonnull String mac) { + this.mac = mac; + return this; + } + + /** + * Object that represents an MAC address. + * + * @return mac + */ + @javax.annotation.Nonnull + public String getMac() { + return mac; + } + + public void setMac(@javax.annotation.Nonnull String mac) { + this.mac = mac; + } + + public ServerNetwork networkId(@javax.annotation.Nonnull UUID networkId) { + this.networkId = networkId; + return this; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return networkId + */ + @javax.annotation.Nonnull + public UUID getNetworkId() { + return networkId; + } + + public void setNetworkId(@javax.annotation.Nonnull UUID networkId) { + this.networkId = networkId; + } + + public ServerNetwork networkName(@javax.annotation.Nonnull String networkName) { + this.networkName = networkName; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return networkName + */ + @javax.annotation.Nonnull + public String getNetworkName() { + return networkName; + } + + public void setNetworkName(@javax.annotation.Nonnull String networkName) { + this.networkName = networkName; + } + + public ServerNetwork nicId(@javax.annotation.Nonnull UUID nicId) { + this.nicId = nicId; + return this; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return nicId + */ + @javax.annotation.Nonnull + public UUID getNicId() { + return nicId; + } + + public void setNicId(@javax.annotation.Nonnull UUID nicId) { + this.nicId = nicId; + } + + public ServerNetwork nicSecurity(@javax.annotation.Nonnull Boolean nicSecurity) { + this.nicSecurity = nicSecurity; + return this; + } + + /** + * If this is set to false, then no security groups will apply to this server network interface. + * + * @return nicSecurity + */ + @javax.annotation.Nonnull + public Boolean getNicSecurity() { + return nicSecurity; + } + + public void setNicSecurity(@javax.annotation.Nonnull Boolean nicSecurity) { + this.nicSecurity = nicSecurity; + } + + public ServerNetwork publicIp(@javax.annotation.Nullable String publicIp) { + this.publicIp = publicIp; + return this; + } + + /** + * Object that represents an IP address. + * + * @return publicIp + */ + @javax.annotation.Nullable public String getPublicIp() { + return publicIp; + } + + public void setPublicIp(@javax.annotation.Nullable String publicIp) { + this.publicIp = publicIp; + } + + public ServerNetwork securityGroups(@javax.annotation.Nullable List securityGroups) { + this.securityGroups = securityGroups; + return this; + } + + public ServerNetwork addSecurityGroupsItem(UUID securityGroupsItem) { + if (this.securityGroups == null) { + this.securityGroups = new ArrayList<>(); + } + this.securityGroups.add(securityGroupsItem); + return this; + } + + /** + * A list of UUIDs. + * + * @return securityGroups + */ + @javax.annotation.Nullable public List getSecurityGroups() { + return securityGroups; + } + + public void setSecurityGroups(@javax.annotation.Nullable List securityGroups) { + this.securityGroups = securityGroups; + } + + /** + * 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 ServerNetwork instance itself + */ + public ServerNetwork 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; + } + ServerNetwork serverNetwork = (ServerNetwork) o; + return Objects.equals(this.allowedAddresses, serverNetwork.allowedAddresses) + && Objects.equals(this.ipv4, serverNetwork.ipv4) + && Objects.equals(this.ipv6, serverNetwork.ipv6) + && Objects.equals(this.mac, serverNetwork.mac) + && Objects.equals(this.networkId, serverNetwork.networkId) + && Objects.equals(this.networkName, serverNetwork.networkName) + && Objects.equals(this.nicId, serverNetwork.nicId) + && Objects.equals(this.nicSecurity, serverNetwork.nicSecurity) + && Objects.equals(this.publicIp, serverNetwork.publicIp) + && Objects.equals(this.securityGroups, serverNetwork.securityGroups) + && Objects.equals(this.additionalProperties, serverNetwork.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + allowedAddresses, + ipv4, + ipv6, + mac, + networkId, + networkName, + nicId, + nicSecurity, + publicIp, + securityGroups, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ServerNetwork {\n"); + sb.append(" allowedAddresses: ").append(toIndentedString(allowedAddresses)).append("\n"); + sb.append(" ipv4: ").append(toIndentedString(ipv4)).append("\n"); + sb.append(" ipv6: ").append(toIndentedString(ipv6)).append("\n"); + sb.append(" mac: ").append(toIndentedString(mac)).append("\n"); + sb.append(" networkId: ").append(toIndentedString(networkId)).append("\n"); + sb.append(" networkName: ").append(toIndentedString(networkName)).append("\n"); + sb.append(" nicId: ").append(toIndentedString(nicId)).append("\n"); + sb.append(" nicSecurity: ").append(toIndentedString(nicSecurity)).append("\n"); + sb.append(" publicIp: ").append(toIndentedString(publicIp)).append("\n"); + sb.append(" securityGroups: ").append(toIndentedString(securityGroups)).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( + "allowedAddresses", + "ipv4", + "ipv6", + "mac", + "networkId", + "networkName", + "nicId", + "nicSecurity", + "publicIp", + "securityGroups")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = + new HashSet( + Arrays.asList("mac", "networkId", "networkName", "nicId", "nicSecurity")); + } + + /** + * 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 ServerNetwork + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ServerNetwork.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 ServerNetwork is not found in the empty JSON string", + ServerNetwork.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ServerNetwork.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("allowedAddresses") != null + && !jsonObj.get("allowedAddresses").isJsonNull()) { + JsonArray jsonArrayallowedAddresses = jsonObj.getAsJsonArray("allowedAddresses"); + if (jsonArrayallowedAddresses != null) { + // ensure the json data is an array + if (!jsonObj.get("allowedAddresses").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `allowedAddresses` to be an array in the JSON string but got `%s`", + jsonObj.get("allowedAddresses").toString())); + } + + // validate the optional field `allowedAddresses` (array) + for (int i = 0; i < jsonArrayallowedAddresses.size(); i++) { + AllowedAddressesInner.validateJsonElement(jsonArrayallowedAddresses.get(i)); + } + ; + } + } + if ((jsonObj.get("ipv4") != null && !jsonObj.get("ipv4").isJsonNull()) + && !jsonObj.get("ipv4").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `ipv4` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("ipv4").toString())); + } + if ((jsonObj.get("ipv6") != null && !jsonObj.get("ipv6").isJsonNull()) + && !jsonObj.get("ipv6").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `ipv6` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("ipv6").toString())); + } + if (!jsonObj.get("mac").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `mac` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("mac").toString())); + } + if (!jsonObj.get("networkId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `networkId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("networkId").toString())); + } + if (!jsonObj.get("networkName").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `networkName` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("networkName").toString())); + } + if (!jsonObj.get("nicId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `nicId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("nicId").toString())); + } + if ((jsonObj.get("publicIp") != null && !jsonObj.get("publicIp").isJsonNull()) + && !jsonObj.get("publicIp").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `publicIp` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("publicIp").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("securityGroups") != null + && !jsonObj.get("securityGroups").isJsonNull() + && !jsonObj.get("securityGroups").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `securityGroups` to be an array in the JSON string but got `%s`", + jsonObj.get("securityGroups").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ServerNetwork.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ServerNetwork' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(ServerNetwork.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ServerNetwork 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 ServerNetwork read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ServerNetwork 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 ServerNetwork given an JSON string + * + * @param jsonString JSON string + * @return An instance of ServerNetwork + * @throws IOException if the JSON string is invalid with respect to ServerNetwork + */ + public static ServerNetwork fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ServerNetwork.class); + } + + /** + * Convert an instance of ServerNetwork to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ServerNetworking.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ServerNetworking.java new file mode 100644 index 00000000..854f8682 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ServerNetworking.java @@ -0,0 +1,297 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +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 ServerNetworking extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(ServerNetworking.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ServerNetworking.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ServerNetworking' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterCreateServerNetworking = + gson.getDelegateAdapter(this, TypeToken.get(CreateServerNetworking.class)); + final TypeAdapter + adapterCreateServerNetworkingWithNics = + gson.getDelegateAdapter( + this, TypeToken.get(CreateServerNetworkingWithNics.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ServerNetworking value) + throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `CreateServerNetworking` + if (value.getActualInstance() instanceof CreateServerNetworking) { + JsonElement element = + adapterCreateServerNetworking.toJsonTree( + (CreateServerNetworking) value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type + // `CreateServerNetworkingWithNics` + if (value.getActualInstance() + instanceof CreateServerNetworkingWithNics) { + JsonElement element = + adapterCreateServerNetworkingWithNics.toJsonTree( + (CreateServerNetworkingWithNics) + value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException( + "Failed to serialize as the type doesn't match oneOf schemas: CreateServerNetworking, CreateServerNetworkingWithNics"); + } + + @Override + public ServerNetworking read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize CreateServerNetworking + try { + // validate the JSON object to see if any exception is thrown + CreateServerNetworking.validateJsonElement(jsonElement); + actualAdapter = adapterCreateServerNetworking; + match++; + log.log( + Level.FINER, + "Input data matches schema 'CreateServerNetworking'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for CreateServerNetworking failed with `%s`.", + e.getMessage())); + log.log( + Level.FINER, + "Input data does not match schema 'CreateServerNetworking'", + e); + } + // deserialize CreateServerNetworkingWithNics + try { + // validate the JSON object to see if any exception is thrown + CreateServerNetworkingWithNics.validateJsonElement(jsonElement); + actualAdapter = adapterCreateServerNetworkingWithNics; + match++; + log.log( + Level.FINER, + "Input data matches schema 'CreateServerNetworkingWithNics'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for CreateServerNetworkingWithNics failed with `%s`.", + e.getMessage())); + log.log( + Level.FINER, + "Input data does not match schema 'CreateServerNetworkingWithNics'", + e); + } + + if (match == 1) { + ServerNetworking ret = new ServerNetworking(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException( + String.format( + java.util.Locale.ROOT, + "Failed deserialization for ServerNetworking: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", + match, + errorMessages, + jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public ServerNetworking() { + super("oneOf", Boolean.FALSE); + } + + public ServerNetworking(Object o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("CreateServerNetworking", CreateServerNetworking.class); + schemas.put("CreateServerNetworkingWithNics", CreateServerNetworkingWithNics.class); + } + + @Override + public Map> getSchemas() { + return ServerNetworking.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: CreateServerNetworking, CreateServerNetworkingWithNics + * + *

It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof CreateServerNetworking) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof CreateServerNetworkingWithNics) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException( + "Invalid instance type. Must be CreateServerNetworking, CreateServerNetworkingWithNics"); + } + + /** + * Get the actual instance, which can be the following: CreateServerNetworking, + * CreateServerNetworkingWithNics + * + * @return The actual instance (CreateServerNetworking, CreateServerNetworkingWithNics) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `CreateServerNetworking`. If the actual instance is not + * `CreateServerNetworking`, the ClassCastException will be thrown. + * + * @return The actual instance of `CreateServerNetworking` + * @throws ClassCastException if the instance is not `CreateServerNetworking` + */ + public CreateServerNetworking getCreateServerNetworking() throws ClassCastException { + return (CreateServerNetworking) super.getActualInstance(); + } + + /** + * Get the actual instance of `CreateServerNetworkingWithNics`. If the actual instance is not + * `CreateServerNetworkingWithNics`, the ClassCastException will be thrown. + * + * @return The actual instance of `CreateServerNetworkingWithNics` + * @throws ClassCastException if the instance is not `CreateServerNetworkingWithNics` + */ + public CreateServerNetworkingWithNics getCreateServerNetworkingWithNics() + throws ClassCastException { + return (CreateServerNetworkingWithNics) 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 ServerNetworking + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with CreateServerNetworking + try { + CreateServerNetworking.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for CreateServerNetworking failed with `%s`.", + e.getMessage())); + // continue to the next one + } + // validate the json string with CreateServerNetworkingWithNics + try { + CreateServerNetworkingWithNics.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add( + String.format( + java.util.Locale.ROOT, + "Deserialization for CreateServerNetworkingWithNics failed with `%s`.", + e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException( + String.format( + java.util.Locale.ROOT, + "The JSON string is invalid for ServerNetworking with oneOf schemas: CreateServerNetworking, CreateServerNetworkingWithNics. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", + validCount, + errorMessages, + jsonElement.toString())); + } + } + + /** + * Create an instance of ServerNetworking given an JSON string + * + * @param jsonString JSON string + * @return An instance of ServerNetworking + * @throws IOException if the JSON string is invalid with respect to ServerNetworking + */ + public static ServerNetworking fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ServerNetworking.class); + } + + /** + * Convert an instance of ServerNetworking to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ServiceAccountMailListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ServiceAccountMailListResponse.java new file mode 100644 index 00000000..7469d701 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/ServiceAccountMailListResponse.java @@ -0,0 +1,329 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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.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; + +/** Service account mail list response. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class ServiceAccountMailListResponse { + public static final String SERIALIZED_NAME_ITEMS = "items"; + + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public ServiceAccountMailListResponse() {} + + public ServiceAccountMailListResponse items(@javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public ServiceAccountMailListResponse addItemsItem(String itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list of service account mails. + * + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ServiceAccountMailListResponse instance itself + */ + public ServiceAccountMailListResponse 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; + } + ServiceAccountMailListResponse serviceAccountMailListResponse = + (ServiceAccountMailListResponse) o; + return Objects.equals(this.items, serviceAccountMailListResponse.items) + && Objects.equals( + this.additionalProperties, + serviceAccountMailListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ServiceAccountMailListResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("items")); + } + + /** + * 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 + * ServiceAccountMailListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ServiceAccountMailListResponse.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 ServiceAccountMailListResponse is not found in the empty JSON string", + ServiceAccountMailListResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ServiceAccountMailListResponse.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 required json array is present + if (jsonObj.get("items") == null) { + throw new IllegalArgumentException( + "Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("items").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `items` to be an array in the JSON string but got `%s`", + jsonObj.get("items").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ServiceAccountMailListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ServiceAccountMailListResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(ServiceAccountMailListResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, ServiceAccountMailListResponse 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 ServiceAccountMailListResponse read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ServiceAccountMailListResponse 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 ServiceAccountMailListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ServiceAccountMailListResponse + * @throws IOException if the JSON string is invalid with respect to + * ServiceAccountMailListResponse + */ + public static ServiceAccountMailListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ServiceAccountMailListResponse.class); + } + + /** + * Convert an instance of ServiceAccountMailListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/SetImageSharePayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/SetImageSharePayload.java new file mode 100644 index 00000000..3911b22c --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/SetImageSharePayload.java @@ -0,0 +1,337 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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.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; +import java.util.UUID; + +/** + * Share details of an Image. For requests ParentOrganization and Projects are mutually exclusive. + */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class SetImageSharePayload { + public static final String SERIALIZED_NAME_PARENT_ORGANIZATION = "parentOrganization"; + + @SerializedName(SERIALIZED_NAME_PARENT_ORGANIZATION) + @javax.annotation.Nullable private Boolean parentOrganization; + + public static final String SERIALIZED_NAME_PROJECTS = "projects"; + + @SerializedName(SERIALIZED_NAME_PROJECTS) + @javax.annotation.Nullable private List projects = new ArrayList<>(); + + public SetImageSharePayload() {} + + public SetImageSharePayload parentOrganization( + @javax.annotation.Nullable Boolean parentOrganization) { + this.parentOrganization = parentOrganization; + return this; + } + + /** + * Image is shared with all projects inside the image owners organization. + * + * @return parentOrganization + */ + @javax.annotation.Nullable public Boolean getParentOrganization() { + return parentOrganization; + } + + public void setParentOrganization(@javax.annotation.Nullable Boolean parentOrganization) { + this.parentOrganization = parentOrganization; + } + + public SetImageSharePayload projects(@javax.annotation.Nullable List projects) { + this.projects = projects; + return this; + } + + public SetImageSharePayload addProjectsItem(UUID projectsItem) { + if (this.projects == null) { + this.projects = new ArrayList<>(); + } + this.projects.add(projectsItem); + return this; + } + + /** + * List of all projects the Image is shared with. + * + * @return projects + */ + @javax.annotation.Nullable public List getProjects() { + return projects; + } + + public void setProjects(@javax.annotation.Nullable List projects) { + this.projects = projects; + } + + /** + * 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 SetImageSharePayload instance itself + */ + public SetImageSharePayload 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; + } + SetImageSharePayload setImageSharePayload = (SetImageSharePayload) o; + return Objects.equals(this.parentOrganization, setImageSharePayload.parentOrganization) + && Objects.equals(this.projects, setImageSharePayload.projects) + && Objects.equals( + this.additionalProperties, setImageSharePayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(parentOrganization, projects, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SetImageSharePayload {\n"); + sb.append(" parentOrganization: ") + .append(toIndentedString(parentOrganization)) + .append("\n"); + sb.append(" projects: ").append(toIndentedString(projects)).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("parentOrganization", "projects")); + + // 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 SetImageSharePayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SetImageSharePayload.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 SetImageSharePayload is not found in the empty JSON string", + SetImageSharePayload.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("projects") != null + && !jsonObj.get("projects").isJsonNull() + && !jsonObj.get("projects").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `projects` to be an array in the JSON string but got `%s`", + jsonObj.get("projects").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SetImageSharePayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SetImageSharePayload' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(SetImageSharePayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, SetImageSharePayload 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 SetImageSharePayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SetImageSharePayload 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 SetImageSharePayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of SetImageSharePayload + * @throws IOException if the JSON string is invalid with respect to SetImageSharePayload + */ + public static SetImageSharePayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SetImageSharePayload.class); + } + + /** + * Convert an instance of SetImageSharePayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/Snapshot.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/Snapshot.java new file mode 100644 index 00000000..ad31102e --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/Snapshot.java @@ -0,0 +1,532 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; +import java.util.UUID; + +/** Object that represents a snapshot. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class Snapshot { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable private String description; + + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; + + public static final String SERIALIZED_NAME_SIZE = "size"; + + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nullable private Long size; + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable private String status; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable private OffsetDateTime updatedAt; + + public static final String SERIALIZED_NAME_VOLUME_ID = "volumeId"; + + @SerializedName(SERIALIZED_NAME_VOLUME_ID) + @javax.annotation.Nonnull + private UUID volumeId; + + public Snapshot() {} + + public Snapshot( + OffsetDateTime createdAt, UUID id, Long size, String status, OffsetDateTime updatedAt) { + this(); + this.createdAt = createdAt; + this.id = id; + this.size = size; + this.status = status; + this.updatedAt = updatedAt; + } + + /** + * Date-time when resource was created. + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public Snapshot description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Description Object. Allows string up to 255 Characters. + * + * @return description + */ + @javax.annotation.Nullable public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + public Snapshot labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public Snapshot name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nullable public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * Size in Gigabyte. + * + * @return size + */ + @javax.annotation.Nullable public Long getSize() { + return size; + } + + /** + * The status of a snapshot object. Possible values: `AVAILABLE`, + * `BACKING-UP`, `CREATING`, `DELETED`, `DELETING`, + * `ERROR`, `RESTORING`, `UNMANAGING`, `UPDATING`. + * + * @return status + */ + @javax.annotation.Nullable public String getStatus() { + return status; + } + + /** + * Date-time when resource was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nullable public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public Snapshot volumeId(@javax.annotation.Nonnull UUID volumeId) { + this.volumeId = volumeId; + return this; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return volumeId + */ + @javax.annotation.Nonnull + public UUID getVolumeId() { + return volumeId; + } + + public void setVolumeId(@javax.annotation.Nonnull UUID volumeId) { + this.volumeId = volumeId; + } + + /** + * 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 Snapshot instance itself + */ + public Snapshot 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; + } + Snapshot snapshot = (Snapshot) o; + return Objects.equals(this.createdAt, snapshot.createdAt) + && Objects.equals(this.description, snapshot.description) + && Objects.equals(this.id, snapshot.id) + && Objects.equals(this.labels, snapshot.labels) + && Objects.equals(this.name, snapshot.name) + && Objects.equals(this.size, snapshot.size) + && Objects.equals(this.status, snapshot.status) + && Objects.equals(this.updatedAt, snapshot.updatedAt) + && Objects.equals(this.volumeId, snapshot.volumeId) + && Objects.equals(this.additionalProperties, snapshot.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + createdAt, + description, + id, + labels, + name, + size, + status, + updatedAt, + volumeId, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Snapshot {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" volumeId: ").append(toIndentedString(volumeId)).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( + "createdAt", + "description", + "id", + "labels", + "name", + "size", + "status", + "updatedAt", + "volumeId")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("volumeId")); + } + + /** + * 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 Snapshot + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Snapshot.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 Snapshot is not found in the empty JSON string", + Snapshot.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Snapshot.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("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `description` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("description").toString())); + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `name` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("name").toString())); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) + && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `status` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("status").toString())); + } + if (!jsonObj.get("volumeId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `volumeId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("volumeId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Snapshot.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Snapshot' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(Snapshot.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, Snapshot 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 Snapshot read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Snapshot 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 Snapshot given an JSON string + * + * @param jsonString JSON string + * @return An instance of Snapshot + * @throws IOException if the JSON string is invalid with respect to Snapshot + */ + public static Snapshot fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Snapshot.class); + } + + /** + * Convert an instance of Snapshot to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/SnapshotListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/SnapshotListResponse.java new file mode 100644 index 00000000..6b67af57 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/SnapshotListResponse.java @@ -0,0 +1,326 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** Snapshot list response. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class SnapshotListResponse { + public static final String SERIALIZED_NAME_ITEMS = "items"; + + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public SnapshotListResponse() {} + + public SnapshotListResponse items(@javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public SnapshotListResponse addItemsItem(Snapshot itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list containing snapshot objects. + * + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SnapshotListResponse instance itself + */ + public SnapshotListResponse 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; + } + SnapshotListResponse snapshotListResponse = (SnapshotListResponse) o; + return Objects.equals(this.items, snapshotListResponse.items) + && Objects.equals( + this.additionalProperties, snapshotListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SnapshotListResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("items")); + } + + /** + * 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 SnapshotListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SnapshotListResponse.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 SnapshotListResponse is not found in the empty JSON string", + SnapshotListResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SnapshotListResponse.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("items").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `items` to be an array in the JSON string but got `%s`", + jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + Snapshot.validateJsonElement(jsonArrayitems.get(i)); + } + ; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SnapshotListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SnapshotListResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(SnapshotListResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, SnapshotListResponse 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 SnapshotListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SnapshotListResponse 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 SnapshotListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of SnapshotListResponse + * @throws IOException if the JSON string is invalid with respect to SnapshotListResponse + */ + public static SnapshotListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SnapshotListResponse.class); + } + + /** + * Convert an instance of SnapshotListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/StaticAreaID.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/StaticAreaID.java new file mode 100644 index 00000000..b9589121 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/StaticAreaID.java @@ -0,0 +1,73 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.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 identifier (ID) of a static area. */ +@JsonAdapter(StaticAreaID.Adapter.class) +public enum StaticAreaID { + PUBLIC("PUBLIC"), + + SCHWARZ("SCHWARZ"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + StaticAreaID(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StaticAreaID fromValue(String value) { + for (StaticAreaID b : StaticAreaID.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 StaticAreaID enumeration) + throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StaticAreaID read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StaticAreaID.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StaticAreaID.fromValue(value); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/UpdateAttachedVolumePayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/UpdateAttachedVolumePayload.java new file mode 100644 index 00000000..5cc25762 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/UpdateAttachedVolumePayload.java @@ -0,0 +1,351 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +/** Object that represents a Volume attachment to a server. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class UpdateAttachedVolumePayload { + public static final String SERIALIZED_NAME_DELETE_ON_TERMINATION = "deleteOnTermination"; + + @SerializedName(SERIALIZED_NAME_DELETE_ON_TERMINATION) + @javax.annotation.Nullable private Boolean deleteOnTermination; + + public static final String SERIALIZED_NAME_SERVER_ID = "serverId"; + + @SerializedName(SERIALIZED_NAME_SERVER_ID) + @javax.annotation.Nullable private UUID serverId; + + public static final String SERIALIZED_NAME_VOLUME_ID = "volumeId"; + + @SerializedName(SERIALIZED_NAME_VOLUME_ID) + @javax.annotation.Nullable private UUID volumeId; + + public UpdateAttachedVolumePayload() {} + + public UpdateAttachedVolumePayload(UUID serverId, UUID volumeId) { + this(); + this.serverId = serverId; + this.volumeId = volumeId; + } + + public UpdateAttachedVolumePayload deleteOnTermination( + @javax.annotation.Nullable Boolean deleteOnTermination) { + this.deleteOnTermination = deleteOnTermination; + return this; + } + + /** + * Delete the volume during the termination of the server. Defaults to false. + * + * @return deleteOnTermination + */ + @javax.annotation.Nullable public Boolean getDeleteOnTermination() { + return deleteOnTermination; + } + + public void setDeleteOnTermination(@javax.annotation.Nullable Boolean deleteOnTermination) { + this.deleteOnTermination = deleteOnTermination; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return serverId + */ + @javax.annotation.Nullable public UUID getServerId() { + return serverId; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return volumeId + */ + @javax.annotation.Nullable public UUID getVolumeId() { + return volumeId; + } + + /** + * 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 UpdateAttachedVolumePayload instance itself + */ + public UpdateAttachedVolumePayload 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; + } + UpdateAttachedVolumePayload updateAttachedVolumePayload = (UpdateAttachedVolumePayload) o; + return Objects.equals( + this.deleteOnTermination, updateAttachedVolumePayload.deleteOnTermination) + && Objects.equals(this.serverId, updateAttachedVolumePayload.serverId) + && Objects.equals(this.volumeId, updateAttachedVolumePayload.volumeId) + && Objects.equals( + this.additionalProperties, + updateAttachedVolumePayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(deleteOnTermination, serverId, volumeId, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateAttachedVolumePayload {\n"); + sb.append(" deleteOnTermination: ") + .append(toIndentedString(deleteOnTermination)) + .append("\n"); + sb.append(" serverId: ").append(toIndentedString(serverId)).append("\n"); + sb.append(" volumeId: ").append(toIndentedString(volumeId)).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("deleteOnTermination", "serverId", "volumeId")); + + // 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 + * UpdateAttachedVolumePayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateAttachedVolumePayload.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 UpdateAttachedVolumePayload is not found in the empty JSON string", + UpdateAttachedVolumePayload.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("serverId") != null && !jsonObj.get("serverId").isJsonNull()) + && !jsonObj.get("serverId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `serverId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("serverId").toString())); + } + if ((jsonObj.get("volumeId") != null && !jsonObj.get("volumeId").isJsonNull()) + && !jsonObj.get("volumeId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `volumeId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("volumeId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateAttachedVolumePayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateAttachedVolumePayload' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateAttachedVolumePayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateAttachedVolumePayload 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 UpdateAttachedVolumePayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateAttachedVolumePayload 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 UpdateAttachedVolumePayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateAttachedVolumePayload + * @throws IOException if the JSON string is invalid with respect to UpdateAttachedVolumePayload + */ + public static UpdateAttachedVolumePayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateAttachedVolumePayload.class); + } + + /** + * Convert an instance of UpdateAttachedVolumePayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/UpdateImagePayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/UpdateImagePayload.java new file mode 100644 index 00000000..385ea041 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/UpdateImagePayload.java @@ -0,0 +1,510 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** Object that represents an update request body of an Image. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class UpdateImagePayload { + public static final String SERIALIZED_NAME_AGENT = "agent"; + + @SerializedName(SERIALIZED_NAME_AGENT) + @javax.annotation.Nullable private ImageAgent agent; + + public static final String SERIALIZED_NAME_CONFIG = "config"; + + @SerializedName(SERIALIZED_NAME_CONFIG) + @javax.annotation.Nullable private ImageConfig config; + + public static final String SERIALIZED_NAME_DISK_FORMAT = "diskFormat"; + + @SerializedName(SERIALIZED_NAME_DISK_FORMAT) + @javax.annotation.Nullable private String diskFormat; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_MIN_DISK_SIZE = "minDiskSize"; + + @SerializedName(SERIALIZED_NAME_MIN_DISK_SIZE) + @javax.annotation.Nullable private Long minDiskSize; + + public static final String SERIALIZED_NAME_MIN_RAM = "minRam"; + + @SerializedName(SERIALIZED_NAME_MIN_RAM) + @javax.annotation.Nullable private Long minRam; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; + + public static final String SERIALIZED_NAME_PROTECTED = "protected"; + + @SerializedName(SERIALIZED_NAME_PROTECTED) + @javax.annotation.Nullable private Boolean _protected; + + public UpdateImagePayload() {} + + public UpdateImagePayload agent(@javax.annotation.Nullable ImageAgent agent) { + this.agent = agent; + return this; + } + + /** + * Get agent + * + * @return agent + */ + @javax.annotation.Nullable public ImageAgent getAgent() { + return agent; + } + + public void setAgent(@javax.annotation.Nullable ImageAgent agent) { + this.agent = agent; + } + + public UpdateImagePayload config(@javax.annotation.Nullable ImageConfig config) { + this.config = config; + return this; + } + + /** + * Get config + * + * @return config + */ + @javax.annotation.Nullable public ImageConfig getConfig() { + return config; + } + + public void setConfig(@javax.annotation.Nullable ImageConfig config) { + this.config = config; + } + + public UpdateImagePayload diskFormat(@javax.annotation.Nullable String diskFormat) { + this.diskFormat = diskFormat; + return this; + } + + /** + * Object that represents a disk format. Possible values: `raw`, `qcow2`, + * `iso`. + * + * @return diskFormat + */ + @javax.annotation.Nullable public String getDiskFormat() { + return diskFormat; + } + + public void setDiskFormat(@javax.annotation.Nullable String diskFormat) { + this.diskFormat = diskFormat; + } + + public UpdateImagePayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public UpdateImagePayload minDiskSize(@javax.annotation.Nullable Long minDiskSize) { + this.minDiskSize = minDiskSize; + return this; + } + + /** + * Size in Gigabyte. + * + * @return minDiskSize + */ + @javax.annotation.Nullable public Long getMinDiskSize() { + return minDiskSize; + } + + public void setMinDiskSize(@javax.annotation.Nullable Long minDiskSize) { + this.minDiskSize = minDiskSize; + } + + public UpdateImagePayload minRam(@javax.annotation.Nullable Long minRam) { + this.minRam = minRam; + return this; + } + + /** + * Size in Megabyte. + * + * @return minRam + */ + @javax.annotation.Nullable public Long getMinRam() { + return minRam; + } + + public void setMinRam(@javax.annotation.Nullable Long minRam) { + this.minRam = minRam; + } + + public UpdateImagePayload name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nullable public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + public UpdateImagePayload _protected(@javax.annotation.Nullable Boolean _protected) { + this._protected = _protected; + return this; + } + + /** + * When true the image is prevented from being deleted. + * + * @return _protected + */ + @javax.annotation.Nullable public Boolean getProtected() { + return _protected; + } + + public void setProtected(@javax.annotation.Nullable Boolean _protected) { + this._protected = _protected; + } + + /** + * 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 UpdateImagePayload instance itself + */ + public UpdateImagePayload 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; + } + UpdateImagePayload updateImagePayload = (UpdateImagePayload) o; + return Objects.equals(this.agent, updateImagePayload.agent) + && Objects.equals(this.config, updateImagePayload.config) + && Objects.equals(this.diskFormat, updateImagePayload.diskFormat) + && Objects.equals(this.labels, updateImagePayload.labels) + && Objects.equals(this.minDiskSize, updateImagePayload.minDiskSize) + && Objects.equals(this.minRam, updateImagePayload.minRam) + && Objects.equals(this.name, updateImagePayload.name) + && Objects.equals(this._protected, updateImagePayload._protected) + && Objects.equals( + this.additionalProperties, updateImagePayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + agent, + config, + diskFormat, + labels, + minDiskSize, + minRam, + name, + _protected, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateImagePayload {\n"); + sb.append(" agent: ").append(toIndentedString(agent)).append("\n"); + sb.append(" config: ").append(toIndentedString(config)).append("\n"); + sb.append(" diskFormat: ").append(toIndentedString(diskFormat)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" minDiskSize: ").append(toIndentedString(minDiskSize)).append("\n"); + sb.append(" minRam: ").append(toIndentedString(minRam)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" _protected: ").append(toIndentedString(_protected)).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( + "agent", + "config", + "diskFormat", + "labels", + "minDiskSize", + "minRam", + "name", + "protected")); + + // 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 UpdateImagePayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateImagePayload.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 UpdateImagePayload is not found in the empty JSON string", + UpdateImagePayload.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `agent` + if (jsonObj.get("agent") != null && !jsonObj.get("agent").isJsonNull()) { + ImageAgent.validateJsonElement(jsonObj.get("agent")); + } + // validate the optional field `config` + if (jsonObj.get("config") != null && !jsonObj.get("config").isJsonNull()) { + ImageConfig.validateJsonElement(jsonObj.get("config")); + } + if ((jsonObj.get("diskFormat") != null && !jsonObj.get("diskFormat").isJsonNull()) + && !jsonObj.get("diskFormat").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `diskFormat` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("diskFormat").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `name` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateImagePayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateImagePayload' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateImagePayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateImagePayload 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 UpdateImagePayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateImagePayload 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 UpdateImagePayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateImagePayload + * @throws IOException if the JSON string is invalid with respect to UpdateImagePayload + */ + public static UpdateImagePayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateImagePayload.class); + } + + /** + * Convert an instance of UpdateImagePayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/UpdateImageSharePayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/UpdateImageSharePayload.java new file mode 100644 index 00000000..23dc19b7 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/UpdateImageSharePayload.java @@ -0,0 +1,338 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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.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; +import java.util.UUID; + +/** + * Share details of an Image. For requests ParentOrganization and Projects are mutually exclusive. + */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class UpdateImageSharePayload { + public static final String SERIALIZED_NAME_PARENT_ORGANIZATION = "parentOrganization"; + + @SerializedName(SERIALIZED_NAME_PARENT_ORGANIZATION) + @javax.annotation.Nullable private Boolean parentOrganization; + + public static final String SERIALIZED_NAME_PROJECTS = "projects"; + + @SerializedName(SERIALIZED_NAME_PROJECTS) + @javax.annotation.Nullable private List projects = new ArrayList<>(); + + public UpdateImageSharePayload() {} + + public UpdateImageSharePayload parentOrganization( + @javax.annotation.Nullable Boolean parentOrganization) { + this.parentOrganization = parentOrganization; + return this; + } + + /** + * Image is shared with all projects inside the image owners organization. + * + * @return parentOrganization + */ + @javax.annotation.Nullable public Boolean getParentOrganization() { + return parentOrganization; + } + + public void setParentOrganization(@javax.annotation.Nullable Boolean parentOrganization) { + this.parentOrganization = parentOrganization; + } + + public UpdateImageSharePayload projects(@javax.annotation.Nullable List projects) { + this.projects = projects; + return this; + } + + public UpdateImageSharePayload addProjectsItem(UUID projectsItem) { + if (this.projects == null) { + this.projects = new ArrayList<>(); + } + this.projects.add(projectsItem); + return this; + } + + /** + * List of all projects the Image is shared with. + * + * @return projects + */ + @javax.annotation.Nullable public List getProjects() { + return projects; + } + + public void setProjects(@javax.annotation.Nullable List projects) { + this.projects = projects; + } + + /** + * 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 UpdateImageSharePayload instance itself + */ + public UpdateImageSharePayload 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; + } + UpdateImageSharePayload updateImageSharePayload = (UpdateImageSharePayload) o; + return Objects.equals(this.parentOrganization, updateImageSharePayload.parentOrganization) + && Objects.equals(this.projects, updateImageSharePayload.projects) + && Objects.equals( + this.additionalProperties, updateImageSharePayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(parentOrganization, projects, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateImageSharePayload {\n"); + sb.append(" parentOrganization: ") + .append(toIndentedString(parentOrganization)) + .append("\n"); + sb.append(" projects: ").append(toIndentedString(projects)).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("parentOrganization", "projects")); + + // 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 UpdateImageSharePayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateImageSharePayload.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 UpdateImageSharePayload is not found in the empty JSON string", + UpdateImageSharePayload.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("projects") != null + && !jsonObj.get("projects").isJsonNull() + && !jsonObj.get("projects").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `projects` to be an array in the JSON string but got `%s`", + jsonObj.get("projects").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateImageSharePayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateImageSharePayload' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateImageSharePayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateImageSharePayload 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 UpdateImageSharePayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateImageSharePayload 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 UpdateImageSharePayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateImageSharePayload + * @throws IOException if the JSON string is invalid with respect to UpdateImageSharePayload + */ + public static UpdateImageSharePayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateImageSharePayload.class); + } + + /** + * Convert an instance of UpdateImageSharePayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/UpdateKeyPairPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/UpdateKeyPairPayload.java new file mode 100644 index 00000000..5199049b --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/UpdateKeyPairPayload.java @@ -0,0 +1,291 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** Object that represents an update request body of a public key of an SSH keypair. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class UpdateKeyPairPayload { + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public UpdateKeyPairPayload() {} + + public UpdateKeyPairPayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UpdateKeyPairPayload instance itself + */ + public UpdateKeyPairPayload 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; + } + UpdateKeyPairPayload updateKeyPairPayload = (UpdateKeyPairPayload) o; + return Objects.equals(this.labels, updateKeyPairPayload.labels) + && Objects.equals( + this.additionalProperties, updateKeyPairPayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(labels, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateKeyPairPayload {\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("labels")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(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 UpdateKeyPairPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateKeyPairPayload.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 UpdateKeyPairPayload is not found in the empty JSON string", + UpdateKeyPairPayload.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateKeyPairPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateKeyPairPayload' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateKeyPairPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateKeyPairPayload 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 UpdateKeyPairPayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateKeyPairPayload 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 UpdateKeyPairPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateKeyPairPayload + * @throws IOException if the JSON string is invalid with respect to UpdateKeyPairPayload + */ + public static UpdateKeyPairPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateKeyPairPayload.class); + } + + /** + * Convert an instance of UpdateKeyPairPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/UpdateNetworkIPv4Body.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/UpdateNetworkIPv4Body.java new file mode 100644 index 00000000..2c693b97 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/UpdateNetworkIPv4Body.java @@ -0,0 +1,357 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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.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; +import org.openapitools.jackson.nullable.JsonNullable; + +/** The config object for a IPv4 network update. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class UpdateNetworkIPv4Body { + public static final String SERIALIZED_NAME_GATEWAY = "gateway"; + + @SerializedName(SERIALIZED_NAME_GATEWAY) + @javax.annotation.Nullable private String gateway; + + public static final String SERIALIZED_NAME_NAMESERVERS = "nameservers"; + + @SerializedName(SERIALIZED_NAME_NAMESERVERS) + @javax.annotation.Nullable private List nameservers = new ArrayList<>(); + + public UpdateNetworkIPv4Body() {} + + public UpdateNetworkIPv4Body gateway(@javax.annotation.Nullable String gateway) { + this.gateway = gateway; + return this; + } + + /** + * The IPv4 gateway of a network. If not specified the first IP of the network will be assigned + * as the gateway. If 'null' is sent, then the network doesn't have a gateway. + * + * @return gateway + */ + @javax.annotation.Nullable public String getGateway() { + return gateway; + } + + public void setGateway(@javax.annotation.Nullable String gateway) { + this.gateway = gateway; + } + + public UpdateNetworkIPv4Body nameservers(@javax.annotation.Nullable List nameservers) { + this.nameservers = nameservers; + return this; + } + + public UpdateNetworkIPv4Body addNameserversItem(String nameserversItem) { + if (this.nameservers == null) { + this.nameservers = new ArrayList<>(); + } + this.nameservers.add(nameserversItem); + return this; + } + + /** + * A list containing DNS Servers/Nameservers for IPv4. + * + * @return nameservers + */ + @javax.annotation.Nullable public List getNameservers() { + return nameservers; + } + + public void setNameservers(@javax.annotation.Nullable List nameservers) { + this.nameservers = nameservers; + } + + /** + * 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 UpdateNetworkIPv4Body instance itself + */ + public UpdateNetworkIPv4Body 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; + } + UpdateNetworkIPv4Body updateNetworkIPv4Body = (UpdateNetworkIPv4Body) o; + return Objects.equals(this.gateway, updateNetworkIPv4Body.gateway) + && Objects.equals(this.nameservers, updateNetworkIPv4Body.nameservers) + && Objects.equals( + this.additionalProperties, updateNetworkIPv4Body.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(gateway, nameservers, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateNetworkIPv4Body {\n"); + sb.append(" gateway: ").append(toIndentedString(gateway)).append("\n"); + sb.append(" nameservers: ").append(toIndentedString(nameservers)).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("gateway", "nameservers")); + + // 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 UpdateNetworkIPv4Body + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateNetworkIPv4Body.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 UpdateNetworkIPv4Body is not found in the empty JSON string", + UpdateNetworkIPv4Body.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("gateway") != null && !jsonObj.get("gateway").isJsonNull()) + && !jsonObj.get("gateway").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `gateway` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("gateway").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("nameservers") != null + && !jsonObj.get("nameservers").isJsonNull() + && !jsonObj.get("nameservers").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `nameservers` to be an array in the JSON string but got `%s`", + jsonObj.get("nameservers").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateNetworkIPv4Body.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateNetworkIPv4Body' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateNetworkIPv4Body.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateNetworkIPv4Body 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 UpdateNetworkIPv4Body read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateNetworkIPv4Body 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 UpdateNetworkIPv4Body given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateNetworkIPv4Body + * @throws IOException if the JSON string is invalid with respect to UpdateNetworkIPv4Body + */ + public static UpdateNetworkIPv4Body fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateNetworkIPv4Body.class); + } + + /** + * Convert an instance of UpdateNetworkIPv4Body to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/UpdateNetworkIPv6Body.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/UpdateNetworkIPv6Body.java new file mode 100644 index 00000000..320ac477 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/UpdateNetworkIPv6Body.java @@ -0,0 +1,357 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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.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; +import org.openapitools.jackson.nullable.JsonNullable; + +/** The config object for a IPv6 network update. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class UpdateNetworkIPv6Body { + public static final String SERIALIZED_NAME_GATEWAY = "gateway"; + + @SerializedName(SERIALIZED_NAME_GATEWAY) + @javax.annotation.Nullable private String gateway; + + public static final String SERIALIZED_NAME_NAMESERVERS = "nameservers"; + + @SerializedName(SERIALIZED_NAME_NAMESERVERS) + @javax.annotation.Nullable private List nameservers = new ArrayList<>(); + + public UpdateNetworkIPv6Body() {} + + public UpdateNetworkIPv6Body gateway(@javax.annotation.Nullable String gateway) { + this.gateway = gateway; + return this; + } + + /** + * The IPv6 gateway of a network. If not specified the first IP of the network will be assigned + * as the gateway. If 'null' is sent, then the network doesn't have a gateway. + * + * @return gateway + */ + @javax.annotation.Nullable public String getGateway() { + return gateway; + } + + public void setGateway(@javax.annotation.Nullable String gateway) { + this.gateway = gateway; + } + + public UpdateNetworkIPv6Body nameservers(@javax.annotation.Nullable List nameservers) { + this.nameservers = nameservers; + return this; + } + + public UpdateNetworkIPv6Body addNameserversItem(String nameserversItem) { + if (this.nameservers == null) { + this.nameservers = new ArrayList<>(); + } + this.nameservers.add(nameserversItem); + return this; + } + + /** + * A list containing DNS Servers/Nameservers for IPv6. + * + * @return nameservers + */ + @javax.annotation.Nullable public List getNameservers() { + return nameservers; + } + + public void setNameservers(@javax.annotation.Nullable List nameservers) { + this.nameservers = nameservers; + } + + /** + * 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 UpdateNetworkIPv6Body instance itself + */ + public UpdateNetworkIPv6Body 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; + } + UpdateNetworkIPv6Body updateNetworkIPv6Body = (UpdateNetworkIPv6Body) o; + return Objects.equals(this.gateway, updateNetworkIPv6Body.gateway) + && Objects.equals(this.nameservers, updateNetworkIPv6Body.nameservers) + && Objects.equals( + this.additionalProperties, updateNetworkIPv6Body.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(gateway, nameservers, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateNetworkIPv6Body {\n"); + sb.append(" gateway: ").append(toIndentedString(gateway)).append("\n"); + sb.append(" nameservers: ").append(toIndentedString(nameservers)).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("gateway", "nameservers")); + + // 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 UpdateNetworkIPv6Body + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateNetworkIPv6Body.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 UpdateNetworkIPv6Body is not found in the empty JSON string", + UpdateNetworkIPv6Body.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("gateway") != null && !jsonObj.get("gateway").isJsonNull()) + && !jsonObj.get("gateway").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `gateway` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("gateway").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("nameservers") != null + && !jsonObj.get("nameservers").isJsonNull() + && !jsonObj.get("nameservers").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `nameservers` to be an array in the JSON string but got `%s`", + jsonObj.get("nameservers").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateNetworkIPv6Body.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateNetworkIPv6Body' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateNetworkIPv6Body.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateNetworkIPv6Body 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 UpdateNetworkIPv6Body read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateNetworkIPv6Body 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 UpdateNetworkIPv6Body given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateNetworkIPv6Body + * @throws IOException if the JSON string is invalid with respect to UpdateNetworkIPv6Body + */ + public static UpdateNetworkIPv6Body fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateNetworkIPv6Body.class); + } + + /** + * Convert an instance of UpdateNetworkIPv6Body to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/UpdateNicPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/UpdateNicPayload.java new file mode 100644 index 00000000..6116f79d --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/UpdateNicPayload.java @@ -0,0 +1,497 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; +import java.util.UUID; + +/** Object that represents a network interface update. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class UpdateNicPayload { + public static final String SERIALIZED_NAME_ALLOWED_ADDRESSES = "allowedAddresses"; + + @SerializedName(SERIALIZED_NAME_ALLOWED_ADDRESSES) + @javax.annotation.Nullable private List allowedAddresses = new ArrayList<>(); + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable private String description; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; + + public static final String SERIALIZED_NAME_NIC_SECURITY = "nicSecurity"; + + @SerializedName(SERIALIZED_NAME_NIC_SECURITY) + @javax.annotation.Nullable private Boolean nicSecurity; + + public static final String SERIALIZED_NAME_SECURITY_GROUPS = "securityGroups"; + + @SerializedName(SERIALIZED_NAME_SECURITY_GROUPS) + @javax.annotation.Nullable private List securityGroups = new ArrayList<>(); + + public UpdateNicPayload() {} + + public UpdateNicPayload allowedAddresses( + @javax.annotation.Nullable List allowedAddresses) { + this.allowedAddresses = allowedAddresses; + return this; + } + + public UpdateNicPayload addAllowedAddressesItem(AllowedAddressesInner allowedAddressesItem) { + if (this.allowedAddresses == null) { + this.allowedAddresses = new ArrayList<>(); + } + this.allowedAddresses.add(allowedAddressesItem); + return this; + } + + /** + * A list of IPs or CIDR notations. + * + * @return allowedAddresses + */ + @javax.annotation.Nullable public List getAllowedAddresses() { + return allowedAddresses; + } + + public void setAllowedAddresses( + @javax.annotation.Nullable List allowedAddresses) { + this.allowedAddresses = allowedAddresses; + } + + public UpdateNicPayload description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Description Object. Allows string up to 255 Characters. + * + * @return description + */ + @javax.annotation.Nullable public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + public UpdateNicPayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public UpdateNicPayload name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nullable public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + public UpdateNicPayload nicSecurity(@javax.annotation.Nullable Boolean nicSecurity) { + this.nicSecurity = nicSecurity; + return this; + } + + /** + * If this is set to false, then no security groups will apply to this network interface. + * + * @return nicSecurity + */ + @javax.annotation.Nullable public Boolean getNicSecurity() { + return nicSecurity; + } + + public void setNicSecurity(@javax.annotation.Nullable Boolean nicSecurity) { + this.nicSecurity = nicSecurity; + } + + public UpdateNicPayload securityGroups(@javax.annotation.Nullable List securityGroups) { + this.securityGroups = securityGroups; + return this; + } + + public UpdateNicPayload addSecurityGroupsItem(UUID securityGroupsItem) { + if (this.securityGroups == null) { + this.securityGroups = new ArrayList<>(); + } + this.securityGroups.add(securityGroupsItem); + return this; + } + + /** + * A list of UUIDs. + * + * @return securityGroups + */ + @javax.annotation.Nullable public List getSecurityGroups() { + return securityGroups; + } + + public void setSecurityGroups(@javax.annotation.Nullable List securityGroups) { + this.securityGroups = securityGroups; + } + + /** + * 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 UpdateNicPayload instance itself + */ + public UpdateNicPayload 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; + } + UpdateNicPayload updateNicPayload = (UpdateNicPayload) o; + return Objects.equals(this.allowedAddresses, updateNicPayload.allowedAddresses) + && Objects.equals(this.description, updateNicPayload.description) + && Objects.equals(this.labels, updateNicPayload.labels) + && Objects.equals(this.name, updateNicPayload.name) + && Objects.equals(this.nicSecurity, updateNicPayload.nicSecurity) + && Objects.equals(this.securityGroups, updateNicPayload.securityGroups) + && Objects.equals(this.additionalProperties, updateNicPayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + allowedAddresses, + description, + labels, + name, + nicSecurity, + securityGroups, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateNicPayload {\n"); + sb.append(" allowedAddresses: ").append(toIndentedString(allowedAddresses)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" nicSecurity: ").append(toIndentedString(nicSecurity)).append("\n"); + sb.append(" securityGroups: ").append(toIndentedString(securityGroups)).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( + "allowedAddresses", + "description", + "labels", + "name", + "nicSecurity", + "securityGroups")); + + // 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 UpdateNicPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateNicPayload.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 UpdateNicPayload is not found in the empty JSON string", + UpdateNicPayload.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("allowedAddresses") != null + && !jsonObj.get("allowedAddresses").isJsonNull()) { + JsonArray jsonArrayallowedAddresses = jsonObj.getAsJsonArray("allowedAddresses"); + if (jsonArrayallowedAddresses != null) { + // ensure the json data is an array + if (!jsonObj.get("allowedAddresses").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `allowedAddresses` to be an array in the JSON string but got `%s`", + jsonObj.get("allowedAddresses").toString())); + } + + // validate the optional field `allowedAddresses` (array) + for (int i = 0; i < jsonArrayallowedAddresses.size(); i++) { + AllowedAddressesInner.validateJsonElement(jsonArrayallowedAddresses.get(i)); + } + ; + } + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `description` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("description").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `name` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("name").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("securityGroups") != null + && !jsonObj.get("securityGroups").isJsonNull() + && !jsonObj.get("securityGroups").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `securityGroups` to be an array in the JSON string but got `%s`", + jsonObj.get("securityGroups").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateNicPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateNicPayload' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateNicPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateNicPayload 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 UpdateNicPayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateNicPayload 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 UpdateNicPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateNicPayload + * @throws IOException if the JSON string is invalid with respect to UpdateNicPayload + */ + public static UpdateNicPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateNicPayload.class); + } + + /** + * Convert an instance of UpdateNicPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/UpdatePublicIPPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/UpdatePublicIPPayload.java new file mode 100644 index 00000000..6bd5f6dc --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/UpdatePublicIPPayload.java @@ -0,0 +1,399 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Object that represents a public IP. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class UpdatePublicIPPayload { + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_IP = "ip"; + + @SerializedName(SERIALIZED_NAME_IP) + @javax.annotation.Nullable private String ip; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NETWORK_INTERFACE = "networkInterface"; + + @SerializedName(SERIALIZED_NAME_NETWORK_INTERFACE) + @javax.annotation.Nullable private UUID networkInterface; + + public UpdatePublicIPPayload() {} + + public UpdatePublicIPPayload(UUID id, String ip) { + this(); + this.id = id; + this.ip = ip; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + /** + * String that represents an IPv4 address. + * + * @return ip + */ + @javax.annotation.Nullable public String getIp() { + return ip; + } + + public UpdatePublicIPPayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public UpdatePublicIPPayload networkInterface( + @javax.annotation.Nullable UUID networkInterface) { + this.networkInterface = networkInterface; + return this; + } + + /** + * Associate the public IP with a network interface (ID). + * + * @return networkInterface + */ + @javax.annotation.Nullable public UUID getNetworkInterface() { + return networkInterface; + } + + public void setNetworkInterface(@javax.annotation.Nullable UUID networkInterface) { + this.networkInterface = networkInterface; + } + + /** + * 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 UpdatePublicIPPayload instance itself + */ + public UpdatePublicIPPayload 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; + } + UpdatePublicIPPayload updatePublicIPPayload = (UpdatePublicIPPayload) o; + return Objects.equals(this.id, updatePublicIPPayload.id) + && Objects.equals(this.ip, updatePublicIPPayload.ip) + && Objects.equals(this.labels, updatePublicIPPayload.labels) + && Objects.equals(this.networkInterface, updatePublicIPPayload.networkInterface) + && Objects.equals( + this.additionalProperties, updatePublicIPPayload.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b + || (a != null + && b != null + && a.isPresent() + && b.isPresent() + && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(id, ip, labels, networkInterface, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdatePublicIPPayload {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" ip: ").append(toIndentedString(ip)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" networkInterface: ").append(toIndentedString(networkInterface)).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("id", "ip", "labels", "networkInterface")); + + // 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 UpdatePublicIPPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdatePublicIPPayload.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 UpdatePublicIPPayload is not found in the empty JSON string", + UpdatePublicIPPayload.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if ((jsonObj.get("ip") != null && !jsonObj.get("ip").isJsonNull()) + && !jsonObj.get("ip").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `ip` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("ip").toString())); + } + if ((jsonObj.get("networkInterface") != null + && !jsonObj.get("networkInterface").isJsonNull()) + && !jsonObj.get("networkInterface").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `networkInterface` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("networkInterface").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdatePublicIPPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdatePublicIPPayload' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdatePublicIPPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdatePublicIPPayload 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 UpdatePublicIPPayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdatePublicIPPayload 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 UpdatePublicIPPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdatePublicIPPayload + * @throws IOException if the JSON string is invalid with respect to UpdatePublicIPPayload + */ + public static UpdatePublicIPPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdatePublicIPPayload.class); + } + + /** + * Convert an instance of UpdatePublicIPPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/UpdateRegionalAreaIPv4.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/UpdateRegionalAreaIPv4.java new file mode 100644 index 00000000..663e060d --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/UpdateRegionalAreaIPv4.java @@ -0,0 +1,398 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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.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; + +/** + * Object that represents the request body for a regional network area IPv4 configuration update. + */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class UpdateRegionalAreaIPv4 { + public static final String SERIALIZED_NAME_DEFAULT_NAMESERVERS = "defaultNameservers"; + + @SerializedName(SERIALIZED_NAME_DEFAULT_NAMESERVERS) + @javax.annotation.Nullable private List defaultNameservers = new ArrayList<>(); + + public static final String SERIALIZED_NAME_DEFAULT_PREFIX_LEN = "defaultPrefixLen"; + + @SerializedName(SERIALIZED_NAME_DEFAULT_PREFIX_LEN) + @javax.annotation.Nullable private Long defaultPrefixLen; + + public static final String SERIALIZED_NAME_MAX_PREFIX_LEN = "maxPrefixLen"; + + @SerializedName(SERIALIZED_NAME_MAX_PREFIX_LEN) + @javax.annotation.Nullable private Long maxPrefixLen; + + public static final String SERIALIZED_NAME_MIN_PREFIX_LEN = "minPrefixLen"; + + @SerializedName(SERIALIZED_NAME_MIN_PREFIX_LEN) + @javax.annotation.Nullable private Long minPrefixLen; + + public UpdateRegionalAreaIPv4() {} + + public UpdateRegionalAreaIPv4 defaultNameservers( + @javax.annotation.Nullable List defaultNameservers) { + this.defaultNameservers = defaultNameservers; + return this; + } + + public UpdateRegionalAreaIPv4 addDefaultNameserversItem(String defaultNameserversItem) { + if (this.defaultNameservers == null) { + this.defaultNameservers = new ArrayList<>(); + } + this.defaultNameservers.add(defaultNameserversItem); + return this; + } + + /** + * Get defaultNameservers + * + * @return defaultNameservers + */ + @javax.annotation.Nullable public List getDefaultNameservers() { + return defaultNameservers; + } + + public void setDefaultNameservers(@javax.annotation.Nullable List defaultNameservers) { + this.defaultNameservers = defaultNameservers; + } + + public UpdateRegionalAreaIPv4 defaultPrefixLen( + @javax.annotation.Nullable Long defaultPrefixLen) { + this.defaultPrefixLen = defaultPrefixLen; + return this; + } + + /** + * The default prefix length for networks in the network area. minimum: 24 maximum: 29 + * + * @return defaultPrefixLen + */ + @javax.annotation.Nullable public Long getDefaultPrefixLen() { + return defaultPrefixLen; + } + + public void setDefaultPrefixLen(@javax.annotation.Nullable Long defaultPrefixLen) { + this.defaultPrefixLen = defaultPrefixLen; + } + + public UpdateRegionalAreaIPv4 maxPrefixLen(@javax.annotation.Nullable Long maxPrefixLen) { + this.maxPrefixLen = maxPrefixLen; + return this; + } + + /** + * The maximal prefix length for networks in the network area. minimum: 24 maximum: 29 + * + * @return maxPrefixLen + */ + @javax.annotation.Nullable public Long getMaxPrefixLen() { + return maxPrefixLen; + } + + public void setMaxPrefixLen(@javax.annotation.Nullable Long maxPrefixLen) { + this.maxPrefixLen = maxPrefixLen; + } + + public UpdateRegionalAreaIPv4 minPrefixLen(@javax.annotation.Nullable Long minPrefixLen) { + this.minPrefixLen = minPrefixLen; + return this; + } + + /** + * The minimal prefix length for networks in the network area. minimum: 8 maximum: 29 + * + * @return minPrefixLen + */ + @javax.annotation.Nullable public Long getMinPrefixLen() { + return minPrefixLen; + } + + public void setMinPrefixLen(@javax.annotation.Nullable Long minPrefixLen) { + this.minPrefixLen = minPrefixLen; + } + + /** + * 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 UpdateRegionalAreaIPv4 instance itself + */ + public UpdateRegionalAreaIPv4 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; + } + UpdateRegionalAreaIPv4 updateRegionalAreaIPv4 = (UpdateRegionalAreaIPv4) o; + return Objects.equals(this.defaultNameservers, updateRegionalAreaIPv4.defaultNameservers) + && Objects.equals(this.defaultPrefixLen, updateRegionalAreaIPv4.defaultPrefixLen) + && Objects.equals(this.maxPrefixLen, updateRegionalAreaIPv4.maxPrefixLen) + && Objects.equals(this.minPrefixLen, updateRegionalAreaIPv4.minPrefixLen) + && Objects.equals( + this.additionalProperties, updateRegionalAreaIPv4.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + defaultNameservers, + defaultPrefixLen, + maxPrefixLen, + minPrefixLen, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateRegionalAreaIPv4 {\n"); + sb.append(" defaultNameservers: ") + .append(toIndentedString(defaultNameservers)) + .append("\n"); + sb.append(" defaultPrefixLen: ").append(toIndentedString(defaultPrefixLen)).append("\n"); + sb.append(" maxPrefixLen: ").append(toIndentedString(maxPrefixLen)).append("\n"); + sb.append(" minPrefixLen: ").append(toIndentedString(minPrefixLen)).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( + "defaultNameservers", + "defaultPrefixLen", + "maxPrefixLen", + "minPrefixLen")); + + // 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 UpdateRegionalAreaIPv4 + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateRegionalAreaIPv4.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 UpdateRegionalAreaIPv4 is not found in the empty JSON string", + UpdateRegionalAreaIPv4.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("defaultNameservers") != null + && !jsonObj.get("defaultNameservers").isJsonNull() + && !jsonObj.get("defaultNameservers").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `defaultNameservers` to be an array in the JSON string but got `%s`", + jsonObj.get("defaultNameservers").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateRegionalAreaIPv4.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateRegionalAreaIPv4' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateRegionalAreaIPv4.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateRegionalAreaIPv4 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 UpdateRegionalAreaIPv4 read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateRegionalAreaIPv4 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 UpdateRegionalAreaIPv4 given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateRegionalAreaIPv4 + * @throws IOException if the JSON string is invalid with respect to UpdateRegionalAreaIPv4 + */ + public static UpdateRegionalAreaIPv4 fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateRegionalAreaIPv4.class); + } + + /** + * Convert an instance of UpdateRegionalAreaIPv4 to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/UpdateRouteOfRoutingTablePayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/UpdateRouteOfRoutingTablePayload.java new file mode 100644 index 00000000..6bc4c98f --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/UpdateRouteOfRoutingTablePayload.java @@ -0,0 +1,299 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** Object that represents the request body for a route update. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class UpdateRouteOfRoutingTablePayload { + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public UpdateRouteOfRoutingTablePayload() {} + + public UpdateRouteOfRoutingTablePayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UpdateRouteOfRoutingTablePayload instance itself + */ + public UpdateRouteOfRoutingTablePayload 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; + } + UpdateRouteOfRoutingTablePayload updateRouteOfRoutingTablePayload = + (UpdateRouteOfRoutingTablePayload) o; + return Objects.equals(this.labels, updateRouteOfRoutingTablePayload.labels) + && Objects.equals( + this.additionalProperties, + updateRouteOfRoutingTablePayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(labels, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateRouteOfRoutingTablePayload {\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("labels")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(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 + * UpdateRouteOfRoutingTablePayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateRouteOfRoutingTablePayload.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 UpdateRouteOfRoutingTablePayload is not found in the empty JSON string", + UpdateRouteOfRoutingTablePayload.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateRouteOfRoutingTablePayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateRouteOfRoutingTablePayload' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(UpdateRouteOfRoutingTablePayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateRouteOfRoutingTablePayload 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 UpdateRouteOfRoutingTablePayload read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateRouteOfRoutingTablePayload 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 UpdateRouteOfRoutingTablePayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateRouteOfRoutingTablePayload + * @throws IOException if the JSON string is invalid with respect to + * UpdateRouteOfRoutingTablePayload + */ + public static UpdateRouteOfRoutingTablePayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateRouteOfRoutingTablePayload.class); + } + + /** + * Convert an instance of UpdateRouteOfRoutingTablePayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/UpdateRoutingTableOfAreaPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/UpdateRoutingTableOfAreaPayload.java new file mode 100644 index 00000000..216aaaca --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/UpdateRoutingTableOfAreaPayload.java @@ -0,0 +1,424 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** Object that represents the request body for a routing table update. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class UpdateRoutingTableOfAreaPayload { + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable private String description; + + public static final String SERIALIZED_NAME_DYNAMIC_ROUTES = "dynamicRoutes"; + + @SerializedName(SERIALIZED_NAME_DYNAMIC_ROUTES) + @javax.annotation.Nullable private Boolean dynamicRoutes; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; + + public static final String SERIALIZED_NAME_SYSTEM_ROUTES = "systemRoutes"; + + @SerializedName(SERIALIZED_NAME_SYSTEM_ROUTES) + @javax.annotation.Nullable private Boolean systemRoutes; + + public UpdateRoutingTableOfAreaPayload() {} + + public UpdateRoutingTableOfAreaPayload description( + @javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Description Object. Allows string up to 255 Characters. + * + * @return description + */ + @javax.annotation.Nullable public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + public UpdateRoutingTableOfAreaPayload dynamicRoutes( + @javax.annotation.Nullable Boolean dynamicRoutes) { + this.dynamicRoutes = dynamicRoutes; + return this; + } + + /** + * The update config setting for a routing table which allows propagation of dynamic routes to + * this routing table. + * + * @return dynamicRoutes + */ + @javax.annotation.Nullable public Boolean getDynamicRoutes() { + return dynamicRoutes; + } + + public void setDynamicRoutes(@javax.annotation.Nullable Boolean dynamicRoutes) { + this.dynamicRoutes = dynamicRoutes; + } + + public UpdateRoutingTableOfAreaPayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public UpdateRoutingTableOfAreaPayload name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nullable public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + public UpdateRoutingTableOfAreaPayload systemRoutes( + @javax.annotation.Nullable Boolean systemRoutes) { + this.systemRoutes = systemRoutes; + return this; + } + + /** + * The update config setting for a routing table which allows installation of automatic system + * routes for connectivity between projects in the same SNA. + * + * @return systemRoutes + */ + @javax.annotation.Nullable public Boolean getSystemRoutes() { + return systemRoutes; + } + + public void setSystemRoutes(@javax.annotation.Nullable Boolean systemRoutes) { + this.systemRoutes = systemRoutes; + } + + /** + * 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 UpdateRoutingTableOfAreaPayload instance itself + */ + public UpdateRoutingTableOfAreaPayload 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; + } + UpdateRoutingTableOfAreaPayload updateRoutingTableOfAreaPayload = + (UpdateRoutingTableOfAreaPayload) o; + return Objects.equals(this.description, updateRoutingTableOfAreaPayload.description) + && Objects.equals(this.dynamicRoutes, updateRoutingTableOfAreaPayload.dynamicRoutes) + && Objects.equals(this.labels, updateRoutingTableOfAreaPayload.labels) + && Objects.equals(this.name, updateRoutingTableOfAreaPayload.name) + && Objects.equals(this.systemRoutes, updateRoutingTableOfAreaPayload.systemRoutes) + && Objects.equals( + this.additionalProperties, + updateRoutingTableOfAreaPayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + description, dynamicRoutes, labels, name, systemRoutes, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateRoutingTableOfAreaPayload {\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" dynamicRoutes: ").append(toIndentedString(dynamicRoutes)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" systemRoutes: ").append(toIndentedString(systemRoutes)).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( + "description", "dynamicRoutes", "labels", "name", "systemRoutes")); + + // 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 + * UpdateRoutingTableOfAreaPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateRoutingTableOfAreaPayload.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 UpdateRoutingTableOfAreaPayload is not found in the empty JSON string", + UpdateRoutingTableOfAreaPayload.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `description` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("description").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `name` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateRoutingTableOfAreaPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateRoutingTableOfAreaPayload' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(UpdateRoutingTableOfAreaPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateRoutingTableOfAreaPayload 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 UpdateRoutingTableOfAreaPayload read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateRoutingTableOfAreaPayload 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 UpdateRoutingTableOfAreaPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateRoutingTableOfAreaPayload + * @throws IOException if the JSON string is invalid with respect to + * UpdateRoutingTableOfAreaPayload + */ + public static UpdateRoutingTableOfAreaPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateRoutingTableOfAreaPayload.class); + } + + /** + * Convert an instance of UpdateRoutingTableOfAreaPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/UpdateServerPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/UpdateServerPayload.java new file mode 100644 index 00000000..dc9d0025 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/UpdateServerPayload.java @@ -0,0 +1,351 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** Object that represents an update request body of a server. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class UpdateServerPayload { + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_METADATA = "metadata"; + + @SerializedName(SERIALIZED_NAME_METADATA) + @javax.annotation.Nullable private Object metadata; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; + + public UpdateServerPayload() {} + + public UpdateServerPayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public UpdateServerPayload metadata(@javax.annotation.Nullable Object metadata) { + this.metadata = metadata; + return this; + } + + /** + * Object that represents the metadata of an object. Regex for keys: `^[a-zA-Z0-9-_:. + * ]{1,255}$`. Regex for values: `^.{0,255}$`. Providing a `null` value + * for a key will remove that key. + * + * @return metadata + */ + @javax.annotation.Nullable public Object getMetadata() { + return metadata; + } + + public void setMetadata(@javax.annotation.Nullable Object metadata) { + this.metadata = metadata; + } + + public UpdateServerPayload name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The name for a Server. + * + * @return name + */ + @javax.annotation.Nullable public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * 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 UpdateServerPayload instance itself + */ + public UpdateServerPayload 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; + } + UpdateServerPayload updateServerPayload = (UpdateServerPayload) o; + return Objects.equals(this.labels, updateServerPayload.labels) + && Objects.equals(this.metadata, updateServerPayload.metadata) + && Objects.equals(this.name, updateServerPayload.name) + && Objects.equals( + this.additionalProperties, updateServerPayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(labels, metadata, name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateServerPayload {\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("labels", "metadata", "name")); + + // 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 UpdateServerPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateServerPayload.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 UpdateServerPayload is not found in the empty JSON string", + UpdateServerPayload.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `name` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateServerPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateServerPayload' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateServerPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateServerPayload 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 UpdateServerPayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateServerPayload 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 UpdateServerPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateServerPayload + * @throws IOException if the JSON string is invalid with respect to UpdateServerPayload + */ + public static UpdateServerPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateServerPayload.class); + } + + /** + * Convert an instance of UpdateServerPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/UpdateVolumePayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/UpdateVolumePayload.java new file mode 100644 index 00000000..9d199e4f --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/UpdateVolumePayload.java @@ -0,0 +1,413 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** Object that represents an update request body of a volume. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class UpdateVolumePayload { + public static final String SERIALIZED_NAME_BOOTABLE = "bootable"; + + @SerializedName(SERIALIZED_NAME_BOOTABLE) + @javax.annotation.Nullable private Boolean bootable; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable private String description; + + public static final String SERIALIZED_NAME_IMAGE_CONFIG = "imageConfig"; + + @SerializedName(SERIALIZED_NAME_IMAGE_CONFIG) + @javax.annotation.Nullable private ImageConfig imageConfig; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; + + public UpdateVolumePayload() {} + + public UpdateVolumePayload bootable(@javax.annotation.Nullable Boolean bootable) { + this.bootable = bootable; + return this; + } + + /** + * Indicates if a volume is bootable. + * + * @return bootable + */ + @javax.annotation.Nullable public Boolean getBootable() { + return bootable; + } + + public void setBootable(@javax.annotation.Nullable Boolean bootable) { + this.bootable = bootable; + } + + public UpdateVolumePayload description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Description Object. Allows string up to 255 Characters. + * + * @return description + */ + @javax.annotation.Nullable public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + public UpdateVolumePayload imageConfig(@javax.annotation.Nullable ImageConfig imageConfig) { + this.imageConfig = imageConfig; + return this; + } + + /** + * Get imageConfig + * + * @return imageConfig + */ + @javax.annotation.Nullable public ImageConfig getImageConfig() { + return imageConfig; + } + + public void setImageConfig(@javax.annotation.Nullable ImageConfig imageConfig) { + this.imageConfig = imageConfig; + } + + public UpdateVolumePayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public UpdateVolumePayload name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nullable public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * 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 UpdateVolumePayload instance itself + */ + public UpdateVolumePayload 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; + } + UpdateVolumePayload updateVolumePayload = (UpdateVolumePayload) o; + return Objects.equals(this.bootable, updateVolumePayload.bootable) + && Objects.equals(this.description, updateVolumePayload.description) + && Objects.equals(this.imageConfig, updateVolumePayload.imageConfig) + && Objects.equals(this.labels, updateVolumePayload.labels) + && Objects.equals(this.name, updateVolumePayload.name) + && Objects.equals( + this.additionalProperties, updateVolumePayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(bootable, description, imageConfig, labels, name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateVolumePayload {\n"); + sb.append(" bootable: ").append(toIndentedString(bootable)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" imageConfig: ").append(toIndentedString(imageConfig)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).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("bootable", "description", "imageConfig", "labels", "name")); + + // 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 UpdateVolumePayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateVolumePayload.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 UpdateVolumePayload is not found in the empty JSON string", + UpdateVolumePayload.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `description` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("description").toString())); + } + // validate the optional field `imageConfig` + if (jsonObj.get("imageConfig") != null && !jsonObj.get("imageConfig").isJsonNull()) { + ImageConfig.validateJsonElement(jsonObj.get("imageConfig")); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `name` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateVolumePayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateVolumePayload' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(UpdateVolumePayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateVolumePayload 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 UpdateVolumePayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateVolumePayload 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 UpdateVolumePayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateVolumePayload + * @throws IOException if the JSON string is invalid with respect to UpdateVolumePayload + */ + public static UpdateVolumePayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateVolumePayload.class); + } + + /** + * Convert an instance of UpdateVolumePayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/V2beta1ConfigureNetworkAreaRegionPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/V2beta1ConfigureNetworkAreaRegionPayload.java new file mode 100644 index 00000000..e460f167 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/V2beta1ConfigureNetworkAreaRegionPayload.java @@ -0,0 +1,336 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** The basic properties of a regional network area. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class V2beta1ConfigureNetworkAreaRegionPayload { + public static final String SERIALIZED_NAME_IPV4 = "ipv4"; + + @SerializedName(SERIALIZED_NAME_IPV4) + @javax.annotation.Nullable private RegionalAreaIPv4 ipv4; + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable private String status; + + public V2beta1ConfigureNetworkAreaRegionPayload() {} + + public V2beta1ConfigureNetworkAreaRegionPayload(String status) { + this(); + this.status = status; + } + + public V2beta1ConfigureNetworkAreaRegionPayload ipv4( + @javax.annotation.Nullable RegionalAreaIPv4 ipv4) { + this.ipv4 = ipv4; + return this; + } + + /** + * Get ipv4 + * + * @return ipv4 + */ + @javax.annotation.Nullable public RegionalAreaIPv4 getIpv4() { + return ipv4; + } + + public void setIpv4(@javax.annotation.Nullable RegionalAreaIPv4 ipv4) { + this.ipv4 = ipv4; + } + + /** + * The state of a resource object. Possible values: `CREATING`, `CREATED`, + * `DELETING`, `DELETED`, `FAILED`, `UPDATED`, + * `UPDATING`. + * + * @return status + */ + @javax.annotation.Nullable public String getStatus() { + return status; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the V2beta1ConfigureNetworkAreaRegionPayload instance itself + */ + public V2beta1ConfigureNetworkAreaRegionPayload 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; + } + V2beta1ConfigureNetworkAreaRegionPayload v2beta1ConfigureNetworkAreaRegionPayload = + (V2beta1ConfigureNetworkAreaRegionPayload) o; + return Objects.equals(this.ipv4, v2beta1ConfigureNetworkAreaRegionPayload.ipv4) + && Objects.equals(this.status, v2beta1ConfigureNetworkAreaRegionPayload.status) + && Objects.equals( + this.additionalProperties, + v2beta1ConfigureNetworkAreaRegionPayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(ipv4, status, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class V2beta1ConfigureNetworkAreaRegionPayload {\n"); + sb.append(" ipv4: ").append(toIndentedString(ipv4)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("ipv4", "status")); + + // 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 + * V2beta1ConfigureNetworkAreaRegionPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!V2beta1ConfigureNetworkAreaRegionPayload.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 V2beta1ConfigureNetworkAreaRegionPayload is not found in the empty JSON string", + V2beta1ConfigureNetworkAreaRegionPayload.openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `ipv4` + if (jsonObj.get("ipv4") != null && !jsonObj.get("ipv4").isJsonNull()) { + RegionalAreaIPv4.validateJsonElement(jsonObj.get("ipv4")); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) + && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `status` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("status").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!V2beta1ConfigureNetworkAreaRegionPayload.class.isAssignableFrom( + type.getRawType())) { + return null; // this class only serializes + // 'V2beta1ConfigureNetworkAreaRegionPayload' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(V2beta1ConfigureNetworkAreaRegionPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, V2beta1ConfigureNetworkAreaRegionPayload 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 V2beta1ConfigureNetworkAreaRegionPayload read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + V2beta1ConfigureNetworkAreaRegionPayload 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 V2beta1ConfigureNetworkAreaRegionPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of V2beta1ConfigureNetworkAreaRegionPayload + * @throws IOException if the JSON string is invalid with respect to + * V2beta1ConfigureNetworkAreaRegionPayload + */ + public static V2beta1ConfigureNetworkAreaRegionPayload fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, V2beta1ConfigureNetworkAreaRegionPayload.class); + } + + /** + * Convert an instance of V2beta1ConfigureNetworkAreaRegionPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/V2beta1CreateSnapshotPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/V2beta1CreateSnapshotPayload.java new file mode 100644 index 00000000..0ba32807 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/V2beta1CreateSnapshotPayload.java @@ -0,0 +1,541 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; +import java.util.UUID; + +/** Object that represents a snapshot. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class V2beta1CreateSnapshotPayload { + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable private String description; + + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; + + public static final String SERIALIZED_NAME_SIZE = "size"; + + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nullable private Long size; + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable private String status; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable private OffsetDateTime updatedAt; + + public static final String SERIALIZED_NAME_VOLUME_ID = "volumeId"; + + @SerializedName(SERIALIZED_NAME_VOLUME_ID) + @javax.annotation.Nonnull + private UUID volumeId; + + public V2beta1CreateSnapshotPayload() {} + + public V2beta1CreateSnapshotPayload( + OffsetDateTime createdAt, UUID id, Long size, String status, OffsetDateTime updatedAt) { + this(); + this.createdAt = createdAt; + this.id = id; + this.size = size; + this.status = status; + this.updatedAt = updatedAt; + } + + /** + * Date-time when resource was created. + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public V2beta1CreateSnapshotPayload description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Description Object. Allows string up to 255 Characters. + * + * @return description + */ + @javax.annotation.Nullable public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + public V2beta1CreateSnapshotPayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public V2beta1CreateSnapshotPayload name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nullable public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * Size in Gigabyte. + * + * @return size + */ + @javax.annotation.Nullable public Long getSize() { + return size; + } + + /** + * The status of a snapshot object. Possible values: `AVAILABLE`, + * `BACKING-UP`, `CREATING`, `DELETED`, `DELETING`, + * `ERROR`, `RESTORING`, `UNMANAGING`, `UPDATING`. + * + * @return status + */ + @javax.annotation.Nullable public String getStatus() { + return status; + } + + /** + * Date-time when resource was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nullable public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public V2beta1CreateSnapshotPayload volumeId(@javax.annotation.Nonnull UUID volumeId) { + this.volumeId = volumeId; + return this; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return volumeId + */ + @javax.annotation.Nonnull + public UUID getVolumeId() { + return volumeId; + } + + public void setVolumeId(@javax.annotation.Nonnull UUID volumeId) { + this.volumeId = volumeId; + } + + /** + * 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 V2beta1CreateSnapshotPayload instance itself + */ + public V2beta1CreateSnapshotPayload 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; + } + V2beta1CreateSnapshotPayload v2beta1CreateSnapshotPayload = + (V2beta1CreateSnapshotPayload) o; + return Objects.equals(this.createdAt, v2beta1CreateSnapshotPayload.createdAt) + && Objects.equals(this.description, v2beta1CreateSnapshotPayload.description) + && Objects.equals(this.id, v2beta1CreateSnapshotPayload.id) + && Objects.equals(this.labels, v2beta1CreateSnapshotPayload.labels) + && Objects.equals(this.name, v2beta1CreateSnapshotPayload.name) + && Objects.equals(this.size, v2beta1CreateSnapshotPayload.size) + && Objects.equals(this.status, v2beta1CreateSnapshotPayload.status) + && Objects.equals(this.updatedAt, v2beta1CreateSnapshotPayload.updatedAt) + && Objects.equals(this.volumeId, v2beta1CreateSnapshotPayload.volumeId) + && Objects.equals( + this.additionalProperties, + v2beta1CreateSnapshotPayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + createdAt, + description, + id, + labels, + name, + size, + status, + updatedAt, + volumeId, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class V2beta1CreateSnapshotPayload {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" volumeId: ").append(toIndentedString(volumeId)).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( + "createdAt", + "description", + "id", + "labels", + "name", + "size", + "status", + "updatedAt", + "volumeId")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("volumeId")); + } + + /** + * 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 + * V2beta1CreateSnapshotPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!V2beta1CreateSnapshotPayload.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 V2beta1CreateSnapshotPayload is not found in the empty JSON string", + V2beta1CreateSnapshotPayload.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : V2beta1CreateSnapshotPayload.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("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `description` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("description").toString())); + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `name` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("name").toString())); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) + && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `status` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("status").toString())); + } + if (!jsonObj.get("volumeId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `volumeId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("volumeId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!V2beta1CreateSnapshotPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'V2beta1CreateSnapshotPayload' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(V2beta1CreateSnapshotPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, V2beta1CreateSnapshotPayload 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 V2beta1CreateSnapshotPayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + V2beta1CreateSnapshotPayload 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 V2beta1CreateSnapshotPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of V2beta1CreateSnapshotPayload + * @throws IOException if the JSON string is invalid with respect to + * V2beta1CreateSnapshotPayload + */ + public static V2beta1CreateSnapshotPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, V2beta1CreateSnapshotPayload.class); + } + + /** + * Convert an instance of V2beta1CreateSnapshotPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/V2beta1UpdateBackupPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/V2beta1UpdateBackupPayload.java new file mode 100644 index 00000000..d9908b3a --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/V2beta1UpdateBackupPayload.java @@ -0,0 +1,595 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; +import java.util.UUID; + +/** Object that represents a backup. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class V2beta1UpdateBackupPayload { + public static final String SERIALIZED_NAME_AVAILABILITY_ZONE = "availabilityZone"; + + @SerializedName(SERIALIZED_NAME_AVAILABILITY_ZONE) + @javax.annotation.Nullable private String availabilityZone; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable private String description; + + public static final String SERIALIZED_NAME_ENCRYPTED = "encrypted"; + + @SerializedName(SERIALIZED_NAME_ENCRYPTED) + @javax.annotation.Nullable private Boolean encrypted; + + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; + + public static final String SERIALIZED_NAME_SIZE = "size"; + + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nullable private Long size; + + public static final String SERIALIZED_NAME_SNAPSHOT_ID = "snapshotId"; + + @SerializedName(SERIALIZED_NAME_SNAPSHOT_ID) + @javax.annotation.Nullable private UUID snapshotId; + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable private String status; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable private OffsetDateTime updatedAt; + + public static final String SERIALIZED_NAME_VOLUME_ID = "volumeId"; + + @SerializedName(SERIALIZED_NAME_VOLUME_ID) + @javax.annotation.Nullable private UUID volumeId; + + public V2beta1UpdateBackupPayload() {} + + public V2beta1UpdateBackupPayload( + String availabilityZone, + OffsetDateTime createdAt, + Boolean encrypted, + UUID id, + Long size, + UUID snapshotId, + String status, + OffsetDateTime updatedAt, + UUID volumeId) { + this(); + this.availabilityZone = availabilityZone; + this.createdAt = createdAt; + this.encrypted = encrypted; + this.id = id; + this.size = size; + this.snapshotId = snapshotId; + this.status = status; + this.updatedAt = updatedAt; + this.volumeId = volumeId; + } + + /** + * Object that represents an availability zone. + * + * @return availabilityZone + */ + @javax.annotation.Nullable public String getAvailabilityZone() { + return availabilityZone; + } + + /** + * Date-time when resource was created. + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public V2beta1UpdateBackupPayload description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Description Object. Allows string up to 255 Characters. + * + * @return description + */ + @javax.annotation.Nullable public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + /** + * Indicates if a volume is encrypted. + * + * @return encrypted + */ + @javax.annotation.Nullable public Boolean getEncrypted() { + return encrypted; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + public V2beta1UpdateBackupPayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public V2beta1UpdateBackupPayload name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nullable public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * Size in Gigabyte. + * + * @return size + */ + @javax.annotation.Nullable public Long getSize() { + return size; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return snapshotId + */ + @javax.annotation.Nullable public UUID getSnapshotId() { + return snapshotId; + } + + /** + * The status of a backup object. Possible values: `AVAILABLE`, `CREATING`, + * `DELETED`, `DELETING`, `ERROR`, `RESTORING`. + * + * @return status + */ + @javax.annotation.Nullable public String getStatus() { + return status; + } + + /** + * Date-time when resource was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nullable public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return volumeId + */ + @javax.annotation.Nullable public UUID getVolumeId() { + return volumeId; + } + + /** + * 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 V2beta1UpdateBackupPayload instance itself + */ + public V2beta1UpdateBackupPayload 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; + } + V2beta1UpdateBackupPayload v2beta1UpdateBackupPayload = (V2beta1UpdateBackupPayload) o; + return Objects.equals(this.availabilityZone, v2beta1UpdateBackupPayload.availabilityZone) + && Objects.equals(this.createdAt, v2beta1UpdateBackupPayload.createdAt) + && Objects.equals(this.description, v2beta1UpdateBackupPayload.description) + && Objects.equals(this.encrypted, v2beta1UpdateBackupPayload.encrypted) + && Objects.equals(this.id, v2beta1UpdateBackupPayload.id) + && Objects.equals(this.labels, v2beta1UpdateBackupPayload.labels) + && Objects.equals(this.name, v2beta1UpdateBackupPayload.name) + && Objects.equals(this.size, v2beta1UpdateBackupPayload.size) + && Objects.equals(this.snapshotId, v2beta1UpdateBackupPayload.snapshotId) + && Objects.equals(this.status, v2beta1UpdateBackupPayload.status) + && Objects.equals(this.updatedAt, v2beta1UpdateBackupPayload.updatedAt) + && Objects.equals(this.volumeId, v2beta1UpdateBackupPayload.volumeId) + && Objects.equals( + this.additionalProperties, v2beta1UpdateBackupPayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + availabilityZone, + createdAt, + description, + encrypted, + id, + labels, + name, + size, + snapshotId, + status, + updatedAt, + volumeId, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class V2beta1UpdateBackupPayload {\n"); + sb.append(" availabilityZone: ").append(toIndentedString(availabilityZone)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" encrypted: ").append(toIndentedString(encrypted)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" snapshotId: ").append(toIndentedString(snapshotId)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" volumeId: ").append(toIndentedString(volumeId)).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( + "availabilityZone", + "createdAt", + "description", + "encrypted", + "id", + "labels", + "name", + "size", + "snapshotId", + "status", + "updatedAt", + "volumeId")); + + // 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 V2beta1UpdateBackupPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!V2beta1UpdateBackupPayload.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 V2beta1UpdateBackupPayload is not found in the empty JSON string", + V2beta1UpdateBackupPayload.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("availabilityZone") != null + && !jsonObj.get("availabilityZone").isJsonNull()) + && !jsonObj.get("availabilityZone").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `availabilityZone` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("availabilityZone").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `description` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("description").toString())); + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `name` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("name").toString())); + } + if ((jsonObj.get("snapshotId") != null && !jsonObj.get("snapshotId").isJsonNull()) + && !jsonObj.get("snapshotId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `snapshotId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("snapshotId").toString())); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) + && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `status` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("status").toString())); + } + if ((jsonObj.get("volumeId") != null && !jsonObj.get("volumeId").isJsonNull()) + && !jsonObj.get("volumeId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `volumeId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("volumeId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!V2beta1UpdateBackupPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'V2beta1UpdateBackupPayload' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(V2beta1UpdateBackupPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, V2beta1UpdateBackupPayload 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 V2beta1UpdateBackupPayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + V2beta1UpdateBackupPayload 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 V2beta1UpdateBackupPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of V2beta1UpdateBackupPayload + * @throws IOException if the JSON string is invalid with respect to V2beta1UpdateBackupPayload + */ + public static V2beta1UpdateBackupPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, V2beta1UpdateBackupPayload.class); + } + + /** + * Convert an instance of V2beta1UpdateBackupPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/V2beta1UpdateNetworkAreaRegionPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/V2beta1UpdateNetworkAreaRegionPayload.java new file mode 100644 index 00000000..385faaa4 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/V2beta1UpdateNetworkAreaRegionPayload.java @@ -0,0 +1,303 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** Object that represents the request body for a regional network area update. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class V2beta1UpdateNetworkAreaRegionPayload { + public static final String SERIALIZED_NAME_IPV4 = "ipv4"; + + @SerializedName(SERIALIZED_NAME_IPV4) + @javax.annotation.Nullable private UpdateRegionalAreaIPv4 ipv4; + + public V2beta1UpdateNetworkAreaRegionPayload() {} + + public V2beta1UpdateNetworkAreaRegionPayload ipv4( + @javax.annotation.Nullable UpdateRegionalAreaIPv4 ipv4) { + this.ipv4 = ipv4; + return this; + } + + /** + * Get ipv4 + * + * @return ipv4 + */ + @javax.annotation.Nullable public UpdateRegionalAreaIPv4 getIpv4() { + return ipv4; + } + + public void setIpv4(@javax.annotation.Nullable UpdateRegionalAreaIPv4 ipv4) { + this.ipv4 = ipv4; + } + + /** + * 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 V2beta1UpdateNetworkAreaRegionPayload instance itself + */ + public V2beta1UpdateNetworkAreaRegionPayload 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; + } + V2beta1UpdateNetworkAreaRegionPayload v2beta1UpdateNetworkAreaRegionPayload = + (V2beta1UpdateNetworkAreaRegionPayload) o; + return Objects.equals(this.ipv4, v2beta1UpdateNetworkAreaRegionPayload.ipv4) + && Objects.equals( + this.additionalProperties, + v2beta1UpdateNetworkAreaRegionPayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(ipv4, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class V2beta1UpdateNetworkAreaRegionPayload {\n"); + sb.append(" ipv4: ").append(toIndentedString(ipv4)).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("ipv4")); + + // 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 + * V2beta1UpdateNetworkAreaRegionPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!V2beta1UpdateNetworkAreaRegionPayload.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 V2beta1UpdateNetworkAreaRegionPayload is not found in the empty JSON string", + V2beta1UpdateNetworkAreaRegionPayload.openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `ipv4` + if (jsonObj.get("ipv4") != null && !jsonObj.get("ipv4").isJsonNull()) { + UpdateRegionalAreaIPv4.validateJsonElement(jsonObj.get("ipv4")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!V2beta1UpdateNetworkAreaRegionPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'V2beta1UpdateNetworkAreaRegionPayload' + // and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(V2beta1UpdateNetworkAreaRegionPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write( + JsonWriter out, V2beta1UpdateNetworkAreaRegionPayload 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 V2beta1UpdateNetworkAreaRegionPayload read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + V2beta1UpdateNetworkAreaRegionPayload 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 V2beta1UpdateNetworkAreaRegionPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of V2beta1UpdateNetworkAreaRegionPayload + * @throws IOException if the JSON string is invalid with respect to + * V2beta1UpdateNetworkAreaRegionPayload + */ + public static V2beta1UpdateNetworkAreaRegionPayload fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, V2beta1UpdateNetworkAreaRegionPayload.class); + } + + /** + * Convert an instance of V2beta1UpdateNetworkAreaRegionPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/V2beta1UpdateRouteOfAreaPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/V2beta1UpdateRouteOfAreaPayload.java new file mode 100644 index 00000000..29932990 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/V2beta1UpdateRouteOfAreaPayload.java @@ -0,0 +1,299 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** Object that represents the request body for a route update. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class V2beta1UpdateRouteOfAreaPayload { + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public V2beta1UpdateRouteOfAreaPayload() {} + + public V2beta1UpdateRouteOfAreaPayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the V2beta1UpdateRouteOfAreaPayload instance itself + */ + public V2beta1UpdateRouteOfAreaPayload 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; + } + V2beta1UpdateRouteOfAreaPayload v2beta1UpdateRouteOfAreaPayload = + (V2beta1UpdateRouteOfAreaPayload) o; + return Objects.equals(this.labels, v2beta1UpdateRouteOfAreaPayload.labels) + && Objects.equals( + this.additionalProperties, + v2beta1UpdateRouteOfAreaPayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(labels, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class V2beta1UpdateRouteOfAreaPayload {\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("labels")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(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 + * V2beta1UpdateRouteOfAreaPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!V2beta1UpdateRouteOfAreaPayload.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 V2beta1UpdateRouteOfAreaPayload is not found in the empty JSON string", + V2beta1UpdateRouteOfAreaPayload.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!V2beta1UpdateRouteOfAreaPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'V2beta1UpdateRouteOfAreaPayload' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(V2beta1UpdateRouteOfAreaPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, V2beta1UpdateRouteOfAreaPayload 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 V2beta1UpdateRouteOfAreaPayload read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + V2beta1UpdateRouteOfAreaPayload 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 V2beta1UpdateRouteOfAreaPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of V2beta1UpdateRouteOfAreaPayload + * @throws IOException if the JSON string is invalid with respect to + * V2beta1UpdateRouteOfAreaPayload + */ + public static V2beta1UpdateRouteOfAreaPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, V2beta1UpdateRouteOfAreaPayload.class); + } + + /** + * Convert an instance of V2beta1UpdateRouteOfAreaPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/V2beta1UpdateSecurityGroupPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/V2beta1UpdateSecurityGroupPayload.java new file mode 100644 index 00000000..3a9192d9 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/V2beta1UpdateSecurityGroupPayload.java @@ -0,0 +1,367 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** Object that represents an update request body of a security group. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class V2beta1UpdateSecurityGroupPayload { + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable private String description; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; + + public V2beta1UpdateSecurityGroupPayload() {} + + public V2beta1UpdateSecurityGroupPayload description( + @javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Description Object. Allows string up to 255 Characters. + * + * @return description + */ + @javax.annotation.Nullable public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + public V2beta1UpdateSecurityGroupPayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public V2beta1UpdateSecurityGroupPayload name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nullable public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * 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 V2beta1UpdateSecurityGroupPayload instance itself + */ + public V2beta1UpdateSecurityGroupPayload 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; + } + V2beta1UpdateSecurityGroupPayload v2beta1UpdateSecurityGroupPayload = + (V2beta1UpdateSecurityGroupPayload) o; + return Objects.equals(this.description, v2beta1UpdateSecurityGroupPayload.description) + && Objects.equals(this.labels, v2beta1UpdateSecurityGroupPayload.labels) + && Objects.equals(this.name, v2beta1UpdateSecurityGroupPayload.name) + && Objects.equals( + this.additionalProperties, + v2beta1UpdateSecurityGroupPayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(description, labels, name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class V2beta1UpdateSecurityGroupPayload {\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).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("description", "labels", "name")); + + // 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 + * V2beta1UpdateSecurityGroupPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!V2beta1UpdateSecurityGroupPayload.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 V2beta1UpdateSecurityGroupPayload is not found in the empty JSON string", + V2beta1UpdateSecurityGroupPayload.openapiRequiredFields + .toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `description` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("description").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `name` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!V2beta1UpdateSecurityGroupPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'V2beta1UpdateSecurityGroupPayload' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(V2beta1UpdateSecurityGroupPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, V2beta1UpdateSecurityGroupPayload 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 V2beta1UpdateSecurityGroupPayload read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + V2beta1UpdateSecurityGroupPayload 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 V2beta1UpdateSecurityGroupPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of V2beta1UpdateSecurityGroupPayload + * @throws IOException if the JSON string is invalid with respect to + * V2beta1UpdateSecurityGroupPayload + */ + public static V2beta1UpdateSecurityGroupPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, V2beta1UpdateSecurityGroupPayload.class); + } + + /** + * Convert an instance of V2beta1UpdateSecurityGroupPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/V2beta1UpdateSnapshotPayload.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/V2beta1UpdateSnapshotPayload.java new file mode 100644 index 00000000..ddabf25d --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/V2beta1UpdateSnapshotPayload.java @@ -0,0 +1,364 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** Object that represents an update request body of a snapshot. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class V2beta1UpdateSnapshotPayload { + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable private String description; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; + + public V2beta1UpdateSnapshotPayload() {} + + public V2beta1UpdateSnapshotPayload description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Description Object. Allows string up to 255 Characters. + * + * @return description + */ + @javax.annotation.Nullable public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + public V2beta1UpdateSnapshotPayload labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public V2beta1UpdateSnapshotPayload name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nullable public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + /** + * 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 V2beta1UpdateSnapshotPayload instance itself + */ + public V2beta1UpdateSnapshotPayload 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; + } + V2beta1UpdateSnapshotPayload v2beta1UpdateSnapshotPayload = + (V2beta1UpdateSnapshotPayload) o; + return Objects.equals(this.description, v2beta1UpdateSnapshotPayload.description) + && Objects.equals(this.labels, v2beta1UpdateSnapshotPayload.labels) + && Objects.equals(this.name, v2beta1UpdateSnapshotPayload.name) + && Objects.equals( + this.additionalProperties, + v2beta1UpdateSnapshotPayload.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(description, labels, name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class V2beta1UpdateSnapshotPayload {\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).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("description", "labels", "name")); + + // 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 + * V2beta1UpdateSnapshotPayload + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!V2beta1UpdateSnapshotPayload.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 V2beta1UpdateSnapshotPayload is not found in the empty JSON string", + V2beta1UpdateSnapshotPayload.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `description` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("description").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `name` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!V2beta1UpdateSnapshotPayload.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'V2beta1UpdateSnapshotPayload' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(V2beta1UpdateSnapshotPayload.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, V2beta1UpdateSnapshotPayload 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 V2beta1UpdateSnapshotPayload read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + V2beta1UpdateSnapshotPayload 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 V2beta1UpdateSnapshotPayload given an JSON string + * + * @param jsonString JSON string + * @return An instance of V2beta1UpdateSnapshotPayload + * @throws IOException if the JSON string is invalid with respect to + * V2beta1UpdateSnapshotPayload + */ + public static V2beta1UpdateSnapshotPayload fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, V2beta1UpdateSnapshotPayload.class); + } + + /** + * Convert an instance of V2beta1UpdateSnapshotPayload to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/Volume.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/Volume.java new file mode 100644 index 00000000..6acc3cd4 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/Volume.java @@ -0,0 +1,751 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; +import java.util.UUID; + +/** + * Object that represents a volume and its parameters. Volumes sized up to 16000GB are supported. + */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class Volume { + public static final String SERIALIZED_NAME_AVAILABILITY_ZONE = "availabilityZone"; + + @SerializedName(SERIALIZED_NAME_AVAILABILITY_ZONE) + @javax.annotation.Nonnull + private String availabilityZone; + + public static final String SERIALIZED_NAME_BOOTABLE = "bootable"; + + @SerializedName(SERIALIZED_NAME_BOOTABLE) + @javax.annotation.Nullable private Boolean bootable; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable private String description; + + public static final String SERIALIZED_NAME_ENCRYPTED = "encrypted"; + + @SerializedName(SERIALIZED_NAME_ENCRYPTED) + @javax.annotation.Nullable private Boolean encrypted; + + public static final String SERIALIZED_NAME_ENCRYPTION_PARAMETERS = "encryptionParameters"; + + @SerializedName(SERIALIZED_NAME_ENCRYPTION_PARAMETERS) + @javax.annotation.Nullable private VolumeEncryptionParameter encryptionParameters; + + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private UUID id; + + public static final String SERIALIZED_NAME_IMAGE_CONFIG = "imageConfig"; + + @SerializedName(SERIALIZED_NAME_IMAGE_CONFIG) + @javax.annotation.Nullable private ImageConfig imageConfig; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable private String name; + + public static final String SERIALIZED_NAME_PERFORMANCE_CLASS = "performanceClass"; + + @SerializedName(SERIALIZED_NAME_PERFORMANCE_CLASS) + @javax.annotation.Nullable private String performanceClass; + + public static final String SERIALIZED_NAME_SERVER_ID = "serverId"; + + @SerializedName(SERIALIZED_NAME_SERVER_ID) + @javax.annotation.Nullable private UUID serverId; + + public static final String SERIALIZED_NAME_SIZE = "size"; + + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nullable private Long size; + + public static final String SERIALIZED_NAME_SOURCE = "source"; + + @SerializedName(SERIALIZED_NAME_SOURCE) + @javax.annotation.Nullable private VolumeSource source; + + public static final String SERIALIZED_NAME_STATUS = "status"; + + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable private String status; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable private OffsetDateTime updatedAt; + + public Volume() {} + + public Volume( + OffsetDateTime createdAt, + Boolean encrypted, + UUID id, + ImageConfig imageConfig, + UUID serverId, + String status, + OffsetDateTime updatedAt) { + this(); + this.createdAt = createdAt; + this.encrypted = encrypted; + this.id = id; + this.imageConfig = imageConfig; + this.serverId = serverId; + this.status = status; + this.updatedAt = updatedAt; + } + + public Volume availabilityZone(@javax.annotation.Nonnull String availabilityZone) { + this.availabilityZone = availabilityZone; + return this; + } + + /** + * Object that represents an availability zone. + * + * @return availabilityZone + */ + @javax.annotation.Nonnull + public String getAvailabilityZone() { + return availabilityZone; + } + + public void setAvailabilityZone(@javax.annotation.Nonnull String availabilityZone) { + this.availabilityZone = availabilityZone; + } + + public Volume bootable(@javax.annotation.Nullable Boolean bootable) { + this.bootable = bootable; + return this; + } + + /** + * Indicates if a volume is bootable. + * + * @return bootable + */ + @javax.annotation.Nullable public Boolean getBootable() { + return bootable; + } + + public void setBootable(@javax.annotation.Nullable Boolean bootable) { + this.bootable = bootable; + } + + /** + * Date-time when resource was created. + * + * @return createdAt + */ + @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public Volume description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Description Object. Allows string up to 255 Characters. + * + * @return description + */ + @javax.annotation.Nullable public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + /** + * Indicates if a volume is encrypted. + * + * @return encrypted + */ + @javax.annotation.Nullable public Boolean getEncrypted() { + return encrypted; + } + + public Volume encryptionParameters( + @javax.annotation.Nullable VolumeEncryptionParameter encryptionParameters) { + this.encryptionParameters = encryptionParameters; + return this; + } + + /** + * Get encryptionParameters + * + * @return encryptionParameters + */ + @javax.annotation.Nullable public VolumeEncryptionParameter getEncryptionParameters() { + return encryptionParameters; + } + + public void setEncryptionParameters( + @javax.annotation.Nullable VolumeEncryptionParameter encryptionParameters) { + this.encryptionParameters = encryptionParameters; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nullable public UUID getId() { + return id; + } + + /** + * Get imageConfig + * + * @return imageConfig + */ + @javax.annotation.Nullable public ImageConfig getImageConfig() { + return imageConfig; + } + + public Volume labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public Volume name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nullable public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + public Volume performanceClass(@javax.annotation.Nullable String performanceClass) { + this.performanceClass = performanceClass; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return performanceClass + */ + @javax.annotation.Nullable public String getPerformanceClass() { + return performanceClass; + } + + public void setPerformanceClass(@javax.annotation.Nullable String performanceClass) { + this.performanceClass = performanceClass; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return serverId + */ + @javax.annotation.Nullable public UUID getServerId() { + return serverId; + } + + public Volume size(@javax.annotation.Nullable Long size) { + this.size = size; + return this; + } + + /** + * Size in Gigabyte. + * + * @return size + */ + @javax.annotation.Nullable public Long getSize() { + return size; + } + + public void setSize(@javax.annotation.Nullable Long size) { + this.size = size; + } + + public Volume source(@javax.annotation.Nullable VolumeSource source) { + this.source = source; + return this; + } + + /** + * Get source + * + * @return source + */ + @javax.annotation.Nullable public VolumeSource getSource() { + return source; + } + + public void setSource(@javax.annotation.Nullable VolumeSource source) { + this.source = source; + } + + /** + * The status of a volume object. Possible values: `ATTACHED`, `ATTACHING`, + * `AVAILABLE`, `AWAITING-TRANSFER`, `BACKING-UP`, + * `CREATING`, `DELETED`, `DELETING`, `DETACHING`, + * `DOWNLOADING`, `ERROR`, `ERROR_BACKING-UP`, + * `ERROR_DELETING`, `ERROR_RESIZING`, `ERROR_RESTORING-BACKUP`, + * `MAINTENANCE`, `RESERVED`, `RESIZING`, + * `RESTORING-BACKUP`, `RETYPING`, `UPLOADING`. + * + * @return status + */ + @javax.annotation.Nullable public String getStatus() { + return status; + } + + /** + * Date-time when resource was last updated. + * + * @return updatedAt + */ + @javax.annotation.Nullable public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * 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 Volume instance itself + */ + public Volume 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; + } + Volume volume = (Volume) o; + return Objects.equals(this.availabilityZone, volume.availabilityZone) + && Objects.equals(this.bootable, volume.bootable) + && Objects.equals(this.createdAt, volume.createdAt) + && Objects.equals(this.description, volume.description) + && Objects.equals(this.encrypted, volume.encrypted) + && Objects.equals(this.encryptionParameters, volume.encryptionParameters) + && Objects.equals(this.id, volume.id) + && Objects.equals(this.imageConfig, volume.imageConfig) + && Objects.equals(this.labels, volume.labels) + && Objects.equals(this.name, volume.name) + && Objects.equals(this.performanceClass, volume.performanceClass) + && Objects.equals(this.serverId, volume.serverId) + && Objects.equals(this.size, volume.size) + && Objects.equals(this.source, volume.source) + && Objects.equals(this.status, volume.status) + && Objects.equals(this.updatedAt, volume.updatedAt) + && Objects.equals(this.additionalProperties, volume.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + availabilityZone, + bootable, + createdAt, + description, + encrypted, + encryptionParameters, + id, + imageConfig, + labels, + name, + performanceClass, + serverId, + size, + source, + status, + updatedAt, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Volume {\n"); + sb.append(" availabilityZone: ").append(toIndentedString(availabilityZone)).append("\n"); + sb.append(" bootable: ").append(toIndentedString(bootable)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" encrypted: ").append(toIndentedString(encrypted)).append("\n"); + sb.append(" encryptionParameters: ") + .append(toIndentedString(encryptionParameters)) + .append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" imageConfig: ").append(toIndentedString(imageConfig)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" performanceClass: ").append(toIndentedString(performanceClass)).append("\n"); + sb.append(" serverId: ").append(toIndentedString(serverId)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" source: ").append(toIndentedString(source)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).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( + "availabilityZone", + "bootable", + "createdAt", + "description", + "encrypted", + "encryptionParameters", + "id", + "imageConfig", + "labels", + "name", + "performanceClass", + "serverId", + "size", + "source", + "status", + "updatedAt")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("availabilityZone")); + } + + /** + * 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 Volume + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Volume.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 Volume is not found in the empty JSON string", + Volume.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Volume.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("availabilityZone").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `availabilityZone` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("availabilityZone").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `description` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("description").toString())); + } + // validate the optional field `encryptionParameters` + if (jsonObj.get("encryptionParameters") != null + && !jsonObj.get("encryptionParameters").isJsonNull()) { + VolumeEncryptionParameter.validateJsonElement(jsonObj.get("encryptionParameters")); + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) + && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + // validate the optional field `imageConfig` + if (jsonObj.get("imageConfig") != null && !jsonObj.get("imageConfig").isJsonNull()) { + ImageConfig.validateJsonElement(jsonObj.get("imageConfig")); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) + && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `name` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("name").toString())); + } + if ((jsonObj.get("performanceClass") != null + && !jsonObj.get("performanceClass").isJsonNull()) + && !jsonObj.get("performanceClass").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `performanceClass` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("performanceClass").toString())); + } + if ((jsonObj.get("serverId") != null && !jsonObj.get("serverId").isJsonNull()) + && !jsonObj.get("serverId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `serverId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("serverId").toString())); + } + // validate the optional field `source` + if (jsonObj.get("source") != null && !jsonObj.get("source").isJsonNull()) { + VolumeSource.validateJsonElement(jsonObj.get("source")); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) + && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `status` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("status").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Volume.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Volume' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(Volume.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, Volume 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 Volume read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Volume 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 Volume given an JSON string + * + * @param jsonString JSON string + * @return An instance of Volume + * @throws IOException if the JSON string is invalid with respect to Volume + */ + public static Volume fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Volume.class); + } + + /** + * Convert an instance of Volume to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/VolumeAttachment.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/VolumeAttachment.java new file mode 100644 index 00000000..c50566b1 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/VolumeAttachment.java @@ -0,0 +1,345 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +/** Object that represents a Volume attachment to a server. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class VolumeAttachment { + public static final String SERIALIZED_NAME_DELETE_ON_TERMINATION = "deleteOnTermination"; + + @SerializedName(SERIALIZED_NAME_DELETE_ON_TERMINATION) + @javax.annotation.Nullable private Boolean deleteOnTermination; + + public static final String SERIALIZED_NAME_SERVER_ID = "serverId"; + + @SerializedName(SERIALIZED_NAME_SERVER_ID) + @javax.annotation.Nullable private UUID serverId; + + public static final String SERIALIZED_NAME_VOLUME_ID = "volumeId"; + + @SerializedName(SERIALIZED_NAME_VOLUME_ID) + @javax.annotation.Nullable private UUID volumeId; + + public VolumeAttachment() {} + + public VolumeAttachment(UUID serverId, UUID volumeId) { + this(); + this.serverId = serverId; + this.volumeId = volumeId; + } + + public VolumeAttachment deleteOnTermination( + @javax.annotation.Nullable Boolean deleteOnTermination) { + this.deleteOnTermination = deleteOnTermination; + return this; + } + + /** + * Delete the volume during the termination of the server. Defaults to false. + * + * @return deleteOnTermination + */ + @javax.annotation.Nullable public Boolean getDeleteOnTermination() { + return deleteOnTermination; + } + + public void setDeleteOnTermination(@javax.annotation.Nullable Boolean deleteOnTermination) { + this.deleteOnTermination = deleteOnTermination; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return serverId + */ + @javax.annotation.Nullable public UUID getServerId() { + return serverId; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return volumeId + */ + @javax.annotation.Nullable public UUID getVolumeId() { + return volumeId; + } + + /** + * 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 VolumeAttachment instance itself + */ + public VolumeAttachment 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; + } + VolumeAttachment volumeAttachment = (VolumeAttachment) o; + return Objects.equals(this.deleteOnTermination, volumeAttachment.deleteOnTermination) + && Objects.equals(this.serverId, volumeAttachment.serverId) + && Objects.equals(this.volumeId, volumeAttachment.volumeId) + && Objects.equals(this.additionalProperties, volumeAttachment.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(deleteOnTermination, serverId, volumeId, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VolumeAttachment {\n"); + sb.append(" deleteOnTermination: ") + .append(toIndentedString(deleteOnTermination)) + .append("\n"); + sb.append(" serverId: ").append(toIndentedString(serverId)).append("\n"); + sb.append(" volumeId: ").append(toIndentedString(volumeId)).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("deleteOnTermination", "serverId", "volumeId")); + + // 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 VolumeAttachment + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VolumeAttachment.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 VolumeAttachment is not found in the empty JSON string", + VolumeAttachment.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("serverId") != null && !jsonObj.get("serverId").isJsonNull()) + && !jsonObj.get("serverId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `serverId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("serverId").toString())); + } + if ((jsonObj.get("volumeId") != null && !jsonObj.get("volumeId").isJsonNull()) + && !jsonObj.get("volumeId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `volumeId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("volumeId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VolumeAttachment.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'VolumeAttachment' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(VolumeAttachment.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, VolumeAttachment 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 VolumeAttachment read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + VolumeAttachment 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 VolumeAttachment given an JSON string + * + * @param jsonString JSON string + * @return An instance of VolumeAttachment + * @throws IOException if the JSON string is invalid with respect to VolumeAttachment + */ + public static VolumeAttachment fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, VolumeAttachment.class); + } + + /** + * Convert an instance of VolumeAttachment to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/VolumeAttachmentListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/VolumeAttachmentListResponse.java new file mode 100644 index 00000000..fc9b419c --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/VolumeAttachmentListResponse.java @@ -0,0 +1,334 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** Volume attachment list response. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class VolumeAttachmentListResponse { + public static final String SERIALIZED_NAME_ITEMS = "items"; + + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public VolumeAttachmentListResponse() {} + + public VolumeAttachmentListResponse items( + @javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public VolumeAttachmentListResponse addItemsItem(VolumeAttachment itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list containing Volume attachments of a server. + * + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the VolumeAttachmentListResponse instance itself + */ + public VolumeAttachmentListResponse 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; + } + VolumeAttachmentListResponse volumeAttachmentListResponse = + (VolumeAttachmentListResponse) o; + return Objects.equals(this.items, volumeAttachmentListResponse.items) + && Objects.equals( + this.additionalProperties, + volumeAttachmentListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VolumeAttachmentListResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("items")); + } + + /** + * 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 + * VolumeAttachmentListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VolumeAttachmentListResponse.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 VolumeAttachmentListResponse is not found in the empty JSON string", + VolumeAttachmentListResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : VolumeAttachmentListResponse.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("items").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `items` to be an array in the JSON string but got `%s`", + jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + VolumeAttachment.validateJsonElement(jsonArrayitems.get(i)); + } + ; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VolumeAttachmentListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'VolumeAttachmentListResponse' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(VolumeAttachmentListResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, VolumeAttachmentListResponse 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 VolumeAttachmentListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + VolumeAttachmentListResponse 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 VolumeAttachmentListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of VolumeAttachmentListResponse + * @throws IOException if the JSON string is invalid with respect to + * VolumeAttachmentListResponse + */ + public static VolumeAttachmentListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, VolumeAttachmentListResponse.class); + } + + /** + * Convert an instance of VolumeAttachmentListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/VolumeEncryptionParameter.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/VolumeEncryptionParameter.java new file mode 100644 index 00000000..8061f901 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/VolumeEncryptionParameter.java @@ -0,0 +1,491 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +/** + * Parameter to connect to a key-encryption-key within the STACKIT-KMS to create encrypted volumes. + * If no key_payload is set, a random passphrase is generated, which will be encrypted against the + * STACKIT-KMS. These parameter never leave the backend again. So these parameters are not in the + * responses. + */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class VolumeEncryptionParameter { + public static final String SERIALIZED_NAME_KEK_KEY_ID = "kekKeyId"; + + @SerializedName(SERIALIZED_NAME_KEK_KEY_ID) + @javax.annotation.Nonnull + private UUID kekKeyId; + + public static final String SERIALIZED_NAME_KEK_KEY_VERSION = "kekKeyVersion"; + + @SerializedName(SERIALIZED_NAME_KEK_KEY_VERSION) + @javax.annotation.Nonnull + private Long kekKeyVersion; + + public static final String SERIALIZED_NAME_KEK_KEYRING_ID = "kekKeyringId"; + + @SerializedName(SERIALIZED_NAME_KEK_KEYRING_ID) + @javax.annotation.Nonnull + private UUID kekKeyringId; + + public static final String SERIALIZED_NAME_KEK_PROJECT_ID = "kekProjectId"; + + @SerializedName(SERIALIZED_NAME_KEK_PROJECT_ID) + @javax.annotation.Nullable private UUID kekProjectId; + + public static final String SERIALIZED_NAME_KEY_PAYLOAD = "keyPayload"; + + @SerializedName(SERIALIZED_NAME_KEY_PAYLOAD) + @javax.annotation.Nullable private byte[] keyPayload; + + public static final String SERIALIZED_NAME_SERVICE_ACCOUNT = "serviceAccount"; + + @SerializedName(SERIALIZED_NAME_SERVICE_ACCOUNT) + @javax.annotation.Nonnull + private String serviceAccount; + + public VolumeEncryptionParameter() {} + + public VolumeEncryptionParameter kekKeyId(@javax.annotation.Nonnull UUID kekKeyId) { + this.kekKeyId = kekKeyId; + return this; + } + + /** + * UUID of the Key within the STACKIT-KMS to use for the encryption. + * + * @return kekKeyId + */ + @javax.annotation.Nonnull + public UUID getKekKeyId() { + return kekKeyId; + } + + public void setKekKeyId(@javax.annotation.Nonnull UUID kekKeyId) { + this.kekKeyId = kekKeyId; + } + + public VolumeEncryptionParameter kekKeyVersion(@javax.annotation.Nonnull Long kekKeyVersion) { + this.kekKeyVersion = kekKeyVersion; + return this; + } + + /** + * Version of the key within the STACKIT-KMS to use for the encryption. + * + * @return kekKeyVersion + */ + @javax.annotation.Nonnull + public Long getKekKeyVersion() { + return kekKeyVersion; + } + + public void setKekKeyVersion(@javax.annotation.Nonnull Long kekKeyVersion) { + this.kekKeyVersion = kekKeyVersion; + } + + public VolumeEncryptionParameter kekKeyringId(@javax.annotation.Nonnull UUID kekKeyringId) { + this.kekKeyringId = kekKeyringId; + return this; + } + + /** + * UUID of the keyring where the key is located within the STACKTI-KMS. + * + * @return kekKeyringId + */ + @javax.annotation.Nonnull + public UUID getKekKeyringId() { + return kekKeyringId; + } + + public void setKekKeyringId(@javax.annotation.Nonnull UUID kekKeyringId) { + this.kekKeyringId = kekKeyringId; + } + + public VolumeEncryptionParameter kekProjectId(@javax.annotation.Nullable UUID kekProjectId) { + this.kekProjectId = kekProjectId; + return this; + } + + /** + * Id of the project, where the key in the STACKIT-KMS belongs to, in case the key is located in + * a different project. By default the same project ID is used, like for the volume itself. + * Defining a key in a different project is only allowed for privileged internal projects. + * + * @return kekProjectId + */ + @javax.annotation.Nullable public UUID getKekProjectId() { + return kekProjectId; + } + + public void setKekProjectId(@javax.annotation.Nullable UUID kekProjectId) { + this.kekProjectId = kekProjectId; + } + + public VolumeEncryptionParameter keyPayload(@javax.annotation.Nullable byte[] keyPayload) { + this.keyPayload = keyPayload; + return this; + } + + /** + * Optional predefined secret, which will be encrypted against the key-encryption-key within the + * STACKIT-KMS. If not defined, a random secret will be generated by the API and encrypted + * against the STACKIT-KMS. If a key-payload is provided here, it must be base64 encoded. + * + * @return keyPayload + */ + @javax.annotation.Nullable public byte[] getKeyPayload() { + return keyPayload; + } + + public void setKeyPayload(@javax.annotation.Nullable byte[] keyPayload) { + this.keyPayload = keyPayload; + } + + public VolumeEncryptionParameter serviceAccount( + @javax.annotation.Nonnull String serviceAccount) { + this.serviceAccount = serviceAccount; + return this; + } + + /** + * Service-Account linked to the Key within the STACKIT-KMS. + * + * @return serviceAccount + */ + @javax.annotation.Nonnull + public String getServiceAccount() { + return serviceAccount; + } + + public void setServiceAccount(@javax.annotation.Nonnull String serviceAccount) { + this.serviceAccount = serviceAccount; + } + + /** + * 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 VolumeEncryptionParameter instance itself + */ + public VolumeEncryptionParameter 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; + } + VolumeEncryptionParameter volumeEncryptionParameter = (VolumeEncryptionParameter) o; + return Objects.equals(this.kekKeyId, volumeEncryptionParameter.kekKeyId) + && Objects.equals(this.kekKeyVersion, volumeEncryptionParameter.kekKeyVersion) + && Objects.equals(this.kekKeyringId, volumeEncryptionParameter.kekKeyringId) + && Objects.equals(this.kekProjectId, volumeEncryptionParameter.kekProjectId) + && Arrays.equals(this.keyPayload, volumeEncryptionParameter.keyPayload) + && Objects.equals(this.serviceAccount, volumeEncryptionParameter.serviceAccount) + && Objects.equals( + this.additionalProperties, volumeEncryptionParameter.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + kekKeyId, + kekKeyVersion, + kekKeyringId, + kekProjectId, + Arrays.hashCode(keyPayload), + serviceAccount, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VolumeEncryptionParameter {\n"); + sb.append(" kekKeyId: ").append(toIndentedString(kekKeyId)).append("\n"); + sb.append(" kekKeyVersion: ").append(toIndentedString(kekKeyVersion)).append("\n"); + sb.append(" kekKeyringId: ").append(toIndentedString(kekKeyringId)).append("\n"); + sb.append(" kekProjectId: ").append(toIndentedString(kekProjectId)).append("\n"); + sb.append(" keyPayload: ").append(toIndentedString(keyPayload)).append("\n"); + sb.append(" serviceAccount: ").append(toIndentedString(serviceAccount)).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( + "kekKeyId", + "kekKeyVersion", + "kekKeyringId", + "kekProjectId", + "keyPayload", + "serviceAccount")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = + new HashSet( + Arrays.asList( + "kekKeyId", "kekKeyVersion", "kekKeyringId", "serviceAccount")); + } + + /** + * 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 VolumeEncryptionParameter + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VolumeEncryptionParameter.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 VolumeEncryptionParameter is not found in the empty JSON string", + VolumeEncryptionParameter.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : VolumeEncryptionParameter.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("kekKeyId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `kekKeyId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("kekKeyId").toString())); + } + if (!jsonObj.get("kekKeyringId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `kekKeyringId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("kekKeyringId").toString())); + } + if ((jsonObj.get("kekProjectId") != null && !jsonObj.get("kekProjectId").isJsonNull()) + && !jsonObj.get("kekProjectId").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `kekProjectId` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("kekProjectId").toString())); + } + if (!jsonObj.get("serviceAccount").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `serviceAccount` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("serviceAccount").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VolumeEncryptionParameter.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'VolumeEncryptionParameter' and its + // subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(VolumeEncryptionParameter.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, VolumeEncryptionParameter 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 VolumeEncryptionParameter read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + VolumeEncryptionParameter 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 VolumeEncryptionParameter given an JSON string + * + * @param jsonString JSON string + * @return An instance of VolumeEncryptionParameter + * @throws IOException if the JSON string is invalid with respect to VolumeEncryptionParameter + */ + public static VolumeEncryptionParameter fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, VolumeEncryptionParameter.class); + } + + /** + * Convert an instance of VolumeEncryptionParameter to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/VolumeListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/VolumeListResponse.java new file mode 100644 index 00000000..a1f9a12c --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/VolumeListResponse.java @@ -0,0 +1,326 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** Volume list response. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class VolumeListResponse { + public static final String SERIALIZED_NAME_ITEMS = "items"; + + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public VolumeListResponse() {} + + public VolumeListResponse items(@javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public VolumeListResponse addItemsItem(Volume itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list containing volume objects. + * + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the VolumeListResponse instance itself + */ + public VolumeListResponse 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; + } + VolumeListResponse volumeListResponse = (VolumeListResponse) o; + return Objects.equals(this.items, volumeListResponse.items) + && Objects.equals( + this.additionalProperties, volumeListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VolumeListResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("items")); + } + + /** + * 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 VolumeListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VolumeListResponse.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 VolumeListResponse is not found in the empty JSON string", + VolumeListResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : VolumeListResponse.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("items").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `items` to be an array in the JSON string but got `%s`", + jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + Volume.validateJsonElement(jsonArrayitems.get(i)); + } + ; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VolumeListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'VolumeListResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(VolumeListResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, VolumeListResponse 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 VolumeListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + VolumeListResponse 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 VolumeListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of VolumeListResponse + * @throws IOException if the JSON string is invalid with respect to VolumeListResponse + */ + public static VolumeListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, VolumeListResponse.class); + } + + /** + * Convert an instance of VolumeListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/VolumePerformanceClass.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/VolumePerformanceClass.java new file mode 100644 index 00000000..874c418d --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/VolumePerformanceClass.java @@ -0,0 +1,422 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** Object that represents a Volume performance class. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class VolumePerformanceClass { + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable private String description; + + public static final String SERIALIZED_NAME_IOPS = "iops"; + + @SerializedName(SERIALIZED_NAME_IOPS) + @javax.annotation.Nullable private Long iops; + + public static final String SERIALIZED_NAME_LABELS = "labels"; + + @SerializedName(SERIALIZED_NAME_LABELS) + @javax.annotation.Nullable private Object labels; + + public static final String SERIALIZED_NAME_NAME = "name"; + + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_THROUGHPUT = "throughput"; + + @SerializedName(SERIALIZED_NAME_THROUGHPUT) + @javax.annotation.Nullable private Long throughput; + + public VolumePerformanceClass() {} + + public VolumePerformanceClass description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Description Object. Allows string up to 255 Characters. + * + * @return description + */ + @javax.annotation.Nullable public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + public VolumePerformanceClass iops(@javax.annotation.Nullable Long iops) { + this.iops = iops; + return this; + } + + /** + * Input/Output Operations per second. + * + * @return iops + */ + @javax.annotation.Nullable public Long getIops() { + return iops; + } + + public void setIops(@javax.annotation.Nullable Long iops) { + this.iops = iops; + } + + public VolumePerformanceClass labels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + return this; + } + + /** + * Object that represents the labels of an object. Regex for keys: + * `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: + * `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a + * `null` value for a key will remove that key. The `stackit-` prefix is + * reserved and cannot be used for Keys. + * + * @return labels + */ + @javax.annotation.Nullable public Object getLabels() { + return labels; + } + + public void setLabels(@javax.annotation.Nullable Object labels) { + this.labels = labels; + } + + public VolumePerformanceClass name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * The name for a General Object. Matches Names and also UUIDs. + * + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + public VolumePerformanceClass throughput(@javax.annotation.Nullable Long throughput) { + this.throughput = throughput; + return this; + } + + /** + * Throughput in Megabyte per second. + * + * @return throughput + */ + @javax.annotation.Nullable public Long getThroughput() { + return throughput; + } + + public void setThroughput(@javax.annotation.Nullable Long throughput) { + this.throughput = throughput; + } + + /** + * 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 VolumePerformanceClass instance itself + */ + public VolumePerformanceClass 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; + } + VolumePerformanceClass volumePerformanceClass = (VolumePerformanceClass) o; + return Objects.equals(this.description, volumePerformanceClass.description) + && Objects.equals(this.iops, volumePerformanceClass.iops) + && Objects.equals(this.labels, volumePerformanceClass.labels) + && Objects.equals(this.name, volumePerformanceClass.name) + && Objects.equals(this.throughput, volumePerformanceClass.throughput) + && Objects.equals( + this.additionalProperties, volumePerformanceClass.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(description, iops, labels, name, throughput, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VolumePerformanceClass {\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" iops: ").append(toIndentedString(iops)).append("\n"); + sb.append(" labels: ").append(toIndentedString(labels)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" throughput: ").append(toIndentedString(throughput)).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("description", "iops", "labels", "name", "throughput")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("name")); + } + + /** + * 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 VolumePerformanceClass + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VolumePerformanceClass.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 VolumePerformanceClass is not found in the empty JSON string", + VolumePerformanceClass.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : VolumePerformanceClass.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("description") != null && !jsonObj.get("description").isJsonNull()) + && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `description` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("description").toString())); + } + if (!jsonObj.get("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())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VolumePerformanceClass.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'VolumePerformanceClass' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(VolumePerformanceClass.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, VolumePerformanceClass 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 VolumePerformanceClass read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + VolumePerformanceClass 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 VolumePerformanceClass given an JSON string + * + * @param jsonString JSON string + * @return An instance of VolumePerformanceClass + * @throws IOException if the JSON string is invalid with respect to VolumePerformanceClass + */ + public static VolumePerformanceClass fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, VolumePerformanceClass.class); + } + + /** + * Convert an instance of VolumePerformanceClass to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/VolumePerformanceClassListResponse.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/VolumePerformanceClassListResponse.java new file mode 100644 index 00000000..52764b3d --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/VolumePerformanceClassListResponse.java @@ -0,0 +1,337 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.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; + +/** Volume performance class list response. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class VolumePerformanceClassListResponse { + public static final String SERIALIZED_NAME_ITEMS = "items"; + + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nonnull + private List items = new ArrayList<>(); + + public VolumePerformanceClassListResponse() {} + + public VolumePerformanceClassListResponse items( + @javax.annotation.Nonnull List items) { + this.items = items; + return this; + } + + public VolumePerformanceClassListResponse addItemsItem(VolumePerformanceClass itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * A list containing Volume performance classes. + * + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the VolumePerformanceClassListResponse instance itself + */ + public VolumePerformanceClassListResponse 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; + } + VolumePerformanceClassListResponse volumePerformanceClassListResponse = + (VolumePerformanceClassListResponse) o; + return Objects.equals(this.items, volumePerformanceClassListResponse.items) + && Objects.equals( + this.additionalProperties, + volumePerformanceClassListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VolumePerformanceClassListResponse {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first + * line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("items")); + } + + /** + * 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 + * VolumePerformanceClassListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VolumePerformanceClassListResponse.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 VolumePerformanceClassListResponse is not found in the empty JSON string", + VolumePerformanceClassListResponse.openapiRequiredFields + .toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : VolumePerformanceClassListResponse.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("items").isJsonArray()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `items` to be an array in the JSON string but got `%s`", + jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + VolumePerformanceClass.validateJsonElement(jsonArrayitems.get(i)); + } + ; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VolumePerformanceClassListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'VolumePerformanceClassListResponse' and + // its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter( + this, TypeToken.get(VolumePerformanceClassListResponse.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, VolumePerformanceClassListResponse 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 VolumePerformanceClassListResponse read(JsonReader in) + throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + VolumePerformanceClassListResponse 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 VolumePerformanceClassListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of VolumePerformanceClassListResponse + * @throws IOException if the JSON string is invalid with respect to + * VolumePerformanceClassListResponse + */ + public static VolumePerformanceClassListResponse fromJson(String jsonString) + throws IOException { + return JSON.getGson().fromJson(jsonString, VolumePerformanceClassListResponse.class); + } + + /** + * Convert an instance of VolumePerformanceClassListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/VolumeSource.java b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/VolumeSource.java new file mode 100644 index 00000000..4b4db328 --- /dev/null +++ b/services/iaas/src/main/java/cloud/stackit/sdk/iaas/v2beta1api/model/VolumeSource.java @@ -0,0 +1,342 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.model; + +import cloud.stackit.sdk.iaas.v2beta1api.JSON; +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +/** The source object of a volume. */ +@javax.annotation.Generated( + value = "org.openapitools.codegen.languages.JavaClientCodegen", + comments = "Generator version: 7.19.0") +public class VolumeSource { + public static final String SERIALIZED_NAME_ID = "id"; + + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private UUID id; + + public static final String SERIALIZED_NAME_TYPE = "type"; + + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private String type; + + public VolumeSource() {} + + public VolumeSource id(@javax.annotation.Nonnull UUID id) { + this.id = id; + return this; + } + + /** + * Universally Unique Identifier (UUID). + * + * @return id + */ + @javax.annotation.Nonnull + public UUID getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull UUID id) { + this.id = id; + } + + public VolumeSource type(@javax.annotation.Nonnull String type) { + this.type = type; + return this; + } + + /** + * The source types of a volume. Possible values: `image`, `volume`, + * `snapshot`, `backup`. + * + * @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 VolumeSource instance itself + */ + public VolumeSource 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; + } + VolumeSource volumeSource = (VolumeSource) o; + return Objects.equals(this.id, volumeSource.id) + && Objects.equals(this.type, volumeSource.type) + && Objects.equals(this.additionalProperties, volumeSource.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VolumeSource {\n"); + sb.append(" id: ").append(toIndentedString(id)).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("id", "type")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("id", "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 VolumeSource + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VolumeSource.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 VolumeSource is not found in the empty JSON string", + VolumeSource.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : VolumeSource.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("id").isJsonPrimitive()) { + throw new IllegalArgumentException( + String.format( + java.util.Locale.ROOT, + "Expected the field `id` to be a primitive type in the JSON string but got `%s`", + jsonObj.get("id").toString())); + } + if (!jsonObj.get("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 (!VolumeSource.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'VolumeSource' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter = + gson.getDelegateAdapter(this, TypeToken.get(VolumeSource.class)); + + return (TypeAdapter) + new TypeAdapter() { + @Override + public void write(JsonWriter out, VolumeSource 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 VolumeSource read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + VolumeSource 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 VolumeSource given an JSON string + * + * @param jsonString JSON string + * @return An instance of VolumeSource + * @throws IOException if the JSON string is invalid with respect to VolumeSource + */ + public static VolumeSource fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, VolumeSource.class); + } + + /** + * Convert an instance of VolumeSource to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/services/iaas/src/test/java/cloud/stackit/sdk/iaas/v1api/api/DefaultApiTest.java b/services/iaas/src/test/java/cloud/stackit/sdk/iaas/v1api/api/DefaultApiTest.java new file mode 100644 index 00000000..f3a3c34b --- /dev/null +++ b/services/iaas/src/test/java/cloud/stackit/sdk/iaas/v1api/api/DefaultApiTest.java @@ -0,0 +1,66 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.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/iaas/src/test/java/cloud/stackit/sdk/iaas/v1api/api/IaasApiTest.java b/services/iaas/src/test/java/cloud/stackit/sdk/iaas/v1api/api/IaasApiTest.java new file mode 100644 index 00000000..ddead3c2 --- /dev/null +++ b/services/iaas/src/test/java/cloud/stackit/sdk/iaas/v1api/api/IaasApiTest.java @@ -0,0 +1,67 @@ +/* + * STACKIT IaaS API + * This API is deprecated. It will be retired on 01.03.2027. Please use the STACKIT IaaS API V2 instead. + * + * The version of the OpenAPI document: 1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.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 IaasApi */ +public class IaasApiTest { + @Test + public void TestCustomHttpClient() throws IOException { + // before + CoreConfiguration conf = + new CoreConfiguration().serviceAccountKey(TestUtils.MOCK_SERVICE_ACCOUNT_KEY); + + // when + OkHttpClient httpClient = new OkHttpClient(); + IaasApi api = new IaasApi(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 + IaasApi api = new IaasApi(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/iaas/src/test/java/cloud/stackit/sdk/iaas/v2alpha1api/api/DefaultApiTest.java b/services/iaas/src/test/java/cloud/stackit/sdk/iaas/v2alpha1api/api/DefaultApiTest.java new file mode 100644 index 00000000..9ded143e --- /dev/null +++ b/services/iaas/src/test/java/cloud/stackit/sdk/iaas/v2alpha1api/api/DefaultApiTest.java @@ -0,0 +1,66 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2alpha1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2alpha1api; + +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/iaas/src/test/java/cloud/stackit/sdk/iaas/v2alpha1api/api/IaasApiTest.java b/services/iaas/src/test/java/cloud/stackit/sdk/iaas/v2alpha1api/api/IaasApiTest.java new file mode 100644 index 00000000..4b307d21 --- /dev/null +++ b/services/iaas/src/test/java/cloud/stackit/sdk/iaas/v2alpha1api/api/IaasApiTest.java @@ -0,0 +1,67 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2alpha1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2alpha1api.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 IaasApi */ +public class IaasApiTest { + @Test + public void TestCustomHttpClient() throws IOException { + // before + CoreConfiguration conf = + new CoreConfiguration().serviceAccountKey(TestUtils.MOCK_SERVICE_ACCOUNT_KEY); + + // when + OkHttpClient httpClient = new OkHttpClient(); + IaasApi api = new IaasApi(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 + IaasApi api = new IaasApi(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/iaas/src/test/java/cloud/stackit/sdk/iaas/api/DefaultApiTest.java b/services/iaas/src/test/java/cloud/stackit/sdk/iaas/v2api/api/DefaultApiTest.java similarity index 98% rename from services/iaas/src/test/java/cloud/stackit/sdk/iaas/api/DefaultApiTest.java rename to services/iaas/src/test/java/cloud/stackit/sdk/iaas/v2api/api/DefaultApiTest.java index ea336350..b4712c41 100644 --- a/services/iaas/src/test/java/cloud/stackit/sdk/iaas/api/DefaultApiTest.java +++ b/services/iaas/src/test/java/cloud/stackit/sdk/iaas/v2api/api/DefaultApiTest.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas; +package cloud.stackit.sdk.iaas.v2api; import cloud.stackit.sdk.core.KeyFlowAuthenticator; import cloud.stackit.sdk.core.auth.SetupAuth; diff --git a/services/iaas/src/test/java/cloud/stackit/sdk/iaas/api/IaasApiTest.java b/services/iaas/src/test/java/cloud/stackit/sdk/iaas/v2api/api/IaasApiTest.java similarity index 98% rename from services/iaas/src/test/java/cloud/stackit/sdk/iaas/api/IaasApiTest.java rename to services/iaas/src/test/java/cloud/stackit/sdk/iaas/v2api/api/IaasApiTest.java index 9424a784..9f3b4add 100644 --- a/services/iaas/src/test/java/cloud/stackit/sdk/iaas/api/IaasApiTest.java +++ b/services/iaas/src/test/java/cloud/stackit/sdk/iaas/v2api/api/IaasApiTest.java @@ -10,7 +10,7 @@ * Do not edit the class manually. */ -package cloud.stackit.sdk.iaas.api; +package cloud.stackit.sdk.iaas.v2api.api; import cloud.stackit.sdk.core.KeyFlowAuthenticator; import cloud.stackit.sdk.core.auth.SetupAuth; diff --git a/services/iaas/src/test/java/cloud/stackit/sdk/iaas/v2beta1api/api/DefaultApiTest.java b/services/iaas/src/test/java/cloud/stackit/sdk/iaas/v2beta1api/api/DefaultApiTest.java new file mode 100644 index 00000000..06a5fed5 --- /dev/null +++ b/services/iaas/src/test/java/cloud/stackit/sdk/iaas/v2beta1api/api/DefaultApiTest.java @@ -0,0 +1,66 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api; + +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/iaas/src/test/java/cloud/stackit/sdk/iaas/v2beta1api/api/IaasApiTest.java b/services/iaas/src/test/java/cloud/stackit/sdk/iaas/v2beta1api/api/IaasApiTest.java new file mode 100644 index 00000000..62a91aae --- /dev/null +++ b/services/iaas/src/test/java/cloud/stackit/sdk/iaas/v2beta1api/api/IaasApiTest.java @@ -0,0 +1,67 @@ +/* + * STACKIT IaaS API + * This API allows you to create and modify IaaS resources. + * + * The version of the OpenAPI document: 2beta1 + * Contact: stackit-iaas@mail.schwarz + * + * 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.iaas.v2beta1api.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 IaasApi */ +public class IaasApiTest { + @Test + public void TestCustomHttpClient() throws IOException { + // before + CoreConfiguration conf = + new CoreConfiguration().serviceAccountKey(TestUtils.MOCK_SERVICE_ACCOUNT_KEY); + + // when + OkHttpClient httpClient = new OkHttpClient(); + IaasApi api = new IaasApi(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 + IaasApi api = new IaasApi(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()); + } +}