v9.0.0
This commit is contained in:
45
pkg/cloudbroker/vins/search.go
Normal file
45
pkg/cloudbroker/vins/search.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package vins
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// SearchRequest struct to search VINSes
|
||||
type SearchRequest struct {
|
||||
// ID of the account to search for the ViNSes
|
||||
// Required: false
|
||||
AccountID uint64 `url:"accountId,omitempty" json:"accountId,omitempty"`
|
||||
|
||||
// ID of the resource group to limit search to the specified RG level only
|
||||
// Required: false
|
||||
RGID uint64 `url:"rgId,omitempty" json:"rgId,omitempty"`
|
||||
|
||||
// Name of the ViNS to search for
|
||||
// Required: false
|
||||
Name string `url:"name,omitempty" json:"name,omitempty"`
|
||||
|
||||
// If False, then VINSes having one of the statuses are not listed for
|
||||
// Required: false
|
||||
ShowAll bool `url:"show_all,omitempty" json:"show_all,omitempty"`
|
||||
}
|
||||
|
||||
// Search searches VINSes
|
||||
func (v VINS) Search(ctx context.Context, req SearchRequest) (SearchVINS, error) {
|
||||
url := "/cloudbroker/vins/search"
|
||||
|
||||
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
list := SearchVINS{}
|
||||
|
||||
err = json.Unmarshal(res, &list)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return list, nil
|
||||
}
|
||||
Reference in New Issue
Block a user