Skip to content

Commit 7d43d0f

Browse files
authored
Add StorageContentGet function (#111)
* feat: Add StorageContentGet function * fix: Move getContent function to storage * fix: update GetContent method include node parameter --------- Co-authored-by: alperencelik <alp.celik@axon-networks.com>
1 parent 7eebddd commit 7d43d0f

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

storage.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@ func (s *Storage) downloadURL(ctx context.Context, content, filename, url string
107107
return NewTask(upid, s.client), nil
108108
}
109109

110+
func (s *Storage) GetContent(ctx context.Context) (content *StorageContent, err error) {
111+
err = s.client.Get(ctx, fmt.Sprintf("/nodes/%s/storage/%s/content", s.Node, s.Name), &content)
112+
return content, err
113+
}
114+
110115
func (s *Storage) ISO(ctx context.Context, name string) (iso *ISO, err error) {
111116
err = s.client.Get(ctx, fmt.Sprintf("/nodes/%s/storage/%s/content/%s:%s/%s", s.Node, s.Name, s.Name, "iso", name), &iso)
112117
if err != nil {

types.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,3 +1145,17 @@ type StorageDownloadURLOptions struct {
11451145
Compression string `json:"compression,omitempty"`
11461146
VerifyCertificates IntOrBool `json:"verify-certificates,omitempty"`
11471147
}
1148+
1149+
type StorageContent struct {
1150+
Format string `json:"format,omitempty"`
1151+
Size uint64 `json:"size,omitempty"`
1152+
Volid string `json:"volid,omitempty"`
1153+
Ctime uint64 `json:"ctime,omitempty"`
1154+
Encryption string `json:"encryption,omitempty"`
1155+
Notes string `json:"notes,omitempty"`
1156+
Parent string `json:"parent,omitempty"`
1157+
Protection bool `json:"protection,omitempty"`
1158+
Used uint64 `json:"used,omitempty"`
1159+
Verification string `json:"verification,omitempty"`
1160+
VMID uint64 `json:"vmid,omitempty"`
1161+
}

0 commit comments

Comments
 (0)