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.
dynamix-golang-sdk/pkg/cloudapi/vins/ip_list.go

41 lines
815 B

2 months ago
package vins
import (
"context"
"encoding/json"
"net/http"
1 month ago
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
2 months ago
)
// 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
}