diff --git a/hcloud/schema.go b/hcloud/schema.go index 09c03864..f89d5534 100644 --- a/hcloud/schema.go +++ b/hcloud/schema.go @@ -380,6 +380,7 @@ func VolumeFromSchema(s schema.Volume) *Volume { Name: s.Name, Location: LocationFromSchema(s.Location), Size: s.Size, + Format: s.Format, Status: VolumeStatus(s.Status), LinuxDevice: s.LinuxDevice, Protection: VolumeProtection{ diff --git a/hcloud/schema/volume.go b/hcloud/schema/volume.go index ad745ea9..19c741c1 100644 --- a/hcloud/schema/volume.go +++ b/hcloud/schema/volume.go @@ -10,6 +10,7 @@ type Volume struct { Status string `json:"status"` Location Location `json:"location"` Size int `json:"size"` + Format *string `json:"format"` Protection VolumeProtection `json:"protection"` Labels map[string]string `json:"labels"` LinuxDevice string `json:"linux_device"` diff --git a/hcloud/schema_test.go b/hcloud/schema_test.go index e5ac9b2f..6a12f282 100644 --- a/hcloud/schema_test.go +++ b/hcloud/schema_test.go @@ -1235,6 +1235,7 @@ func TestVolumeFromSchema(t *testing.T) { "name": "db-storage", "status": "creating", "server": 2, + "format": "xfs", "location": { "id": 1, "name": "fsn1", @@ -1277,6 +1278,9 @@ func TestVolumeFromSchema(t *testing.T) { if volume.Server != nil && volume.Server.ID != 2 { t.Errorf("unexpected server ID: %v", volume.Server.ID) } + if volume.Format == nil || *volume.Format != "xfs" { + t.Errorf("unexpected format: %v", volume.Format) + } if volume.Location == nil || volume.Location.ID != 1 { t.Errorf("unexpected location: %v", volume.Location) } diff --git a/hcloud/volume.go b/hcloud/volume.go index 3548165e..747c17de 100644 --- a/hcloud/volume.go +++ b/hcloud/volume.go @@ -21,12 +21,18 @@ type Volume struct { Server *Server Location *Location Size int + Format *string Protection VolumeProtection Labels map[string]string LinuxDevice string Created time.Time } +const ( + VolumeFormatExt4 = "ext4" + VolumeFormatXFS = "xfs" +) + // VolumeProtection represents the protection level of a volume. type VolumeProtection struct { Delete bool