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/ips_exclude.go

43 lines
995 B

3 years ago
package extnet
import (
"context"
"net/http"
"strconv"
3 years ago
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
3 years ago
)
2 years ago
// IPsExcludeRequest struct to exclude list of IPs
3 years ago
type IPsExcludeRequest struct {
// ID of external network
// Required: true
3 years ago
NetID uint64 `url:"net_id" json:"net_id" validate:"required"`
3 years ago
// List of IPs for exclude from external network
// Required: true
3 years ago
IPs []string `url:"ips" json:"ips" validate:"min=1"`
3 years ago
}
2 years ago
// IPsExclude excludes list of IPs from external network pool
3 years ago
func (e ExtNet) IPsExclude(ctx context.Context, req IPsExcludeRequest) (bool, error) {
3 years ago
err := validators.ValidateRequest(req)
3 years ago
if err != nil {
2 years ago
return false, validators.ValidationErrors(validators.GetErrors(err))
3 years ago
}
url := "/cloudbroker/extnet/ipsExclude"
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
}