Skip to content

Commit

Permalink
feat: add volume format property (#397)
Browse files Browse the repository at this point in the history
This property was previously missing, although it was already used in
VolumeCreateOpts. It's now a string pointer with common values (ext4 and
xfs) available as string constants.

---------

Co-authored-by: pauhull <[email protected]>
Co-authored-by: Jonas L. <[email protected]>
  • Loading branch information
3 people authored Mar 7, 2024
1 parent 49be506 commit c0940af
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions hcloud/schema/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
1 change: 1 addition & 0 deletions hcloud/schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,7 @@ func TestVolumeSchema(t *testing.T) {
"name": "db-storage",
"status": "creating",
"server": 2,
"format": "xfs",
"location": {
"id": 1,
"name": "fsn1",
Expand Down
6 changes: 6 additions & 0 deletions hcloud/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions hcloud/zz_schema.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c0940af

Please sign in to comment.