You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
package vins
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
"encoding/json"
|
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
|
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// IPListRequest struct for DHCP IP
|
|
|
|
|
type IPListRequest struct {
|
|
|
|
|
// VINS ID
|
|
|
|
|
// Required: true
|
|
|
|
|
VINSID uint64 `url:"vinsId" json:"vinsId" validate:"required"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// IPList shows DHCP IP reservations on VINS
|
|
|
|
|
func (v VINS) IPList(ctx context.Context, req IPListRequest) (*ListIPs, error) {
|
|
|
|
|
err := validators.ValidateRequest(req)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
url := "/cloudapi/vins/ipList"
|
|
|
|
|
|
|
|
|
|
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
list := &ListIPs{}
|
|
|
|
|
|
|
|
|
|
err = json.Unmarshal(res, &list)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return list, nil
|
|
|
|
|
}
|