Skip to content

Commit

Permalink
Add retention days to volume snapshots (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdfly committed May 8, 2024
1 parent acab0fd commit 9c32a87
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
2 changes: 2 additions & 0 deletions resource_volumes.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ query GetSnapshotsFromVolume($id: ID!) {
size
digest
createdAt
retentionDays
}
}
}
Expand All @@ -86,6 +87,7 @@ query GetSnapshotsFromVolume($id: ID!) {
}
var snapshots []VolumeSnapshot
for _, snapshot := range data.Volume.Snapshots.Nodes {
snapshot.Status = "created"
snapshots = append(snapshots, NewVolumeSnapshotFrom(snapshot))
}
return snapshots, nil
Expand Down
22 changes: 12 additions & 10 deletions volume_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,21 @@ type UpdateVolumeRequest struct {
}

type VolumeSnapshot struct {
ID string `json:"id"`
Size int `json:"size"`
Digest string `json:"digest"`
CreatedAt time.Time `json:"created_at"`
Status string `json:"status"`
ID string `json:"id"`
Size int `json:"size"`
Digest string `json:"digest"`
CreatedAt time.Time `json:"created_at"`
Status string `json:"status"`
RetentionDays *int `json:"retention_days"`
}

type VolumeSnapshotGql struct {
ID string `json:"id"`
Size string `json:"size"`
Digest string `json:"digest"`
CreatedAt time.Time `json:"createdAt"`
Status string `json:"status"`
ID string `json:"id"`
Size string `json:"size"`
Digest string `json:"digest"`
CreatedAt time.Time `json:"createdAt"`
Status string `json:"status"`
RetentionDays *int `json:"retentionDays"`
}

func NewVolumeSnapshotFrom(v VolumeSnapshotGql) VolumeSnapshot {
Expand Down

0 comments on commit 9c32a87

Please sign in to comment.