This commit is contained in:
stSolo
2022-12-22 17:56:47 +03:00
parent 8712561853
commit d4b1ab7133
672 changed files with 28509 additions and 4419 deletions

View File

@@ -6,27 +6,40 @@ import (
"net/http"
)
// Request struct for search VINSes
type SearchRequest struct {
// ID of the account to search for the ViNSes
// Required: false
AccountID uint64 `url:"accountId,omitempty"`
RGID uint64 `url:"rgId,omitempty"`
Name string `url:"name,omitempty"`
ShowAll bool `url:"show_all,omitempty"`
// ID of the resource group to limit search to the specified RG level only
// Required: false
RGID uint64 `url:"rgId,omitempty"`
// Name of the ViNS to search for
// Required: false
Name string `url:"name,omitempty"`
// If False, then VINSes having one of the statuses are not listed for
// Required: false
ShowAll bool `url:"show_all,omitempty"`
}
func (v VINS) Search(ctx context.Context, req SearchRequest) (VINSList, error) {
// Search search VINSes
func (v VINS) Search(ctx context.Context, req SearchRequest) (ListVINS, error) {
url := "/cloudapi/vins/search"
VINSListRaw, err := v.client.DecortApiCall(ctx, http.MethodPost, url, req)
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return nil, err
}
VINSList := VINSList{}
err = json.Unmarshal(VINSListRaw, &VINSList)
list := ListVINS{}
err = json.Unmarshal(res, &list)
if err != nil {
return nil, err
}
return VINSList, nil
return list, nil
}