File tree Expand file tree Collapse file tree
examples/src/main/java/sh/createos/examples Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33All notable changes will be documented here. This project follows Semantic
44Versioning and the Keep a Changelog structure.
55
6+ ## Unreleased
7+
8+ ### Fixed
9+
10+ - Detach network members before deleting the network in the example.
11+ - Allow more time to create a sandbox from a custom template in the example.
12+
613## 0.1.1 - 2026-09-17
714
815### Fixed
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ private CustomTemplate() {}
2727
2828 /** Runs the example. */
2929 public static void main (String [] arguments ) throws InterruptedException {
30- CreateOsClient client = CreateOsClient .builder ().build ();
30+ CreateOsClient client = CreateOsClient .builder ().timeout ( Duration . ofMinutes ( 5 )). build ();
3131 Template template =
3232 client
3333 .templates ()
Original file line number Diff line number Diff line change @@ -15,11 +15,13 @@ public static void main(String[] arguments) {
1515 CreateOsClient client = CreateOsClient .builder ().build ();
1616 Network network = client .networks ().create ("java-sdk-" + Instant .now ().getEpochSecond ());
1717 Sandbox sandbox = null ;
18+ boolean attached = false ;
1819 try {
1920 sandbox =
2021 client .createSandbox (
2122 CreateSandboxRequest .builder ("s-1vcpu-1gb" ).rootFileSystem ("devbox:1" ).build ());
2223 sandbox .attachNetwork (network .id ());
24+ attached = true ;
2325 Network connected = client .networks ().get (network .id ());
2426 String sandboxId = sandbox .id ();
2527 Network .Member member =
@@ -31,10 +33,19 @@ public static void main(String[] arguments) {
3133 "verified member: sandbox=%s ip=%s status=%s%n" ,
3234 member .sandboxId (), member .ipAddress (), member .status ());
3335 } finally {
34- if (sandbox != null ) {
35- sandbox .destroy ();
36+ try {
37+ if (sandbox != null && attached ) {
38+ sandbox .detachNetwork (network .id ());
39+ }
40+ } finally {
41+ try {
42+ if (sandbox != null ) {
43+ sandbox .destroy ();
44+ }
45+ } finally {
46+ client .networks ().delete (network .id ());
47+ }
3648 }
37- client .networks ().delete (network .id ());
3849 }
3950 }
4051}
You can’t perform that action at this time.
0 commit comments