Skip to content

Commit a0353ac

Browse files
Generate resourcemanager
1 parent a4f4534 commit a0353ac

28 files changed

+235
-53
lines changed

services/resourcemanager/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'
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ed4e4fbee2f5db4d95725108fb3d736e5363fb2f
1+
4ba9d6ffcf1ec61aff0807a261f8c0ca25d266f8

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

Lines changed: 60 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ public class ApiClient {
8484
protected InputStream sslCaCert;
8585
protected boolean verifyingSsl;
8686
protected KeyManager[] keyManagers;
87+
protected String tlsServerName;
8788

8889
protected OkHttpClient httpClient;
8990
protected JSON json;
@@ -189,8 +190,8 @@ public String getBasePath() {
189190
/**
190191
* Set base path
191192
*
192-
* @param basePath Base path of the URL (e.g https://resource-manager.api.stackit.cloud
193-
* @return An instance of OkHttpClient
193+
* @param basePath Base path of the URL (e.g https://resource-manager.api.stackit.cloud)
194+
* @return An instance of ApiClient
194195
*/
195196
public ApiClient setBasePath(String basePath) {
196197
this.basePath = basePath;
@@ -321,6 +322,28 @@ public ApiClient setKeyManagers(KeyManager[] managers) {
321322
return this;
322323
}
323324

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+
324347
/**
325348
* Getter for the field <code>dateFormat</code>.
326349
*
@@ -605,7 +628,7 @@ public List<Pair> parameterToPair(String name, Object value) {
605628
* @param value The value of the parameter.
606629
* @return A list of {@code Pair} objects.
607630
*/
608-
public List<Pair> parameterToPairs(String collectionFormat, String name, Collection value) {
631+
public List<Pair> parameterToPairs(String collectionFormat, String name, Collection<?> value) {
609632
List<Pair> params = new ArrayList<Pair>();
610633

611634
// preconditions
@@ -827,7 +850,17 @@ public <T> T deserialize(Response response, Type returnType) throws ApiException
827850
}
828851
try {
829852
if (isJsonMime(contentType)) {
830-
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+
}
831864
} else if (returnType.equals(String.class)) {
832865
String respBodyString = respBody.string();
833866
if (respBodyString.isEmpty()) {
@@ -1227,8 +1260,10 @@ public String buildUrl(
12271260
if (serverIndex < 0 || serverIndex >= servers.size()) {
12281261
throw new ArrayIndexOutOfBoundsException(
12291262
String.format(
1263+
java.util.Locale.ROOT,
12301264
"Invalid index %d when selecting the host settings. Must be less than %d",
1231-
serverIndex, servers.size()));
1265+
serverIndex,
1266+
servers.size()));
12321267
}
12331268
baseURL = servers.get(serverIndex).URL(serverVariables);
12341269
} else {
@@ -1302,12 +1337,16 @@ public void processHeaderParams(Map<String, String> headerParams, Request.Builde
13021337
public void processCookieParams(Map<String, String> cookieParams, Request.Builder reqBuilder) {
13031338
for (Entry<String, String> param : cookieParams.entrySet()) {
13041339
reqBuilder.addHeader(
1305-
"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()));
13061343
}
13071344
for (Entry<String, String> param : defaultCookieMap.entrySet()) {
13081345
if (!cookieParams.containsKey(param.getKey())) {
13091346
reqBuilder.addHeader(
1310-
"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()));
13111350
}
13121351
}
13131352
}
@@ -1495,7 +1534,20 @@ public boolean verify(String hostname, SSLSession session) {
14951534
trustManagerFactory.init(caKeyStore);
14961535
}
14971536
trustManagers = trustManagerFactory.getTrustManagers();
1498-
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+
}
14991551
}
15001552

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

services/resourcemanager/src/main/java/cloud/stackit/sdk/resourcemanager/Pair.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
@javax.annotation.Generated(
1616
value = "org.openapitools.codegen.languages.JavaClientCodegen",
17-
comments = "Generator version: 7.15.0")
17+
comments = "Generator version: 7.19.0")
1818
public class Pair {
1919
private final String name;
2020
private final String value;

services/resourcemanager/src/main/java/cloud/stackit/sdk/resourcemanager/ServerConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
/** Representing a Server configuration. */
1818
@javax.annotation.Generated(
1919
value = "org.openapitools.codegen.languages.JavaClientCodegen",
20-
comments = "Generator version: 7.15.0")
20+
comments = "Generator version: 7.19.0")
2121
public class ServerConfiguration {
2222
public String URL;
2323
public String description;

services/resourcemanager/src/main/java/cloud/stackit/sdk/resourcemanager/ServerVariable.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
/** Representing a Server Variable for server URL template substitution. */
1818
@javax.annotation.Generated(
1919
value = "org.openapitools.codegen.languages.JavaClientCodegen",
20-
comments = "Generator version: 7.15.0")
20+
comments = "Generator version: 7.19.0")
2121
public class ServerVariable {
2222
public String description;
2323
public String defaultValue;

services/resourcemanager/src/main/java/cloud/stackit/sdk/resourcemanager/StringUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
@javax.annotation.Generated(
1919
value = "org.openapitools.codegen.languages.JavaClientCodegen",
20-
comments = "Generator version: 7.15.0")
20+
comments = "Generator version: 7.19.0")
2121
public class StringUtil {
2222
/**
2323
* Check if the given array contains the given value (with case-insensitive comparison).

services/resourcemanager/src/main/java/cloud/stackit/sdk/resourcemanager/model/AbstractOpenApiSchema.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
/** Abstract class for oneOf,anyOf schemas defined in OpenAPI spec */
1919
@javax.annotation.Generated(
2020
value = "org.openapitools.codegen.languages.JavaClientCodegen",
21-
comments = "Generator version: 7.15.0")
21+
comments = "Generator version: 7.19.0")
2222
public abstract class AbstractOpenApiSchema {
2323

2424
// store the actual instance of the schema/object

services/resourcemanager/src/main/java/cloud/stackit/sdk/resourcemanager/model/ContainerSearchResult.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
/** ContainerSearchResult */
3636
@javax.annotation.Generated(
3737
value = "org.openapitools.codegen.languages.JavaClientCodegen",
38-
comments = "Generator version: 7.15.0")
38+
comments = "Generator version: 7.19.0")
3939
public class ContainerSearchResult {
4040
public static final String SERIALIZED_NAME_CONTAINER_ID = "containerId";
4141

@@ -375,6 +375,7 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti
375375
.isEmpty()) { // has required fields but JSON element is null
376376
throw new IllegalArgumentException(
377377
String.format(
378+
java.util.Locale.ROOT,
378379
"The required field(s) %s in ContainerSearchResult is not found in the empty JSON string",
379380
ContainerSearchResult.openapiRequiredFields.toString()));
380381
}
@@ -385,20 +386,24 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti
385386
if (jsonElement.getAsJsonObject().get(requiredField) == null) {
386387
throw new IllegalArgumentException(
387388
String.format(
389+
java.util.Locale.ROOT,
388390
"The required field `%s` is not found in the JSON string: %s",
389-
requiredField, jsonElement.toString()));
391+
requiredField,
392+
jsonElement.toString()));
390393
}
391394
}
392395
JsonObject jsonObj = jsonElement.getAsJsonObject();
393396
if (!jsonObj.get("containerId").isJsonPrimitive()) {
394397
throw new IllegalArgumentException(
395398
String.format(
399+
java.util.Locale.ROOT,
396400
"Expected the field `containerId` to be a primitive type in the JSON string but got `%s`",
397401
jsonObj.get("containerId").toString()));
398402
}
399403
if (!jsonObj.get("containerType").isJsonPrimitive()) {
400404
throw new IllegalArgumentException(
401405
String.format(
406+
java.util.Locale.ROOT,
402407
"Expected the field `containerType` to be a primitive type in the JSON string but got `%s`",
403408
jsonObj.get("containerType").toString()));
404409
}
@@ -407,6 +412,7 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti
407412
if (!jsonObj.get("id").isJsonPrimitive()) {
408413
throw new IllegalArgumentException(
409414
String.format(
415+
java.util.Locale.ROOT,
410416
"Expected the field `id` to be a primitive type in the JSON string but got `%s`",
411417
jsonObj.get("id").toString()));
412418
}
@@ -417,13 +423,15 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti
417423
if (!jsonObj.get("name").isJsonPrimitive()) {
418424
throw new IllegalArgumentException(
419425
String.format(
426+
java.util.Locale.ROOT,
420427
"Expected the field `name` to be a primitive type in the JSON string but got `%s`",
421428
jsonObj.get("name").toString()));
422429
}
423430
if ((jsonObj.get("organizationId") != null && !jsonObj.get("organizationId").isJsonNull())
424431
&& !jsonObj.get("organizationId").isJsonPrimitive()) {
425432
throw new IllegalArgumentException(
426433
String.format(
434+
java.util.Locale.ROOT,
427435
"Expected the field `organizationId` to be a primitive type in the JSON string but got `%s`",
428436
jsonObj.get("organizationId").toString()));
429437
}
@@ -496,6 +504,7 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean())
496504
else
497505
throw new IllegalArgumentException(
498506
String.format(
507+
java.util.Locale.ROOT,
499508
"The field `%s` has unknown primitive type. Value: %s",
500509
entry.getKey(),
501510
entry.getValue().toString()));

services/resourcemanager/src/main/java/cloud/stackit/sdk/resourcemanager/model/CreateFolderPayload.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
/** CreateFolderPayload */
3737
@javax.annotation.Generated(
3838
value = "org.openapitools.codegen.languages.JavaClientCodegen",
39-
comments = "Generator version: 7.15.0")
39+
comments = "Generator version: 7.19.0")
4040
public class CreateFolderPayload {
4141
public static final String SERIALIZED_NAME_CONTAINER_PARENT_ID = "containerParentId";
4242

@@ -278,6 +278,7 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti
278278
.isEmpty()) { // has required fields but JSON element is null
279279
throw new IllegalArgumentException(
280280
String.format(
281+
java.util.Locale.ROOT,
281282
"The required field(s) %s in CreateFolderPayload is not found in the empty JSON string",
282283
CreateFolderPayload.openapiRequiredFields.toString()));
283284
}
@@ -288,14 +289,17 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti
288289
if (jsonElement.getAsJsonObject().get(requiredField) == null) {
289290
throw new IllegalArgumentException(
290291
String.format(
292+
java.util.Locale.ROOT,
291293
"The required field `%s` is not found in the JSON string: %s",
292-
requiredField, jsonElement.toString()));
294+
requiredField,
295+
jsonElement.toString()));
293296
}
294297
}
295298
JsonObject jsonObj = jsonElement.getAsJsonObject();
296299
if (!jsonObj.get("containerParentId").isJsonPrimitive()) {
297300
throw new IllegalArgumentException(
298301
String.format(
302+
java.util.Locale.ROOT,
299303
"Expected the field `containerParentId` to be a primitive type in the JSON string but got `%s`",
300304
jsonObj.get("containerParentId").toString()));
301305
}
@@ -306,6 +310,7 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti
306310
if (!jsonObj.get("members").isJsonArray()) {
307311
throw new IllegalArgumentException(
308312
String.format(
313+
java.util.Locale.ROOT,
309314
"Expected the field `members` to be an array in the JSON string but got `%s`",
310315
jsonObj.get("members").toString()));
311316
}
@@ -320,6 +325,7 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti
320325
if (!jsonObj.get("name").isJsonPrimitive()) {
321326
throw new IllegalArgumentException(
322327
String.format(
328+
java.util.Locale.ROOT,
323329
"Expected the field `name` to be a primitive type in the JSON string but got `%s`",
324330
jsonObj.get("name").toString()));
325331
}
@@ -392,6 +398,7 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean())
392398
else
393399
throw new IllegalArgumentException(
394400
String.format(
401+
java.util.Locale.ROOT,
395402
"The field `%s` has unknown primitive type. Value: %s",
396403
entry.getKey(),
397404
entry.getValue().toString()));

0 commit comments

Comments
 (0)