Skip to content

Commit 107cd9e

Browse files
Generate resourcemanager
1 parent 3f45b11 commit 107cd9e

28 files changed

Lines changed: 361 additions & 237 deletions

‎services/resourcemanager/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'
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7a688091c603097448c818da2fd8386f3b02a6d8
1+
3d55d58fe8607afa4f894077e1e5c0a19ef57b3f

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

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

400+
/**
401+
* Set LocalDateTimeFormat.
402+
*
403+
* @param dateFormat a {@link java.time.format.DateTimeFormatter} object
404+
* @return a {@link cloud.stackit.sdk.resourcemanager.v0api.ApiClient} object
405+
*/
406+
public ApiClient setLocalDateTimeFormat(DateTimeFormatter dateFormat) {
407+
JSON.setLocalDateTimeFormat(dateFormat);
408+
return this;
409+
}
410+
400411
/**
401412
* Set LenientOnJson.
402413
*
@@ -597,6 +608,46 @@ public String parameterToString(Object param) {
597608
}
598609
}
599610

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

‎services/resourcemanager/src/main/java/cloud/stackit/sdk/resourcemanager/v0api/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.resourcemanager.v0api.model.CreateFolderPayload
@@ -349,6 +354,53 @@ public LocalDate read(JsonReader in) throws IOException {
349354
}
350355
}
351356

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

412+
public static void setLocalDateTimeFormat(DateTimeFormatter dateFormat) {
413+
localDateTimeTypeAdapter.setFormat(dateFormat);
414+
}
415+
360416
/**
361417
* Gson TypeAdapter for java.sql.Date type If the dateFormat is null, a simple "yyyy-MM-dd"
362418
* format will be used (more efficient than SimpleDateFormat).

‎services/resourcemanager/src/main/java/cloud/stackit/sdk/resourcemanager/v0api/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.resourcemanager.v0api;
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/resourcemanager/src/main/java/cloud/stackit/sdk/resourcemanager/v0api/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/resourcemanager/src/main/java/cloud/stackit/sdk/resourcemanager/v0api/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;

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

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

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 StringUtil {
2020
/**
2121
* Check if the given array contains the given value (with case-insensitive comparison).

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import java.util.Objects;
1717

1818
/** Abstract class for oneOf,anyOf schemas defined in OpenAPI spec */
19-
@javax.annotation.Generated(value = "JavaGenerator", comments = "Generator version: 7.19.0")
19+
@javax.annotation.Generated(value = "JavaGenerator", comments = "Generator version: 7.26.0")
2020
public abstract class AbstractOpenApiSchema {
2121

2222
// store the actual instance of the schema/object
@@ -104,10 +104,7 @@ public String toString() {
104104
* line).
105105
*/
106106
private String toIndentedString(Object o) {
107-
if (o == null) {
108-
return "null";
109-
}
110-
return o.toString().replace("\n", "\n ");
107+
return o == null ? "null" : o.toString().replace("\n", "\n ");
111108
}
112109

113110
public boolean equals(Object o) {

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

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import com.google.gson.Gson;
1717
import com.google.gson.JsonArray;
1818
import com.google.gson.JsonElement;
19+
import com.google.gson.JsonNull;
1920
import com.google.gson.JsonObject;
2021
import com.google.gson.TypeAdapter;
2122
import com.google.gson.TypeAdapterFactory;
@@ -34,7 +35,7 @@
3435
import java.util.Set;
3536

3637
/** CreateFolderPayload */
37-
@javax.annotation.Generated(value = "JavaGenerator", comments = "Generator version: 7.19.0")
38+
@javax.annotation.Generated(value = "JavaGenerator", comments = "Generator version: 7.26.0")
3839
public class CreateFolderPayload {
3940
public static final String SERIALIZED_NAME_CONTAINER_PARENT_ID = "containerParentId";
4041

@@ -67,8 +68,7 @@ public CreateFolderPayload containerParentId(
6768
}
6869

6970
/**
70-
* Identifier of the parent resource container - containerId as well as UUID identifier is
71-
* supported.
71+
* Identifier of the parent resource container
7272
*
7373
* @return containerParentId
7474
*/
@@ -95,17 +95,20 @@ public CreateFolderPayload putLabelsItem(String key, String labelsItem) {
9595
}
9696

9797
/**
98-
* Key-value string pairs attached to an existing resource container. Certain labels may be
99-
* enforced via organizational policies. * **Key:** Must be between 1 and 63 characters long
98+
* Key-value string pairs attached to a resource container during creation. Certain labels may
99+
* be enforced via organizational policies. * **Key:** Must be between 1 and 63 characters long
100100
* (excluding an optional domain prefix). Must start and end with an alphanumeric character
101101
* &#x60;[a-zA-Z0-9]&#x60; and can contain alphanumerics, dashes (-), underscores (_), and dots
102102
* (.). May include an optional domain prefix up to 250 characters (a lowercase DNS subdomain
103103
* containing &#x60;[a-z0-9]&#x60;, &#x60;-&#x60;, and &#x60;.&#x60;) followed by a slash (/).
104104
* Total maximum key length is 314 characters. * **Value:** Must be 63 characters or less. May
105105
* be empty (\&quot;\&quot;). If non-empty, must start and end with an alphanumeric character
106106
* &#x60;[a-zA-Z0-9]&#x60; and can contain alphanumerics, dashes (-), underscores (_), and dots
107-
* (.). &gt; Note: Additional naming restrictions may apply depending on your specific
108-
* organization.*
107+
* (.). * Either a &#x60;\&quot;scope\&quot;: \&quot;PUBLIC\&quot;&#x60; label or a valid
108+
* &#x60;networkArea&#x60; label must be provided for project creation. * To create a project
109+
* within a STACKIT Network Area, you must set the label &#x60;\&quot;networkArea\&quot;:
110+
* \&quot;&lt;networkAreaID&gt;\&quot;&#x60;. &gt; **Important:** The &#x60;networkArea&#x60;
111+
* label is immutable and **cannot be changed** after project creation.
109112
*
110113
* @return labels
111114
*/
@@ -131,8 +134,7 @@ public CreateFolderPayload addMembersItem(Member membersItem) {
131134
}
132135

133136
/**
134-
* The initial members assigned to the project. At least one subject needs to be a user, and not
135-
* a client or service account.
137+
* The initial members assigned to the folder.
136138
*
137139
* @return members
138140
*/
@@ -150,8 +152,8 @@ public CreateFolderPayload name(@javax.annotation.Nonnull String name) {
150152
}
151153

152154
/**
153-
* The name of the folder matching the regex &#x60;^[a-zA-ZäüöÄÜÖ0-9](
154-
* ?[a-zA-ZäüöÄÜÖß0-9_+&amp;-]){0,39}$&#x60;.
155+
* Folder name matching the regex &#x60;^[a-zA-ZäüöÄÜÖ0-9](
156+
* ?[a-zA-ZäüöÄÜÖß0-9_+&amp;-]){1,40}$&#x60;.
155157
*
156158
* @return name
157159
*/
@@ -252,10 +254,7 @@ public String toString() {
252254
* line).
253255
*/
254256
private String toIndentedString(Object o) {
255-
if (o == null) {
256-
return "null";
257-
}
258-
return o.toString().replace("\n", "\n ");
257+
return o == null ? "null" : o.toString().replace("\n", "\n ");
259258
}
260259

261260
public static HashSet<String> openapiFields;
@@ -369,7 +368,9 @@ else if (entry.getValue() instanceof Character)
369368
entry.getKey(), (Character) entry.getValue());
370369
else {
371370
JsonElement jsonElement = gson.toJsonTree(entry.getValue());
372-
if (jsonElement.isJsonArray()) {
371+
if (jsonElement.isJsonNull()) {
372+
obj.add(entry.getKey(), JsonNull.INSTANCE);
373+
} else if (jsonElement.isJsonArray()) {
373374
obj.add(entry.getKey(), jsonElement.getAsJsonArray());
374375
} else {
375376
obj.add(entry.getKey(), jsonElement.getAsJsonObject());

0 commit comments

Comments
 (0)