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.
decort-golang-sdk/pkg/cloudbroker/extnet/del_reserved_ip.go

51 lines
1.4 KiB

package extnet
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// DelReserveIPRequest struct to delete reserved address or address poll
type DelReserveIPRequest struct {
// AccountID to which a reserved address or address pool is added
// Required: true
AccountID uint64 `url:"accountId" json:"accountId" validate:"required"`
// ExtNetID from which the address or address pool is reserved
// Required: true
ExtNetID uint64 `url:"extnetId" json:"extnetId" validate:"required"`
// Field for specifying the number of reserved addresses
// Required: false
IPCount uint64 `url:"ipCount,omitempty" json:"ipCount,omitempty"`
// List of IPs for specifying the desired address
// Required: false
IPs []string `url:"ips,omitempty" json:"ips,omitempty"`
}
// DelReserveIP deletes reserved address or address poll to external network for account ID
func (e ExtNet) DelReserveIP(ctx context.Context, req DelReserveIPRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/extnet/delReservedIp"
res, err := e.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return false, err
}
result, err := strconv.ParseBool(string(res))
if err != nil {
return false, err
}
return result, nil
}