Skip to content

Commit 505b3d8

Browse files
Generator: Update SDK /services/alb (#270)
1 parent 373bb70 commit 505b3d8

Some content is hidden

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

43 files changed

+4406
-588
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
## Release (2026-MM-DD)
2+
- `alb`: [v0.3.0](services/alb/CHANGELOG.md#v030)
3+
- **Feature:** Add fields `usedCredentials` and `usedLoadbalancers` to `GetQuotaResponse`
4+
- **Improvement:** Support additional properties in models
25
- `objectstorage`: [v0.1.2](services/objectstorage/CHANGELOG.md#v012)
36
- **Improvement:** Support additional properties in models
47
- `resourcemanager`: [v0.4.2](services/resourcemanager/CHANGELOG.md#v042)

services/alb/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## v0.3.0
2+
- **Feature:** Add fields `usedCredentials` and `usedLoadbalancers` to `GetQuotaResponse`
3+
- **Improvement:** Support additional properties in models
4+
15
## v0.2.0
26
- **Feature:** Switch from `v2beta` API version to `v2` version.
37
- **Feature:** `MaxCredentials` field added to `GetQuotaResponse`

services/alb/VERSION

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

services/alb/oas_commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ed4e4fbee2f5db4d95725108fb3d736e5363fb2f

services/alb/src/main/java/cloud/stackit/sdk/alb/model/ActiveHealthCheck.java

Lines changed: 112 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,11 @@
2424
import com.google.gson.stream.JsonWriter;
2525
import java.io.IOException;
2626
import java.util.Arrays;
27+
import java.util.HashMap;
2728
import java.util.HashSet;
29+
import java.util.List;
2830
import java.util.Map;
2931
import java.util.Objects;
30-
import java.util.Set;
3132

3233
/** Set this to customize active health checks for targets in this pool. */
3334
@javax.annotation.Generated(
@@ -176,6 +177,50 @@ public void setUnhealthyThreshold(@javax.annotation.Nullable Integer unhealthyTh
176177
this.unhealthyThreshold = unhealthyThreshold;
177178
}
178179

180+
/**
181+
* A container for additional, undeclared properties. This is a holder for any undeclared
182+
* properties as specified with the 'additionalProperties' keyword in the OAS document.
183+
*/
184+
private Map<String, Object> additionalProperties;
185+
186+
/**
187+
* Set the additional (undeclared) property with the specified name and value. If the property
188+
* does not already exist, create it otherwise replace it.
189+
*
190+
* @param key name of the property
191+
* @param value value of the property
192+
* @return the ActiveHealthCheck instance itself
193+
*/
194+
public ActiveHealthCheck putAdditionalProperty(String key, Object value) {
195+
if (this.additionalProperties == null) {
196+
this.additionalProperties = new HashMap<String, Object>();
197+
}
198+
this.additionalProperties.put(key, value);
199+
return this;
200+
}
201+
202+
/**
203+
* Return the additional (undeclared) property.
204+
*
205+
* @return a map of objects
206+
*/
207+
public Map<String, Object> getAdditionalProperties() {
208+
return additionalProperties;
209+
}
210+
211+
/**
212+
* Return the additional (undeclared) property with the specified name.
213+
*
214+
* @param key name of the property
215+
* @return an object
216+
*/
217+
public Object getAdditionalProperty(String key) {
218+
if (this.additionalProperties == null) {
219+
return null;
220+
}
221+
return this.additionalProperties.get(key);
222+
}
223+
179224
@Override
180225
public boolean equals(Object o) {
181226
if (this == o) {
@@ -190,7 +235,9 @@ public boolean equals(Object o) {
190235
&& Objects.equals(this.interval, activeHealthCheck.interval)
191236
&& Objects.equals(this.intervalJitter, activeHealthCheck.intervalJitter)
192237
&& Objects.equals(this.timeout, activeHealthCheck.timeout)
193-
&& Objects.equals(this.unhealthyThreshold, activeHealthCheck.unhealthyThreshold);
238+
&& Objects.equals(this.unhealthyThreshold, activeHealthCheck.unhealthyThreshold)
239+
&& Objects.equals(
240+
this.additionalProperties, activeHealthCheck.additionalProperties);
194241
}
195242

196243
@Override
@@ -201,7 +248,8 @@ public int hashCode() {
201248
interval,
202249
intervalJitter,
203250
timeout,
204-
unhealthyThreshold);
251+
unhealthyThreshold,
252+
additionalProperties);
205253
}
206254

207255
@Override
@@ -216,6 +264,9 @@ public String toString() {
216264
sb.append(" unhealthyThreshold: ")
217265
.append(toIndentedString(unhealthyThreshold))
218266
.append("\n");
267+
sb.append(" additionalProperties: ")
268+
.append(toIndentedString(additionalProperties))
269+
.append("\n");
219270
sb.append("}");
220271
return sb.toString();
221272
}
@@ -266,17 +317,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti
266317
ActiveHealthCheck.openapiRequiredFields.toString()));
267318
}
268319
}
269-
270-
Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
271-
// check to see if the JSON string contains additional fields
272-
for (Map.Entry<String, JsonElement> entry : entries) {
273-
if (!ActiveHealthCheck.openapiFields.contains(entry.getKey())) {
274-
throw new IllegalArgumentException(
275-
String.format(
276-
"The field `%s` in the JSON string is not defined in the `ActiveHealthCheck` properties. JSON: %s",
277-
entry.getKey(), jsonElement.toString()));
278-
}
279-
}
280320
JsonObject jsonObj = jsonElement.getAsJsonObject();
281321
// validate the optional field `httpHealthChecks`
282322
if (jsonObj.get("httpHealthChecks") != null
@@ -323,14 +363,71 @@ public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
323363
public void write(JsonWriter out, ActiveHealthCheck value)
324364
throws IOException {
325365
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
366+
obj.remove("additionalProperties");
367+
// serialize additional properties
368+
if (value.getAdditionalProperties() != null) {
369+
for (Map.Entry<String, Object> entry :
370+
value.getAdditionalProperties().entrySet()) {
371+
if (entry.getValue() instanceof String)
372+
obj.addProperty(entry.getKey(), (String) entry.getValue());
373+
else if (entry.getValue() instanceof Number)
374+
obj.addProperty(entry.getKey(), (Number) entry.getValue());
375+
else if (entry.getValue() instanceof Boolean)
376+
obj.addProperty(entry.getKey(), (Boolean) entry.getValue());
377+
else if (entry.getValue() instanceof Character)
378+
obj.addProperty(
379+
entry.getKey(), (Character) entry.getValue());
380+
else {
381+
JsonElement jsonElement = gson.toJsonTree(entry.getValue());
382+
if (jsonElement.isJsonArray()) {
383+
obj.add(entry.getKey(), jsonElement.getAsJsonArray());
384+
} else {
385+
obj.add(entry.getKey(), jsonElement.getAsJsonObject());
386+
}
387+
}
388+
}
389+
}
326390
elementAdapter.write(out, obj);
327391
}
328392

329393
@Override
330394
public ActiveHealthCheck read(JsonReader in) throws IOException {
331395
JsonElement jsonElement = elementAdapter.read(in);
332396
validateJsonElement(jsonElement);
333-
return thisAdapter.fromJsonTree(jsonElement);
397+
JsonObject jsonObj = jsonElement.getAsJsonObject();
398+
// store additional fields in the deserialized instance
399+
ActiveHealthCheck instance = thisAdapter.fromJsonTree(jsonObj);
400+
for (Map.Entry<String, JsonElement> entry : jsonObj.entrySet()) {
401+
if (!openapiFields.contains(entry.getKey())) {
402+
if (entry.getValue().isJsonPrimitive()) { // primitive type
403+
if (entry.getValue().getAsJsonPrimitive().isString())
404+
instance.putAdditionalProperty(
405+
entry.getKey(), entry.getValue().getAsString());
406+
else if (entry.getValue().getAsJsonPrimitive().isNumber())
407+
instance.putAdditionalProperty(
408+
entry.getKey(), entry.getValue().getAsNumber());
409+
else if (entry.getValue().getAsJsonPrimitive().isBoolean())
410+
instance.putAdditionalProperty(
411+
entry.getKey(),
412+
entry.getValue().getAsBoolean());
413+
else
414+
throw new IllegalArgumentException(
415+
String.format(
416+
"The field `%s` has unknown primitive type. Value: %s",
417+
entry.getKey(),
418+
entry.getValue().toString()));
419+
} else if (entry.getValue().isJsonArray()) {
420+
instance.putAdditionalProperty(
421+
entry.getKey(),
422+
gson.fromJson(entry.getValue(), List.class));
423+
} else { // JSON object
424+
instance.putAdditionalProperty(
425+
entry.getKey(),
426+
gson.fromJson(entry.getValue(), HashMap.class));
427+
}
428+
}
429+
}
430+
return instance;
334431
}
335432
}.nullSafe();
336433
}

services/alb/src/main/java/cloud/stackit/sdk/alb/model/CertificateConfig.java

Lines changed: 110 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@
2525
import java.io.IOException;
2626
import java.util.ArrayList;
2727
import java.util.Arrays;
28+
import java.util.HashMap;
2829
import java.util.HashSet;
2930
import java.util.List;
3031
import java.util.Map;
3132
import java.util.Objects;
32-
import java.util.Set;
3333

3434
/** TLS termination certificate configuration. */
3535
@javax.annotation.Generated(
@@ -70,6 +70,50 @@ public void setCertificateIds(@javax.annotation.Nullable List<String> certificat
7070
this.certificateIds = certificateIds;
7171
}
7272

73+
/**
74+
* A container for additional, undeclared properties. This is a holder for any undeclared
75+
* properties as specified with the 'additionalProperties' keyword in the OAS document.
76+
*/
77+
private Map<String, Object> additionalProperties;
78+
79+
/**
80+
* Set the additional (undeclared) property with the specified name and value. If the property
81+
* does not already exist, create it otherwise replace it.
82+
*
83+
* @param key name of the property
84+
* @param value value of the property
85+
* @return the CertificateConfig instance itself
86+
*/
87+
public CertificateConfig putAdditionalProperty(String key, Object value) {
88+
if (this.additionalProperties == null) {
89+
this.additionalProperties = new HashMap<String, Object>();
90+
}
91+
this.additionalProperties.put(key, value);
92+
return this;
93+
}
94+
95+
/**
96+
* Return the additional (undeclared) property.
97+
*
98+
* @return a map of objects
99+
*/
100+
public Map<String, Object> getAdditionalProperties() {
101+
return additionalProperties;
102+
}
103+
104+
/**
105+
* Return the additional (undeclared) property with the specified name.
106+
*
107+
* @param key name of the property
108+
* @return an object
109+
*/
110+
public Object getAdditionalProperty(String key) {
111+
if (this.additionalProperties == null) {
112+
return null;
113+
}
114+
return this.additionalProperties.get(key);
115+
}
116+
73117
@Override
74118
public boolean equals(Object o) {
75119
if (this == o) {
@@ -79,19 +123,24 @@ public boolean equals(Object o) {
79123
return false;
80124
}
81125
CertificateConfig certificateConfig = (CertificateConfig) o;
82-
return Objects.equals(this.certificateIds, certificateConfig.certificateIds);
126+
return Objects.equals(this.certificateIds, certificateConfig.certificateIds)
127+
&& Objects.equals(
128+
this.additionalProperties, certificateConfig.additionalProperties);
83129
}
84130

85131
@Override
86132
public int hashCode() {
87-
return Objects.hash(certificateIds);
133+
return Objects.hash(certificateIds, additionalProperties);
88134
}
89135

90136
@Override
91137
public String toString() {
92138
StringBuilder sb = new StringBuilder();
93139
sb.append("class CertificateConfig {\n");
94140
sb.append(" certificateIds: ").append(toIndentedString(certificateIds)).append("\n");
141+
sb.append(" additionalProperties: ")
142+
.append(toIndentedString(additionalProperties))
143+
.append("\n");
95144
sb.append("}");
96145
return sb.toString();
97146
}
@@ -134,17 +183,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti
134183
CertificateConfig.openapiRequiredFields.toString()));
135184
}
136185
}
137-
138-
Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
139-
// check to see if the JSON string contains additional fields
140-
for (Map.Entry<String, JsonElement> entry : entries) {
141-
if (!CertificateConfig.openapiFields.contains(entry.getKey())) {
142-
throw new IllegalArgumentException(
143-
String.format(
144-
"The field `%s` in the JSON string is not defined in the `CertificateConfig` properties. JSON: %s",
145-
entry.getKey(), jsonElement.toString()));
146-
}
147-
}
148186
JsonObject jsonObj = jsonElement.getAsJsonObject();
149187
// ensure the optional json data is an array if present
150188
if (jsonObj.get("certificateIds") != null
@@ -174,14 +212,71 @@ public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
174212
public void write(JsonWriter out, CertificateConfig value)
175213
throws IOException {
176214
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
215+
obj.remove("additionalProperties");
216+
// serialize additional properties
217+
if (value.getAdditionalProperties() != null) {
218+
for (Map.Entry<String, Object> entry :
219+
value.getAdditionalProperties().entrySet()) {
220+
if (entry.getValue() instanceof String)
221+
obj.addProperty(entry.getKey(), (String) entry.getValue());
222+
else if (entry.getValue() instanceof Number)
223+
obj.addProperty(entry.getKey(), (Number) entry.getValue());
224+
else if (entry.getValue() instanceof Boolean)
225+
obj.addProperty(entry.getKey(), (Boolean) entry.getValue());
226+
else if (entry.getValue() instanceof Character)
227+
obj.addProperty(
228+
entry.getKey(), (Character) entry.getValue());
229+
else {
230+
JsonElement jsonElement = gson.toJsonTree(entry.getValue());
231+
if (jsonElement.isJsonArray()) {
232+
obj.add(entry.getKey(), jsonElement.getAsJsonArray());
233+
} else {
234+
obj.add(entry.getKey(), jsonElement.getAsJsonObject());
235+
}
236+
}
237+
}
238+
}
177239
elementAdapter.write(out, obj);
178240
}
179241

180242
@Override
181243
public CertificateConfig read(JsonReader in) throws IOException {
182244
JsonElement jsonElement = elementAdapter.read(in);
183245
validateJsonElement(jsonElement);
184-
return thisAdapter.fromJsonTree(jsonElement);
246+
JsonObject jsonObj = jsonElement.getAsJsonObject();
247+
// store additional fields in the deserialized instance
248+
CertificateConfig instance = thisAdapter.fromJsonTree(jsonObj);
249+
for (Map.Entry<String, JsonElement> entry : jsonObj.entrySet()) {
250+
if (!openapiFields.contains(entry.getKey())) {
251+
if (entry.getValue().isJsonPrimitive()) { // primitive type
252+
if (entry.getValue().getAsJsonPrimitive().isString())
253+
instance.putAdditionalProperty(
254+
entry.getKey(), entry.getValue().getAsString());
255+
else if (entry.getValue().getAsJsonPrimitive().isNumber())
256+
instance.putAdditionalProperty(
257+
entry.getKey(), entry.getValue().getAsNumber());
258+
else if (entry.getValue().getAsJsonPrimitive().isBoolean())
259+
instance.putAdditionalProperty(
260+
entry.getKey(),
261+
entry.getValue().getAsBoolean());
262+
else
263+
throw new IllegalArgumentException(
264+
String.format(
265+
"The field `%s` has unknown primitive type. Value: %s",
266+
entry.getKey(),
267+
entry.getValue().toString()));
268+
} else if (entry.getValue().isJsonArray()) {
269+
instance.putAdditionalProperty(
270+
entry.getKey(),
271+
gson.fromJson(entry.getValue(), List.class));
272+
} else { // JSON object
273+
instance.putAdditionalProperty(
274+
entry.getKey(),
275+
gson.fromJson(entry.getValue(), HashMap.class));
276+
}
277+
}
278+
}
279+
return instance;
185280
}
186281
}.nullSafe();
187282
}

0 commit comments

Comments
 (0)