Skip to content

Commit 8ea7a79

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

55 files changed

Lines changed: 451 additions & 237 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
@@ -3,6 +3,9 @@
33
- `automation`:
44
- [v0.1.1](services/automation/CHANGELOG.md#v011)
55
- **Dependencies:** Bump `org.openapitools:jackson-databind-nullable` from `0.2.8` to `0.2.12`
6+
- `serverbackup`:
7+
- [v0.2.1](services/serverbackup/CHANGELOG.md#v021)
8+
- **Dependencies:** Bump `org.openapitools:jackson-databind-nullable` from `0.2.8` to `0.2.12`
69
- `resourcemanager`:
710
- [v0.7.0](services/resourcemanager/CHANGELOG.md#v070)
811
- **Dependencies:** Bump `org.openapitools:jackson-databind-nullable` from `0.2.8` to `0.2.12`

‎services/serverbackup/CHANGELOG.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## v0.2.1
2+
- **Dependencies:** Bump `org.openapitools:jackson-databind-nullable` from `0.2.8` to `0.2.12`
3+
14
## v0.2.0
25
- **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
36

‎services/serverbackup/VERSION‎

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

‎services/serverbackup/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/serverbackup/oas_commit‎

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

‎services/serverbackup/src/main/java/cloud/stackit/sdk/serverbackup/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.serverbackup.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/serverbackup/src/main/java/cloud/stackit/sdk/serverbackup/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.serverbackup.v1api.model.Backup.CustomTypeAdapterFactory());
@@ -345,6 +350,53 @@ public LocalDate read(JsonReader in) throws IOException {
345350
}
346351
}
347352

353+
/** Gson TypeAdapter for JSR310 LocalDateTime type */
354+
public static class LocalDateTimeTypeAdapter extends TypeAdapter<LocalDateTime> {
355+
356+
private DateTimeFormatter formatter;
357+
358+
public LocalDateTimeTypeAdapter() {
359+
this(DateTimeFormatter.ISO_LOCAL_DATE_TIME);
360+
}
361+
362+
public LocalDateTimeTypeAdapter(DateTimeFormatter formatter) {
363+
this.formatter = formatter;
364+
}
365+
366+
public void setFormat(DateTimeFormatter dateFormat) {
367+
this.formatter = dateFormat;
368+
}
369+
370+
@Override
371+
public void write(JsonWriter out, LocalDateTime date) throws IOException {
372+
if (date == null) {
373+
out.nullValue();
374+
} else {
375+
out.value(formatter.format(date));
376+
}
377+
}
378+
379+
@Override
380+
public LocalDateTime read(JsonReader in) throws IOException {
381+
switch (in.peek()) {
382+
case NULL:
383+
in.nextNull();
384+
return null;
385+
default:
386+
String date = in.nextString();
387+
try {
388+
return LocalDateTime.parse(date, formatter);
389+
} catch (DateTimeParseException e) {
390+
if (date.length() > 10 && date.charAt(10) == ' ') {
391+
date = date.substring(0, 10) + 'T' + date.substring(11);
392+
return LocalDateTime.parse(date, formatter);
393+
}
394+
throw e;
395+
}
396+
}
397+
}
398+
}
399+
348400
public static void setOffsetDateTimeFormat(DateTimeFormatter dateFormat) {
349401
offsetDateTimeTypeAdapter.setFormat(dateFormat);
350402
}
@@ -353,6 +405,10 @@ public static void setLocalDateFormat(DateTimeFormatter dateFormat) {
353405
localDateTypeAdapter.setFormat(dateFormat);
354406
}
355407

408+
public static void setLocalDateTimeFormat(DateTimeFormatter dateFormat) {
409+
localDateTimeTypeAdapter.setFormat(dateFormat);
410+
}
411+
356412
/**
357413
* Gson TypeAdapter for java.sql.Date type If the dateFormat is null, a simple "yyyy-MM-dd"
358414
* format will be used (more efficient than SimpleDateFormat).

‎services/serverbackup/src/main/java/cloud/stackit/sdk/serverbackup/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.serverbackup.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/serverbackup/src/main/java/cloud/stackit/sdk/serverbackup/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/serverbackup/src/main/java/cloud/stackit/sdk/serverbackup/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)