Skip to content

Commit

Permalink
Add support for download-url function on node/storage (#110)
Browse files Browse the repository at this point in the history
* feat: Add function for download-url support on node storage

* feat: Add StorageDownloadURL struct & rename function

---------

Co-authored-by: alperencelik <alp.celik@axon-networks.com>
  • Loading branch information
alperencelik and alperencelik committed Jan 20, 2024
1 parent fbbb7c2 commit 7eebddd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,11 @@ func (n *Node) Storage(ctx context.Context, name string) (storage *Storage, err
return
}

func (n *Node) StorageDownloadURL(ctx context.Context, StorageDownloadURLOptions *StorageDownloadURLOptions) (ret string, err error) {
err = n.client.Post(ctx, fmt.Sprintf("/nodes/%s/storage/%s/download-url", n.Name, StorageDownloadURLOptions.Storage), StorageDownloadURLOptions, &ret)
return ret, err
}

func (n *Node) StorageISO(ctx context.Context) (*Storage, error) {
return n.findStorageByContent(ctx, "iso")
}
Expand Down
12 changes: 12 additions & 0 deletions types.go
Original file line number Diff line number Diff line change
Expand Up @@ -1133,3 +1133,15 @@ type ACLOptions struct {
Propagate IntOrBool `json:",omitempty"`
Delete IntOrBool `json:",omitempty"` // true to delete the ACL
}

type StorageDownloadURLOptions struct {
Content string `json:"content,omitempty"`
Filename string `json:"filename,omitempty"`
Node string `json:"node,omitempty"`
Storage string `json:"storage,omitempty"`
URL string `json:"url,omitempty"`
Checksum string `json:"checksum,omitempty"`
ChecksumAlgorithm string `json:"checksum-algorithm,omitempty"`
Compression string `json:"compression,omitempty"`
VerifyCertificates IntOrBool `json:"verify-certificates,omitempty"`
}

0 comments on commit 7eebddd

Please sign in to comment.