Skip to content

Commit 469a4c0

Browse files
Marcel JacekMarcel Jacek
authored andcommitted
generate iaas v2
1 parent a2bc09e commit 469a4c0

File tree

173 files changed

+36969
-12205
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

173 files changed

+36969
-12205
lines changed

services/iaas/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# STACKIT Java SDK for IaaS-API
1+
# STACKIT Java SDK for STACKIT IaaS API
22

3-
- API version: 1
3+
- API version: 2
44

55
This API allows you to create and modify IaaS resources.
66

services/iaas/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ dependencies {
1010
implementation 'com.google.code.gson:gson:2.9.1'
1111
implementation 'io.gsonfire:gson-fire:1.9.0'
1212
implementation 'jakarta.ws.rs:jakarta.ws.rs-api:2.1.6'
13-
implementation 'org.openapitools:jackson-databind-nullable:0.2.6'
14-
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.17.0'
13+
implementation 'org.openapitools:jackson-databind-nullable:0.2.8'
14+
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.18.0'
1515
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
1616
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.3'
1717
testImplementation 'org.mockito:mockito-core:3.12.4'

services/iaas/src/main/java/cloud/stackit/sdk/iaas/ApiCallback.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*
2-
* IaaS-API
2+
* STACKIT IaaS API
33
* This API allows you to create and modify IaaS resources.
44
*
5-
* The version of the OpenAPI document: 1
5+
* The version of the OpenAPI document: 2
66
* Contact: stackit-iaas@mail.schwarz
77
*
88
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).

services/iaas/src/main/java/cloud/stackit/sdk/iaas/ApiClient.java

Lines changed: 66 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*
2-
* IaaS-API
2+
* STACKIT IaaS API
33
* This API allows you to create and modify IaaS resources.
44
*
5-
* The version of the OpenAPI document: 1
5+
* The version of the OpenAPI document: 2
66
* Contact: stackit-iaas@mail.schwarz
77
*
88
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -52,22 +52,21 @@
5252
/** ApiClient class. */
5353
public class ApiClient {
5454

55-
protected String basePath = "https://iaas.api.eu01.stackit.cloud";
55+
protected String basePath = "https://iaas.api.stackit.cloud";
5656
protected List<ServerConfiguration> servers =
5757
new ArrayList<ServerConfiguration>(
5858
Arrays.asList(
5959
new ServerConfiguration(
60-
"https://iaas.api.{region}stackit.cloud",
60+
"https://iaas.api.stackit.cloud",
6161
"No description provided",
6262
new HashMap<String, ServerVariable>() {
6363
{
6464
put(
6565
"region",
6666
new ServerVariable(
6767
"No description provided",
68-
"eu01.",
69-
new HashSet<String>(
70-
Arrays.asList("eu01."))));
68+
"global",
69+
new HashSet<String>()));
7170
}
7271
})));
7372
protected Integer serverIndex = 0;
@@ -85,6 +84,7 @@ public class ApiClient {
8584
protected InputStream sslCaCert;
8685
protected boolean verifyingSsl;
8786
protected KeyManager[] keyManagers;
87+
protected String tlsServerName;
8888

8989
protected OkHttpClient httpClient;
9090
protected JSON json;
@@ -190,8 +190,8 @@ public String getBasePath() {
190190
/**
191191
* Set base path
192192
*
193-
* @param basePath Base path of the URL (e.g https://iaas.api.eu01.stackit.cloud
194-
* @return An instance of OkHttpClient
193+
* @param basePath Base path of the URL (e.g https://iaas.api.stackit.cloud)
194+
* @return An instance of ApiClient
195195
*/
196196
public ApiClient setBasePath(String basePath) {
197197
this.basePath = basePath;
@@ -322,6 +322,28 @@ public ApiClient setKeyManagers(KeyManager[] managers) {
322322
return this;
323323
}
324324

325+
/**
326+
* Get TLS server name for SNI (Server Name Indication).
327+
*
328+
* @return The TLS server name
329+
*/
330+
public String getTlsServerName() {
331+
return tlsServerName;
332+
}
333+
334+
/**
335+
* Set TLS server name for SNI (Server Name Indication). This is used to verify the server
336+
* certificate against a specific hostname instead of the hostname in the URL.
337+
*
338+
* @param tlsServerName The TLS server name to use for certificate verification
339+
* @return ApiClient
340+
*/
341+
public ApiClient setTlsServerName(String tlsServerName) {
342+
this.tlsServerName = tlsServerName;
343+
applySslSettings();
344+
return this;
345+
}
346+
325347
/**
326348
* Getter for the field <code>dateFormat</code>.
327349
*
@@ -606,7 +628,7 @@ public List<Pair> parameterToPair(String name, Object value) {
606628
* @param value The value of the parameter.
607629
* @return A list of {@code Pair} objects.
608630
*/
609-
public List<Pair> parameterToPairs(String collectionFormat, String name, Collection value) {
631+
public List<Pair> parameterToPairs(String collectionFormat, String name, Collection<?> value) {
610632
List<Pair> params = new ArrayList<Pair>();
611633

612634
// preconditions
@@ -828,7 +850,17 @@ public <T> T deserialize(Response response, Type returnType) throws ApiException
828850
}
829851
try {
830852
if (isJsonMime(contentType)) {
831-
return JSON.deserialize(respBody.byteStream(), returnType);
853+
if (returnType.equals(String.class)) {
854+
String respBodyString = respBody.string();
855+
if (respBodyString.isEmpty()) {
856+
return null;
857+
}
858+
// Use String-based deserialize for String return type with fallback
859+
return JSON.deserialize(respBodyString, returnType);
860+
} else {
861+
// Use InputStream-based deserialize which supports responses > 2GB
862+
return JSON.deserialize(respBody.byteStream(), returnType);
863+
}
832864
} else if (returnType.equals(String.class)) {
833865
String respBodyString = respBody.string();
834866
if (respBodyString.isEmpty()) {
@@ -1228,8 +1260,10 @@ public String buildUrl(
12281260
if (serverIndex < 0 || serverIndex >= servers.size()) {
12291261
throw new ArrayIndexOutOfBoundsException(
12301262
String.format(
1263+
java.util.Locale.ROOT,
12311264
"Invalid index %d when selecting the host settings. Must be less than %d",
1232-
serverIndex, servers.size()));
1265+
serverIndex,
1266+
servers.size()));
12331267
}
12341268
baseURL = servers.get(serverIndex).URL(serverVariables);
12351269
} else {
@@ -1303,12 +1337,16 @@ public void processHeaderParams(Map<String, String> headerParams, Request.Builde
13031337
public void processCookieParams(Map<String, String> cookieParams, Request.Builder reqBuilder) {
13041338
for (Entry<String, String> param : cookieParams.entrySet()) {
13051339
reqBuilder.addHeader(
1306-
"Cookie", String.format("%s=%s", param.getKey(), param.getValue()));
1340+
"Cookie",
1341+
String.format(
1342+
java.util.Locale.ROOT, "%s=%s", param.getKey(), param.getValue()));
13071343
}
13081344
for (Entry<String, String> param : defaultCookieMap.entrySet()) {
13091345
if (!cookieParams.containsKey(param.getKey())) {
13101346
reqBuilder.addHeader(
1311-
"Cookie", String.format("%s=%s", param.getKey(), param.getValue()));
1347+
"Cookie",
1348+
String.format(
1349+
java.util.Locale.ROOT, "%s=%s", param.getKey(), param.getValue()));
13121350
}
13131351
}
13141352
}
@@ -1496,7 +1534,20 @@ public boolean verify(String hostname, SSLSession session) {
14961534
trustManagerFactory.init(caKeyStore);
14971535
}
14981536
trustManagers = trustManagerFactory.getTrustManagers();
1499-
hostnameVerifier = OkHostnameVerifier.INSTANCE;
1537+
if (tlsServerName != null && !tlsServerName.isEmpty()) {
1538+
hostnameVerifier =
1539+
new HostnameVerifier() {
1540+
@Override
1541+
public boolean verify(String hostname, SSLSession session) {
1542+
// Verify the certificate against tlsServerName instead of the
1543+
// actual hostname
1544+
return OkHostnameVerifier.INSTANCE.verify(
1545+
tlsServerName, session);
1546+
}
1547+
};
1548+
} else {
1549+
hostnameVerifier = OkHostnameVerifier.INSTANCE;
1550+
}
15001551
}
15011552

15021553
SSLContext sslContext = SSLContext.getInstance("TLS");

services/iaas/src/main/java/cloud/stackit/sdk/iaas/ApiResponse.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*
2-
* IaaS-API
2+
* STACKIT IaaS API
33
* This API allows you to create and modify IaaS resources.
44
*
5-
* The version of the OpenAPI document: 1
5+
* The version of the OpenAPI document: 2
66
* Contact: stackit-iaas@mail.schwarz
77
*
88
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).

services/iaas/src/main/java/cloud/stackit/sdk/iaas/GzipRequestInterceptor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*
2-
* IaaS-API
2+
* STACKIT IaaS API
33
* This API allows you to create and modify IaaS resources.
44
*
5-
* The version of the OpenAPI document: 1
5+
* The version of the OpenAPI document: 2
66
* Contact: stackit-iaas@mail.schwarz
77
*
88
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).

0 commit comments

Comments
 (0)