Skip to content

Commit 838e57a

Browse files
committed
adjust iaas examples and add changelogs
1 parent 7b72065 commit 838e57a

File tree

5 files changed

+92
-34
lines changed

5 files changed

+92
-34
lines changed

CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
1+
## Release (2025-xx-xx)
2+
- `iaas`: [v1.0.0](services/iaas/CHANGELOG.md#v100)
3+
- **Breaking Change:** The region must be passed as a parameter to any region-specific request.
4+
- **Feature:** Add new methods to manage routing tables: `addRoutingTableToArea`, `deleteRoutingTableFromArea`, `getRoutingTableOfArea`, `listRoutingTablesOfArea`, `updateRoutingTableOfArea`
5+
- **Feature:** Add new methods to manage routes in routing tables: `addRoutesToRoutingTable`, `deleteRouteFromRoutingTable`, `getRouteOfRoutingTable`, `listRoutesOfRoutingTable`, `updateRouteOfRoutingTable`
6+
- **Breaking Change:** Add new method to manage network area regions: `createNetworkAreaRegion`, `deleteNetworkAreaRegion`, `getNetworkAreaRegion`, `listNetworkAreaRegions`, `updateNetworkAreaRegion`
7+
- **Feature:** Add new field `Encrypted` to `Backup` model, which indicates if a backup is encrypted
8+
- **Feature:** Add new field `ImportProgress` to `Image` model, which indicates the import progress of an image
9+
- **Breaking Change:** Remove field `addressFamily` in `CreateNetworkAreaPayload` model
10+
- **Breaking Change:** `Network` model has changed:
11+
- Rename `networkId` to `id`
12+
- Rename `state` to `status`
13+
- Move fields `gateway`, `nameservers`, `prefixes` and `publicIp` to new model `NetworkIPv4`, and can be accessed in the new field `ipv4`
14+
- Move fields `gatewayv6`, `nameserversv6` and `prefixesv6` to new model `NetworkIPv6`, and can be accessed in the new field `ipv6`
15+
- Add new field `routingTabledId`
16+
- **Breaking Change:** `NetworkArea` model has changed:
17+
- Rename `areaId` to `id`
18+
- Remove field `ipv4`
19+
- **Breaking Change:** Rename `networkRangeId` to `id` in `NetworkRange` model
20+
- **Breaking Change:** `CreateServerPayload` model has changed:
21+
- Model `CreateServerPayloadBootVolume` of `BootVolume` property changed to `ServerBootVolume`
22+
- Property `Networking` in `CreateServerPayload` is required now
23+
124
## Release (2025-10-29)
225
- `core`:
326
- [v0.4.0](core/CHANGELOG.md#v040)

examples/custom-http-client/src/main/java/cloud/stackit/sdk/customhttpclient/examples/CustomHttpClientExample.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,12 @@ public static void main(String[] args) throws IOException {
4646
}
4747
UUID projectId = UUID.fromString(projectIdString);
4848

49+
// specify which region should be queried
50+
String region = "eu01";
51+
4952
try {
5053
/* list all servers */
51-
ServerListResponse servers = iaasApi.listServers(projectId, false, null);
54+
ServerListResponse servers = iaasApi.listServers(projectId, region, false, null);
5255
System.out.println("\nAvailable servers: ");
5356
for (Server server : servers.getItems()) {
5457
System.out.println("* " + server.getId() + " | " + server.getName());

examples/iaas/src/main/java/cloud/stackit/sdk/iaas/examples/IaaSExample.java

Lines changed: 42 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ public static void main(String[] args) throws IOException {
3737
}
3838
UUID projectId = UUID.fromString(projectIdString);
3939

40+
String region = "eu01";
41+
4042
try {
4143
/*
4244
* ///////////////////////////////////////////////////////
@@ -49,38 +51,40 @@ public static void main(String[] args) throws IOException {
4951
Network newNetwork =
5052
iaasApi.createNetwork(
5153
projectId,
54+
region,
5255
new CreateNetworkPayload()
5356
.name("java-sdk-example-network-01")
5457
.dhcp(true)
5558
.routed(false)
5659
.labels(Collections.singletonMap("some-network-label", "bar"))
57-
.addressFamily(
58-
new CreateNetworkAddressFamily()
59-
.ipv4(
60-
new CreateNetworkIPv4Body()
61-
.addNameserversItem(
62-
"8.8.8.8"))));
63-
60+
.ipv4(
61+
new CreateNetworkIPv4(
62+
new CreateNetworkIPv4WithPrefixLength()
63+
.addNameserversItem("8.8.8.8")
64+
.prefixLength(24L))));
6465
/* update the network we just created */
6566
iaasApi.partialUpdateNetwork(
6667
projectId,
67-
newNetwork.getNetworkId(),
68+
region,
69+
newNetwork.getId(),
6870
new PartialUpdateNetworkPayload()
6971
.dhcp(false)
7072
.labels(Collections.singletonMap("some-network-label", "bar-updated")));
7173

7274
/* fetch the network we just created */
73-
Network fetchedNetwork = iaasApi.getNetwork(projectId, newNetwork.getNetworkId());
75+
Network fetchedNetwork = iaasApi.getNetwork(projectId, region, newNetwork.getId());
7476
System.out.println("\nFetched network: ");
7577
System.out.println("* Network name: " + fetchedNetwork.getName());
76-
System.out.println("* Id: " + fetchedNetwork.getNetworkId());
78+
System.out.println("* Id: " + fetchedNetwork.getId());
7779
System.out.println(
7880
"* DHCP: " + (Boolean.TRUE.equals(fetchedNetwork.getDhcp()) ? "YES" : "NO"));
79-
System.out.println("* Gateway: " + fetchedNetwork.getGateway());
80-
System.out.println("* Public IP: " + fetchedNetwork.getPublicIp());
81+
if (fetchedNetwork.getIpv4() != null) {
82+
System.out.println("* Gateway: " + fetchedNetwork.getIpv4().getGateway());
83+
System.out.println("* Public IP: " + fetchedNetwork.getIpv4().getPublicIp());
84+
}
8185

8286
/* list all available networks in the project */
83-
NetworkListResponse networks = iaasApi.listNetworks(projectId, null);
87+
NetworkListResponse networks = iaasApi.listNetworks(projectId, region, null);
8488
System.out.println("\nAvailable networks: ");
8589
for (Network network : networks.getItems()) {
8690
System.out.println("* " + network.getName());
@@ -93,7 +97,7 @@ public static void main(String[] args) throws IOException {
9397
* */
9498

9599
/* list all available images */
96-
ImageListResponse images = iaasApi.listImages(projectId, false, null);
100+
ImageListResponse images = iaasApi.listImages(projectId, region, false, null);
97101
System.out.println("\nAvailable images: ");
98102
for (Image image : images.getItems()) {
99103
System.out.println(image.getId() + " | " + image.getName());
@@ -105,7 +109,7 @@ public static void main(String[] args) throws IOException {
105109
.get(0)
106110
.getId(); // we just use a random image id in our example
107111
assert imageId != null;
108-
Image fetchedImage = iaasApi.getImage(projectId, imageId);
112+
Image fetchedImage = iaasApi.getImage(projectId, region, imageId);
109113
System.out.println("\nFetched image:");
110114
System.out.println("* Image name: " + fetchedImage.getName());
111115
System.out.println("* Image id: " + fetchedImage.getId());
@@ -160,15 +164,17 @@ public static void main(String[] args) throws IOException {
160164
* */
161165

162166
/* list all available machine types */
163-
MachineTypeListResponse machineTypes = iaasApi.listMachineTypes(projectId, null);
167+
MachineTypeListResponse machineTypes =
168+
iaasApi.listMachineTypes(projectId, region, null);
164169
System.out.println("\nAvailable machine types: ");
165170
for (MachineType machineType : machineTypes.getItems()) {
166171
System.out.println("* " + machineType.getName());
167172
}
168173

169174
/* fetch details about a machine type */
170175
MachineType fetchedMachineType =
171-
iaasApi.getMachineType(projectId, machineTypes.getItems().get(0).getName());
176+
iaasApi.getMachineType(
177+
projectId, region, machineTypes.getItems().get(0).getName());
172178
System.out.println("\nFetched machine type: ");
173179
System.out.println("* Machine type name: " + fetchedMachineType.getName());
174180
System.out.println("* Description: " + fetchedMachineType.getDescription());
@@ -187,6 +193,7 @@ public static void main(String[] args) throws IOException {
187193
Server newServer =
188194
iaasApi.createServer(
189195
projectId,
196+
region,
190197
new CreateServerPayload()
191198
.name("java-sdk-example-server-01")
192199
.machineType("t2i.1")
@@ -196,37 +203,38 @@ public static void main(String[] args) throws IOException {
196203
.keypairName(newKeypair.getName())
197204
// add the server to the network we created above
198205
.networking(
199-
new CreateServerPayloadNetworking(
206+
new CreateServerPayloadAllOfNetworking(
200207
new CreateServerNetworking()
201-
.networkId(
202-
newNetwork.getNetworkId()))));
208+
.networkId(newNetwork.getId()))));
203209
assert newServer.getId() != null;
204210

205211
/* wait for the server creation to complete */
206212
UUID serverId = newServer.getId();
207213
assert serverId != null;
208214
while (Objects.equals(
209-
iaasApi.getServer(projectId, serverId, false).getStatus(), "CREATING")) {
215+
iaasApi.getServer(projectId, region, serverId, false).getStatus(),
216+
"CREATING")) {
210217
System.out.println("Waiting for server creation to complete ...");
211218
TimeUnit.SECONDS.sleep(5);
212219
}
213220

214221
/* update the server we just created */
215222
iaasApi.updateServer(
216223
projectId,
224+
region,
217225
newServer.getId(),
218226
new UpdateServerPayload()
219227
.labels(Collections.singletonMap("foo", "bar-updated")));
220228

221229
/* list all servers */
222-
ServerListResponse servers = iaasApi.listServers(projectId, false, null);
230+
ServerListResponse servers = iaasApi.listServers(projectId, region, false, null);
223231
System.out.println("\nAvailable servers: ");
224232
for (Server server : servers.getItems()) {
225233
System.out.println("* " + server.getId() + " | " + server.getName());
226234
}
227235

228236
/* fetch the server we just created */
229-
Server fetchedServer = iaasApi.getServer(projectId, serverId, false);
237+
Server fetchedServer = iaasApi.getServer(projectId, region, serverId, false);
230238
System.out.println("\nFetched server:");
231239
System.out.println("* Name: " + fetchedServer.getName());
232240
System.out.println("* Id: " + fetchedServer.getId());
@@ -239,25 +247,27 @@ public static void main(String[] args) throws IOException {
239247
System.out.println("* Launched at: " + fetchedServer.getLaunchedAt());
240248

241249
/* stop the server we just created */
242-
iaasApi.stopServer(projectId, serverId);
250+
iaasApi.stopServer(projectId, region, serverId);
243251
/* wait for the server to stop */
244252
while (!Objects.equals(
245-
iaasApi.getServer(projectId, serverId, false).getPowerStatus(), "STOPPED")) {
253+
iaasApi.getServer(projectId, region, serverId, false).getPowerStatus(),
254+
"STOPPED")) {
246255
System.out.println("Waiting for server " + serverId + " to stop...");
247256
TimeUnit.SECONDS.sleep(5);
248257
}
249258

250259
/* boot the server we just created */
251-
iaasApi.startServer(projectId, serverId);
260+
iaasApi.startServer(projectId, region, serverId);
252261
/* wait for the server to boot */
253262
while (!Objects.equals(
254-
iaasApi.getServer(projectId, serverId, false).getPowerStatus(), "RUNNING")) {
263+
iaasApi.getServer(projectId, region, serverId, false).getPowerStatus(),
264+
"RUNNING")) {
255265
System.out.println("Waiting for server " + serverId + " to boot...");
256266
TimeUnit.SECONDS.sleep(5);
257267
}
258268

259269
/* reboot the server we just created */
260-
iaasApi.rebootServer(projectId, serverId, null);
270+
iaasApi.rebootServer(projectId, region, serverId, null);
261271

262272
/*
263273
* ///////////////////////////////////////////////////////
@@ -266,13 +276,13 @@ public static void main(String[] args) throws IOException {
266276
* */
267277

268278
/* delete the server we just created */
269-
iaasApi.deleteServer(projectId, serverId);
279+
iaasApi.deleteServer(projectId, region, serverId);
270280
System.out.println("Deleted server: " + serverId);
271281

272282
/* wait for server deletion to complete */
273283
while (true) {
274284
try {
275-
iaasApi.getServer(projectId, serverId, false);
285+
iaasApi.getServer(projectId, region, serverId, false);
276286
System.out.println("Waiting for server deletion to complete...");
277287
TimeUnit.SECONDS.sleep(5);
278288
} catch (ApiException e) {
@@ -287,8 +297,8 @@ public static void main(String[] args) throws IOException {
287297
System.out.println("Deleted key pair: " + newKeypair.getName());
288298

289299
/* delete the network we just created */
290-
iaasApi.deleteNetwork(projectId, newNetwork.getNetworkId());
291-
System.out.println("Deleted network: " + newNetwork.getNetworkId());
300+
iaasApi.deleteNetwork(projectId, region, newNetwork.getId());
301+
System.out.println("Deleted network: " + newNetwork.getId());
292302

293303
} catch (ApiException | InterruptedException e) {
294304
throw new RuntimeException(e);

services/iaas/CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
1+
## v1.0.0
2+
- **Breaking Change:** The region must be passed as a parameter to any region-specific request.
3+
- **Feature:** Add new methods to manage routing tables: `addRoutingTableToArea`, `deleteRoutingTableFromArea`, `getRoutingTableOfArea`, `listRoutingTablesOfArea`, `updateRoutingTableOfArea`
4+
- **Feature:** Add new methods to manage routes in routing tables: `addRoutesToRoutingTable`, `deleteRouteFromRoutingTable`, `getRouteOfRoutingTable`, `listRoutesOfRoutingTable`, `updateRouteOfRoutingTable`
5+
- **Breaking Change:** Add new method to manage network area regions: `createNetworkAreaRegion`, `deleteNetworkAreaRegion`, `getNetworkAreaRegion`, `listNetworkAreaRegions`, `updateNetworkAreaRegion`
6+
- **Feature:** Add new field `Encrypted` to `Backup` model, which indicates if a backup is encrypted
7+
- **Feature:** Add new field `ImportProgress` to `Image` model, which indicates the import progress of an image
8+
- **Breaking Change:** Remove field `addressFamily` in `CreateNetworkAreaPayload` model
9+
- **Breaking Change:** `Network` model has changed:
10+
- Rename `networkId` to `id`
11+
- Rename `state` to `status`
12+
- Move fields `gateway`, `nameservers`, `prefixes` and `publicIp` to new model `NetworkIPv4`, and can be accessed in the new field `ipv4`
13+
- Move fields `gatewayv6`, `nameserversv6` and `prefixesv6` to new model `NetworkIPv6`, and can be accessed in the new field `ipv6`
14+
- Add new field `routingTabledId`
15+
- **Breaking Change:** `NetworkArea` model has changed:
16+
- Rename `areaId` to `id`
17+
- Remove field `ipv4`
18+
- **Breaking Change:** Rename `networkRangeId` to `id` in `NetworkRange` model
19+
- **Breaking Change:** `CreateServerPayload` model has changed:
20+
- Model `CreateServerPayloadBootVolume` of `BootVolume` property changed to `ServerBootVolume`
21+
- Property `Networking` in `CreateServerPayload` is required now
22+
123
## v0.3.0
224
- **Feature:** Add `createdAt` and `updatedAt` attributes to `SecurityGroupRule`, `BaseSecurityGroupRule`, `CreateSecurityGroupRulePayload` model classes
325
- **Feature:** Add `description` attribute to `CreateNicPayload`, `NIC`, `UpdateNicPayload` model classes

services/iaas/VERSION

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

0 commit comments

Comments
 (0)