Skip to content

Commit a1efdd1

Browse files
author
Ferran Pons Serra
committed
feat(csharp): expose snapshot imageUri in the C# SDK
Add ImageUri to the SnapshotInfo model and parse imageUri from the response in SandboxesAdapter.
1 parent 41834eb commit a1efdd1

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

sdks/sandbox/csharp/src/OpenSandbox/Adapters/SandboxesAdapter.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,10 @@ private static SnapshotInfo ParseSnapshotInfo(JsonElement element)
418418
? ParseIsoDate("lastTransitionAt", lastTransitionAt)
419419
: null
420420
},
421-
CreatedAt = ParseIsoDate("createdAt", element.GetProperty("createdAt"))
421+
CreatedAt = ParseIsoDate("createdAt", element.GetProperty("createdAt")),
422+
ImageUri = element.TryGetProperty("imageUri", out var imageUri) && imageUri.ValueKind != JsonValueKind.Null
423+
? imageUri.GetString()
424+
: null
422425
};
423426
}
424427

sdks/sandbox/csharp/src/OpenSandbox/Models/Sandboxes.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -974,6 +974,13 @@ public class SnapshotInfo
974974

975975
[JsonPropertyName("createdAt")]
976976
public required DateTime CreatedAt { get; set; }
977+
978+
/// <summary>
979+
/// Portable OCI image reference for a Ready snapshot, usable to restore a sandbox (e.g. across
980+
/// clusters). Populated once the snapshot is Ready; null otherwise.
981+
/// </summary>
982+
[JsonPropertyName("imageUri")]
983+
public string? ImageUri { get; set; }
977984
}
978985

979986
/// <summary>

0 commit comments

Comments
 (0)