Skip to content

Commit f0953f9

Browse files
Generate sfs
1 parent 0f977a2 commit f0953f9

5 files changed

Lines changed: 638 additions & 10 deletions

File tree

services/sfs/oas_commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
9356c10747db357b4ec533ec97231f1af5530ca0
1+
a896a71ffc1c1152f63b40a0194ac461ce179d6c

services/sfs/src/main/java/cloud/stackit/sdk/sfs/v1api/JSON.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,9 @@ private static Class getClassByDiscriminator(
198198
gsonBuilder.registerTypeAdapterFactory(
199199
new cloud.stackit.sdk.sfs.v1api.model.SnapshotPolicySchedule
200200
.CustomTypeAdapterFactory());
201+
gsonBuilder.registerTypeAdapterFactory(
202+
new cloud.stackit.sdk.sfs.v1api.model.SnapshotPolicySnapshotPolicySchedule
203+
.CustomTypeAdapterFactory());
201204
gsonBuilder.registerTypeAdapterFactory(
202205
new cloud.stackit.sdk.sfs.v1api.model.Status.CustomTypeAdapterFactory());
203206
gsonBuilder.registerTypeAdapterFactory(

services/sfs/src/main/java/cloud/stackit/sdk/sfs/v1api/model/SnapshotPolicy.java

Lines changed: 81 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,15 @@ public class SnapshotPolicy {
6565

6666
public static final String SERIALIZED_NAME_SCHEDULES = "schedules";
6767

68+
@Deprecated
6869
@SerializedName(SERIALIZED_NAME_SCHEDULES)
6970
@javax.annotation.Nullable private List<SnapshotPolicySchedule> schedules = new ArrayList<>();
7071

72+
public static final String SERIALIZED_NAME_SNAPSHOT_SCHEDULES = "snapshotSchedules";
73+
74+
@SerializedName(SERIALIZED_NAME_SNAPSHOT_SCHEDULES)
75+
@javax.annotation.Nullable private List<SnapshotPolicySnapshotPolicySchedule> snapshotSchedules = new ArrayList<>();
76+
7177
public SnapshotPolicy() {}
7278

7379
public SnapshotPolicy comment(@javax.annotation.Nullable String comment) {
@@ -160,6 +166,7 @@ public void setName(@javax.annotation.Nullable String name) {
160166
this.name = name;
161167
}
162168

169+
@Deprecated
163170
public SnapshotPolicy schedules(
164171
@javax.annotation.Nullable List<SnapshotPolicySchedule> schedules) {
165172
this.schedules = schedules;
@@ -175,18 +182,50 @@ public SnapshotPolicy addSchedulesItem(SnapshotPolicySchedule schedulesItem) {
175182
}
176183

177184
/**
178-
* associated schedules
185+
* (deprecated) associated schedules
179186
*
180187
* @return schedules
188+
* @deprecated
181189
*/
190+
@Deprecated
182191
@javax.annotation.Nullable public List<SnapshotPolicySchedule> getSchedules() {
183192
return schedules;
184193
}
185194

195+
@Deprecated
186196
public void setSchedules(@javax.annotation.Nullable List<SnapshotPolicySchedule> schedules) {
187197
this.schedules = schedules;
188198
}
189199

200+
public SnapshotPolicy snapshotSchedules(
201+
@javax.annotation.Nullable List<SnapshotPolicySnapshotPolicySchedule> snapshotSchedules) {
202+
this.snapshotSchedules = snapshotSchedules;
203+
return this;
204+
}
205+
206+
public SnapshotPolicy addSnapshotSchedulesItem(
207+
SnapshotPolicySnapshotPolicySchedule snapshotSchedulesItem) {
208+
if (this.snapshotSchedules == null) {
209+
this.snapshotSchedules = new ArrayList<>();
210+
}
211+
this.snapshotSchedules.add(snapshotSchedulesItem);
212+
return this;
213+
}
214+
215+
/**
216+
* associated schedules
217+
*
218+
* @return snapshotSchedules
219+
*/
220+
@javax.annotation.Nullable public List<SnapshotPolicySnapshotPolicySchedule> getSnapshotSchedules() {
221+
return snapshotSchedules;
222+
}
223+
224+
public void setSnapshotSchedules(
225+
@javax.annotation.Nullable List<SnapshotPolicySnapshotPolicySchedule> snapshotSchedules) {
226+
this.snapshotSchedules = snapshotSchedules;
227+
}
228+
190229
/**
191230
* A container for additional, undeclared properties. This is a holder for any undeclared
192231
* properties as specified with the 'additionalProperties' keyword in the OAS document.
@@ -246,12 +285,21 @@ public boolean equals(Object o) {
246285
&& Objects.equals(this.id, snapshotPolicy.id)
247286
&& Objects.equals(this.name, snapshotPolicy.name)
248287
&& Objects.equals(this.schedules, snapshotPolicy.schedules)
288+
&& Objects.equals(this.snapshotSchedules, snapshotPolicy.snapshotSchedules)
249289
&& Objects.equals(this.additionalProperties, snapshotPolicy.additionalProperties);
250290
}
251291

252292
@Override
253293
public int hashCode() {
254-
return Objects.hash(comment, createdAt, enabled, id, name, schedules, additionalProperties);
294+
return Objects.hash(
295+
comment,
296+
createdAt,
297+
enabled,
298+
id,
299+
name,
300+
schedules,
301+
snapshotSchedules,
302+
additionalProperties);
255303
}
256304

257305
@Override
@@ -264,6 +312,9 @@ public String toString() {
264312
sb.append(" id: ").append(toIndentedString(id)).append("\n");
265313
sb.append(" name: ").append(toIndentedString(name)).append("\n");
266314
sb.append(" schedules: ").append(toIndentedString(schedules)).append("\n");
315+
sb.append(" snapshotSchedules: ")
316+
.append(toIndentedString(snapshotSchedules))
317+
.append("\n");
267318
sb.append(" additionalProperties: ")
268319
.append(toIndentedString(additionalProperties))
269320
.append("\n");
@@ -290,7 +341,13 @@ private String toIndentedString(Object o) {
290341
openapiFields =
291342
new HashSet<String>(
292343
Arrays.asList(
293-
"comment", "createdAt", "enabled", "id", "name", "schedules"));
344+
"comment",
345+
"createdAt",
346+
"enabled",
347+
"id",
348+
"name",
349+
"schedules",
350+
"snapshotSchedules"));
294351

295352
// a set of required properties/fields (JSON key names)
296353
openapiRequiredFields = new HashSet<String>(0);
@@ -357,6 +414,27 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti
357414
;
358415
}
359416
}
417+
if (jsonObj.get("snapshotSchedules") != null
418+
&& !jsonObj.get("snapshotSchedules").isJsonNull()) {
419+
JsonArray jsonArraysnapshotSchedules = jsonObj.getAsJsonArray("snapshotSchedules");
420+
if (jsonArraysnapshotSchedules != null) {
421+
// ensure the json data is an array
422+
if (!jsonObj.get("snapshotSchedules").isJsonArray()) {
423+
throw new IllegalArgumentException(
424+
String.format(
425+
java.util.Locale.ROOT,
426+
"Expected the field `snapshotSchedules` to be an array in the JSON string but got `%s`",
427+
jsonObj.get("snapshotSchedules").toString()));
428+
}
429+
430+
// validate the optional field `snapshotSchedules` (array)
431+
for (int i = 0; i < jsonArraysnapshotSchedules.size(); i++) {
432+
SnapshotPolicySnapshotPolicySchedule.validateJsonElement(
433+
jsonArraysnapshotSchedules.get(i));
434+
}
435+
;
436+
}
437+
}
360438
}
361439

362440
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {

services/sfs/src/main/java/cloud/stackit/sdk/sfs/v1api/model/SnapshotPolicySchedule.java

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ public class SnapshotPolicySchedule {
4040
@SerializedName(SERIALIZED_NAME_COUNT)
4141
@javax.annotation.Nullable private Integer count;
4242

43+
public static final String SERIALIZED_NAME_INTERVAL = "interval";
44+
45+
@SerializedName(SERIALIZED_NAME_INTERVAL)
46+
@javax.annotation.Nullable private String interval;
47+
4348
public static final String SERIALIZED_NAME_PREFIX = "prefix";
4449

4550
@SerializedName(SERIALIZED_NAME_PREFIX)
@@ -63,7 +68,7 @@ public SnapshotPolicySchedule count(@javax.annotation.Nullable Integer count) {
6368
}
6469

6570
/**
66-
* Get count
71+
* Retention Count
6772
*
6873
* @return count
6974
*/
@@ -75,13 +80,31 @@ public void setCount(@javax.annotation.Nullable Integer count) {
7580
this.count = count;
7681
}
7782

83+
public SnapshotPolicySchedule interval(@javax.annotation.Nullable String interval) {
84+
this.interval = interval;
85+
return this;
86+
}
87+
88+
/**
89+
* Interval of the Schedule (follows the cron schedule expression in Unix-like systems)
90+
*
91+
* @return interval
92+
*/
93+
@javax.annotation.Nullable public String getInterval() {
94+
return interval;
95+
}
96+
97+
public void setInterval(@javax.annotation.Nullable String interval) {
98+
this.interval = interval;
99+
}
100+
78101
public SnapshotPolicySchedule prefix(@javax.annotation.Nullable String prefix) {
79102
this.prefix = prefix;
80103
return this;
81104
}
82105

83106
/**
84-
* Get prefix
107+
* Prefix used for the snapshots created by this policy
85108
*
86109
* @return prefix
87110
*/
@@ -100,7 +123,7 @@ public SnapshotPolicySchedule retentionPeriod(
100123
}
101124

102125
/**
103-
* Get retentionPeriod
126+
* Retention Period (ISO 8601 format or \&quot;infinite\&quot;)
104127
*
105128
* @return retentionPeriod
106129
*/
@@ -118,7 +141,7 @@ public SnapshotPolicySchedule scheduleId(@javax.annotation.Nullable String sched
118141
}
119142

120143
/**
121-
* Get scheduleId
144+
* ID of the Schedule
122145
*
123146
* @return scheduleId
124147
*/
@@ -184,6 +207,7 @@ public boolean equals(Object o) {
184207
}
185208
SnapshotPolicySchedule snapshotPolicySchedule = (SnapshotPolicySchedule) o;
186209
return Objects.equals(this.count, snapshotPolicySchedule.count)
210+
&& Objects.equals(this.interval, snapshotPolicySchedule.interval)
187211
&& Objects.equals(this.prefix, snapshotPolicySchedule.prefix)
188212
&& Objects.equals(this.retentionPeriod, snapshotPolicySchedule.retentionPeriod)
189213
&& Objects.equals(this.scheduleId, snapshotPolicySchedule.scheduleId)
@@ -193,14 +217,16 @@ public boolean equals(Object o) {
193217

194218
@Override
195219
public int hashCode() {
196-
return Objects.hash(count, prefix, retentionPeriod, scheduleId, additionalProperties);
220+
return Objects.hash(
221+
count, interval, prefix, retentionPeriod, scheduleId, additionalProperties);
197222
}
198223

199224
@Override
200225
public String toString() {
201226
StringBuilder sb = new StringBuilder();
202227
sb.append("class SnapshotPolicySchedule {\n");
203228
sb.append(" count: ").append(toIndentedString(count)).append("\n");
229+
sb.append(" interval: ").append(toIndentedString(interval)).append("\n");
204230
sb.append(" prefix: ").append(toIndentedString(prefix)).append("\n");
205231
sb.append(" retentionPeriod: ").append(toIndentedString(retentionPeriod)).append("\n");
206232
sb.append(" scheduleId: ").append(toIndentedString(scheduleId)).append("\n");
@@ -229,7 +255,8 @@ private String toIndentedString(Object o) {
229255
// a set of all properties/fields (JSON key names)
230256
openapiFields =
231257
new HashSet<String>(
232-
Arrays.asList("count", "prefix", "retentionPeriod", "scheduleId"));
258+
Arrays.asList(
259+
"count", "interval", "prefix", "retentionPeriod", "scheduleId"));
233260

234261
// a set of required properties/fields (JSON key names)
235262
openapiRequiredFields = new HashSet<String>(0);
@@ -253,6 +280,14 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti
253280
}
254281
}
255282
JsonObject jsonObj = jsonElement.getAsJsonObject();
283+
if ((jsonObj.get("interval") != null && !jsonObj.get("interval").isJsonNull())
284+
&& !jsonObj.get("interval").isJsonPrimitive()) {
285+
throw new IllegalArgumentException(
286+
String.format(
287+
java.util.Locale.ROOT,
288+
"Expected the field `interval` to be a primitive type in the JSON string but got `%s`",
289+
jsonObj.get("interval").toString()));
290+
}
256291
if ((jsonObj.get("prefix") != null && !jsonObj.get("prefix").isJsonNull())
257292
&& !jsonObj.get("prefix").isJsonPrimitive()) {
258293
throw new IllegalArgumentException(

0 commit comments

Comments
 (0)