feat: firecracker mmds identity

This commit is contained in:
Harivansh Rathi 2026-04-10 00:53:47 +00:00
parent 500354cd9b
commit 3eb610b703
23 changed files with 1813 additions and 263 deletions

View file

@ -4,10 +4,31 @@ import "time"
type SnapshotID string
type SnapshotArtifactKind string
const (
SnapshotArtifactKindMemory SnapshotArtifactKind = "memory"
SnapshotArtifactKindVMState SnapshotArtifactKind = "vmstate"
SnapshotArtifactKindDisk SnapshotArtifactKind = "disk"
SnapshotArtifactKindManifest SnapshotArtifactKind = "manifest"
)
type Snapshot struct {
ID SnapshotID `json:"id"`
MachineID MachineID `json:"machine_id"`
CreatedAt time.Time `json:"created_at"`
ID SnapshotID `json:"id"`
MachineID MachineID `json:"machine_id"`
SourceRuntimeHost string `json:"source_runtime_host,omitempty"`
SourceTapDevice string `json:"source_tap_device,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
type SnapshotArtifact struct {
ID string `json:"id"`
Kind SnapshotArtifactKind `json:"kind"`
Name string `json:"name"`
SizeBytes int64 `json:"size_bytes"`
SHA256Hex string `json:"sha256_hex,omitempty"`
ObjectKey string `json:"object_key,omitempty"`
DownloadURL string `json:"download_url,omitempty"`
}
type CreateSnapshotRequest struct {
@ -15,7 +36,8 @@ type CreateSnapshotRequest struct {
}
type CreateSnapshotResponse struct {
Snapshot Snapshot `json:"snapshot"`
Snapshot Snapshot `json:"snapshot"`
Artifacts []SnapshotArtifact `json:"artifacts,omitempty"`
}
type GetSnapshotResponse struct {
@ -26,8 +48,52 @@ type ListSnapshotsResponse struct {
Snapshots []Snapshot `json:"snapshots"`
}
type SnapshotUploadPart struct {
PartNumber int32 `json:"part_number"`
OffsetBytes int64 `json:"offset_bytes"`
SizeBytes int64 `json:"size_bytes"`
UploadURL string `json:"upload_url"`
}
type SnapshotArtifactUploadSession struct {
ArtifactID string `json:"artifact_id"`
ObjectKey string `json:"object_key"`
UploadID string `json:"upload_id"`
Parts []SnapshotUploadPart `json:"parts"`
}
type UploadSnapshotRequest struct {
Artifacts []SnapshotArtifactUploadSession `json:"artifacts"`
}
type UploadedSnapshotPart struct {
PartNumber int32 `json:"part_number"`
ETag string `json:"etag"`
}
type UploadedSnapshotArtifact struct {
ArtifactID string `json:"artifact_id"`
CompletedParts []UploadedSnapshotPart `json:"completed_parts"`
}
type UploadSnapshotResponse struct {
Artifacts []UploadedSnapshotArtifact `json:"artifacts"`
}
type RestoreSnapshotRequest struct {
MachineID MachineID `json:"machine_id"`
MachineID MachineID `json:"machine_id"`
Artifact ArtifactRef `json:"artifact"`
Snapshot DurableSnapshotSpec `json:"snapshot"`
GuestConfig *GuestConfig `json:"guest_config,omitempty"`
}
type DurableSnapshotSpec struct {
SnapshotID SnapshotID `json:"snapshot_id"`
MachineID MachineID `json:"machine_id"`
ImageID string `json:"image_id"`
SourceRuntimeHost string `json:"source_runtime_host,omitempty"`
SourceTapDevice string `json:"source_tap_device,omitempty"`
Artifacts []SnapshotArtifact `json:"artifacts"`
}
type RestoreSnapshotResponse struct {