Skip to content

Commit febffc0

Browse files
Generator: Update SDK /services/serverupdate (#1165)
Co-authored-by: Marcel Jacek <72880145+marceljk@users.noreply.github.com>
1 parent 8ea7a79 commit febffc0

45 files changed

Lines changed: 391 additions & 177 deletions

Some content is hidden

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

‎CHANGELOG.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
- `serverbackup`:
77
- [v0.2.1](services/serverbackup/CHANGELOG.md#v021)
88
- **Dependencies:** Bump `org.openapitools:jackson-databind-nullable` from `0.2.8` to `0.2.12`
9+
- `serverupdate`:
10+
- [v0.2.2](services/serverupdate/CHANGELOG.md#v022)
11+
- **Dependencies:** Bump `org.openapitools:jackson-databind-nullable` from `0.2.8` to `0.2.12`
912
- `resourcemanager`:
1013
- [v0.7.0](services/resourcemanager/CHANGELOG.md#v070)
1114
- **Dependencies:** Bump `org.openapitools:jackson-databind-nullable` from `0.2.8` to `0.2.12`

‎services/serverupdate/CHANGELOG.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## v0.2.2
2+
- **Dependencies:** Bump `org.openapitools:jackson-databind-nullable` from `0.2.8` to `0.2.12`
3+
14
## v0.2.1
25
- `v1api`: **Docs:** Extend the description of the attributes `rrule` and `maintenanceWindow`
36

‎services/serverupdate/VERSION‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.2.1
1+
0.2.2

‎services/serverupdate/build.gradle‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ 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.8'
13+
implementation 'org.openapitools:jackson-databind-nullable:0.2.12'
1414
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'

‎services/serverupdate/oas_commit‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
602a933a8a6cc22c52171febbca7ceaf63bc7538
1+
6c5332d5f71263507049f2f2ef036fe07937b63a

‎services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/ApiClient.java‎

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,17 @@ public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) {
398398
return this;
399399
}
400400

401+
/**
402+
* Set LocalDateTimeFormat.
403+
*
404+
* @param dateFormat a {@link java.time.format.DateTimeFormatter} object
405+
* @return a {@link cloud.stackit.sdk.serverupdate.v1api.ApiClient} object
406+
*/
407+
public ApiClient setLocalDateTimeFormat(DateTimeFormatter dateFormat) {
408+
JSON.setLocalDateTimeFormat(dateFormat);
409+
return this;
410+
}
411+
401412
/**
402413
* Set LenientOnJson.
403414
*
@@ -598,6 +609,46 @@ public String parameterToString(Object param) {
598609
}
599610
}
600611

612+
/**
613+
* Format the given parameter object as an ASCII-safe JSON string.
614+
*
615+
* @param param Parameter
616+
* @return JSON representation of the parameter
617+
*/
618+
public String parameterToJsonString(Object param) {
619+
if (param == null) {
620+
return "";
621+
}
622+
String json = JSON.serialize(param);
623+
int firstUnsafe = -1;
624+
for (int i = 0; i < json.length(); i++) {
625+
if (json.charAt(i) >= 0x7f) {
626+
firstUnsafe = i;
627+
break;
628+
}
629+
}
630+
if (firstUnsafe == -1) {
631+
return json;
632+
}
633+
634+
StringBuilder escaped = new StringBuilder(json.length());
635+
escaped.append(json, 0, firstUnsafe);
636+
for (int i = firstUnsafe; i < json.length(); i++) {
637+
char c = json.charAt(i);
638+
if (c >= 0x7f) {
639+
escaped.append("\\u");
640+
escaped.append(Character.forDigit((c >> 12) & 0xf, 16));
641+
escaped.append(Character.forDigit((c >> 8) & 0xf, 16));
642+
escaped.append(Character.forDigit((c >> 4) & 0xf, 16));
643+
escaped.append(Character.forDigit(c & 0xf, 16));
644+
} else {
645+
escaped.append(c);
646+
}
647+
}
648+
649+
return escaped.toString();
650+
}
651+
601652
/**
602653
* Formats the specified query parameter to a list containing a single {@code Pair} object.
603654
*

‎services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/JSON.java‎

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@
3131
import java.text.ParseException;
3232
import java.text.ParsePosition;
3333
import java.time.LocalDate;
34+
import java.time.LocalDateTime;
3435
import java.time.OffsetDateTime;
3536
import java.time.format.DateTimeFormatter;
37+
import java.time.format.DateTimeParseException;
3638
import java.util.Date;
3739
import java.util.Map;
3840
import okio.ByteString;
@@ -51,6 +53,8 @@ public class JSON {
5153
private static OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter =
5254
new OffsetDateTimeTypeAdapter();
5355
private static LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter();
56+
private static LocalDateTimeTypeAdapter localDateTimeTypeAdapter =
57+
new LocalDateTimeTypeAdapter();
5458
private static ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter();
5559

5660
@SuppressWarnings("unchecked")
@@ -94,6 +98,7 @@ private static Class getClassByDiscriminator(
9498
gsonBuilder.registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter);
9599
gsonBuilder.registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter);
96100
gsonBuilder.registerTypeAdapter(LocalDate.class, localDateTypeAdapter);
101+
gsonBuilder.registerTypeAdapter(LocalDateTime.class, localDateTimeTypeAdapter);
97102
gsonBuilder.registerTypeAdapter(byte[].class, byteArrayAdapter);
98103
gsonBuilder.registerTypeAdapterFactory(
99104
new cloud.stackit.sdk.serverupdate.v1api.model.CreateUpdatePayload
@@ -330,6 +335,53 @@ public LocalDate read(JsonReader in) throws IOException {
330335
}
331336
}
332337

338+
/** Gson TypeAdapter for JSR310 LocalDateTime type */
339+
public static class LocalDateTimeTypeAdapter extends TypeAdapter<LocalDateTime> {
340+
341+
private DateTimeFormatter formatter;
342+
343+
public LocalDateTimeTypeAdapter() {
344+
this(DateTimeFormatter.ISO_LOCAL_DATE_TIME);
345+
}
346+
347+
public LocalDateTimeTypeAdapter(DateTimeFormatter formatter) {
348+
this.formatter = formatter;
349+
}
350+
351+
public void setFormat(DateTimeFormatter dateFormat) {
352+
this.formatter = dateFormat;
353+
}
354+
355+
@Override
356+
public void write(JsonWriter out, LocalDateTime date) throws IOException {
357+
if (date == null) {
358+
out.nullValue();
359+
} else {
360+
out.value(formatter.format(date));
361+
}
362+
}
363+
364+
@Override
365+
public LocalDateTime read(JsonReader in) throws IOException {
366+
switch (in.peek()) {
367+
case NULL:
368+
in.nextNull();
369+
return null;
370+
default:
371+
String date = in.nextString();
372+
try {
373+
return LocalDateTime.parse(date, formatter);
374+
} catch (DateTimeParseException e) {
375+
if (date.length() > 10 && date.charAt(10) == ' ') {
376+
date = date.substring(0, 10) + 'T' + date.substring(11);
377+
return LocalDateTime.parse(date, formatter);
378+
}
379+
throw e;
380+
}
381+
}
382+
}
383+
}
384+
333385
public static void setOffsetDateTimeFormat(DateTimeFormatter dateFormat) {
334386
offsetDateTimeTypeAdapter.setFormat(dateFormat);
335387
}
@@ -338,6 +390,10 @@ public static void setLocalDateFormat(DateTimeFormatter dateFormat) {
338390
localDateTypeAdapter.setFormat(dateFormat);
339391
}
340392

393+
public static void setLocalDateTimeFormat(DateTimeFormatter dateFormat) {
394+
localDateTimeTypeAdapter.setFormat(dateFormat);
395+
}
396+
341397
/**
342398
* Gson TypeAdapter for java.sql.Date type If the dateFormat is null, a simple "yyyy-MM-dd"
343399
* format will be used (more efficient than SimpleDateFormat).

‎services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/Pair.java‎

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

1313
package cloud.stackit.sdk.serverupdate.v1api;
1414

15-
@javax.annotation.Generated(value = "JavaGenerator", comments = "Generator version: 7.19.0")
15+
@javax.annotation.Generated(value = "JavaGenerator", comments = "Generator version: 7.26.0")
1616
public class Pair {
1717
private final String name;
1818
private final String value;

‎services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/ServerConfiguration.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import java.util.Map;
1616

1717
/** Representing a Server configuration. */
18-
@javax.annotation.Generated(value = "JavaGenerator", comments = "Generator version: 7.19.0")
18+
@javax.annotation.Generated(value = "JavaGenerator", comments = "Generator version: 7.26.0")
1919
public class ServerConfiguration {
2020
public String URL;
2121
public String description;

‎services/serverupdate/src/main/java/cloud/stackit/sdk/serverupdate/v1api/ServerVariable.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import java.util.HashSet;
1616

1717
/** Representing a Server Variable for server URL template substitution. */
18-
@javax.annotation.Generated(value = "JavaGenerator", comments = "Generator version: 7.19.0")
18+
@javax.annotation.Generated(value = "JavaGenerator", comments = "Generator version: 7.26.0")
1919
public class ServerVariable {
2020
public String description;
2121
public String defaultValue;

0 commit comments

Comments
 (0)