aboutsummaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorXe Iaso <me@xeiaso.net>2024-02-10 13:56:25 -0500
committerXe Iaso <me@xeiaso.net>2024-02-10 13:56:25 -0500
commit25dda40f959701a5c2e9125866b12762b596b032 (patch)
treec8590f395d4a17251c9dbbb4db725a464f1e4aa9 /web
parent4c5c287968863af8442f95931ef88de2f9f60e7a (diff)
downloadx-25dda40f959701a5c2e9125866b12762b596b032.tar.xz
x-25dda40f959701a5c2e9125866b12762b596b032.zip
web/fly/flymachines: make CreateVolume SizeGB optional
Signed-off-by: Xe Iaso <me@xeiaso.net>
Diffstat (limited to 'web')
-rw-r--r--web/fly/flymachines/volumes.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/web/fly/flymachines/volumes.go b/web/fly/flymachines/volumes.go
index b3d4c9c..a1db912 100644
--- a/web/fly/flymachines/volumes.go
+++ b/web/fly/flymachines/volumes.go
@@ -48,12 +48,19 @@ type CreateVolume struct {
Name string `json:"name,omitempty"`
Region string `json:"region,omitempty"`
RequireUniqueZone bool `json:"require_unique_zone"`
- SizeGB int `json:"size_gb"`
+ SizeGB int `json:"size_gb,omitempty"`
SnapshotID string `json:"snapshot_id,omitempty"`
SnapshotRetention int `json:"snapshot_retention"`
SourceVolumeID string `json:"source_volume_id,omitempty"`
}
+func (cv CreateVolume) Fork(vol *Volume) CreateVolume {
+ cv.SourceVolumeID = vol.ID
+ cv.SnapshotRetention = vol.SnapshotRetention
+ cv.FSType = vol.FSType
+ return cv
+}
+
func (c *Client) CreateVolume(ctx context.Context, appName string, cv CreateVolume) (*Volume, error) {
result, err := doJSONBody[CreateVolume, Volume](ctx, c, http.MethodPost, "/v1/apps/"+appName+"/volumes", cv, http.StatusOK)
if err != nil {