v1.5.0-delta

This commit is contained in:
Никита Сорокин
2023-07-13 15:28:07 +03:00
parent 7c787f6fce
commit 5025a17ea4
71 changed files with 1602 additions and 936 deletions

View File

@@ -6,11 +6,41 @@ import (
"net/http"
)
type ListRequest struct {
// Find by id
// Required: false
ByID uint64 `url:"by_id,omitempty" json:"by_id,omitempty"`
// Find by computeId
// Required: false
ComputeID uint64 `url:"computeId,omitempty" json:"computeId,omitempty"`
// Find by name
// Required: false
Name string `url:"name,omitempty" json:"name,omitempty"`
// Find by rgId
// Required: false
RGID uint64 `url:"rgId,omitempty" json:"rgId,omitempty"`
// Find by status
// Required: false
Status string `url:"status,omitempty" json:"status,omitempty"`
// Page number
// Required: false
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
// Page size
// Required: false
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
}
// List gets list all pci devices
func (p PCIDevice) List(ctx context.Context) (ListPCIDevices, error) {
func (p PCIDevice) List(ctx context.Context, req ListRequest) (*ListPCIDevices, error) {
url := "/cloudbroker/pcidevice/list"
res, err := p.client.DecortApiCall(ctx, http.MethodPost, url, nil)
res, err := p.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return nil, err
}
@@ -22,5 +52,5 @@ func (p PCIDevice) List(ctx context.Context) (ListPCIDevices, error) {
return nil, err
}
return list, nil
return &list, nil
}

View File

@@ -40,4 +40,11 @@ type ItemPCIDevice struct {
}
// List PCI devices
type ListPCIDevices []ItemPCIDevice
type ListPCIDevices struct {
// Data
Data []ItemPCIDevice `json:"data"`
// Entry count
EntryCount uint64 `json:"entryCount"`
}

View File

@@ -11,7 +11,7 @@ import (
// - First argument -> prefix
// - Second argument -> indent
func (l ListPCIDevices) Serialize(params ...string) (serialization.Serialized, error) {
if len(l) == 0 {
if len(l.Data) == 0 {
return []byte{}, nil
}