v1.10.0
This commit is contained in:
50
pkg/cloudbroker/extnet/del_reserved_ip.go
Normal file
50
pkg/cloudbroker/extnet/del_reserved_ip.go
Normal file
@@ -0,0 +1,50 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user