This commit is contained in:
2024-04-16 14:26:06 +03:00
parent bc264c4d90
commit e7c968797b
298 changed files with 11066 additions and 398 deletions

View File

@@ -46,6 +46,10 @@ type CreateInAccountRequest struct {
// Required: false
PreReservationsNum uint64 `url:"preReservationsNum,omitempty" json:"preReservationsNum,omitempty"`
// List of DNS ip address
// Required: false
DNSList []string `url:"dnsList" json:"dnsList,omitempty"`
// List of static routes, each item must have destination, netmask, and gateway fields
// Required: false
Routes []Route `url:"-" json:"routes,omitempty" validate:"omitempty,dive"`

View File

@@ -40,6 +40,10 @@ type CreateInRGRequest struct {
// Required: false
PreReservationsNum uint64 `url:"preReservationsNum,omitempty" json:"preReservationsNum,omitempty"`
// List of DNS ip address
// Required: false
DNSList []string `url:"dnsList" json:"dnsList,omitempty"`
// List of static routes, each item must have destination, netmask, and gateway fields
// Required: false
Routes []Route `url:"-" json:"routes,omitempty" validate:"omitempty,dive"`

View File

@@ -20,7 +20,7 @@ type DefaultQOSUpdateRequest struct {
// Internal traffic burst, kbit
// Required: false
IngressBirst uint64 `url:"ingress_birst,omitempty" json:"ingress_birst,omitempty"`
IngressBirst uint64 `url:"ingress_burst,omitempty" json:"ingress_burst,omitempty"`
// External traffic rate, kbit
// Required: false

View File

@@ -0,0 +1,43 @@
package vins
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// DNSApplyRequest struct to apply new DNS list in VINS
type DNSApplyRequest struct {
// VINS ID
// Required: true
VINSID uint64 `url:"vinsId" json:"vinsId" validate:"required"`
// List of DNS ip address
// Required: true
DNSList []string `url:"dnsList" json:"dnsList" validate:"required"`
}
// DNSApply applies new DNS list in VINS
func (v VINS) DNSApply(ctx context.Context, req DNSApplyRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/vins/dnsApply"
res, err := v.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
}

View File

@@ -45,8 +45,8 @@ func (lr ListRoutes) IDs() []uint64 {
return res
}
// IDs gets array of NATRuleConfigIDs from ListNatRule struct
func (lnrc ListNatRule) IDs() []uint64 {
// IDs gets array of NATRuleConfigIDs from ListNATRule struct
func (lnrc ListNATRule) IDs() []uint64 {
res := make([]uint64, 0, len(lnrc))
for _, nrc := range lnrc {
res = append(res, nrc.ID)

View File

@@ -45,6 +45,7 @@ type IPReserveRequest struct {
// IPReserve creates reservation on ViNS DHCP
func (v VINS) IPReserve(ctx context.Context, req IPReserveRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))

View File

@@ -4,6 +4,8 @@ import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// ListRequest struct to get list of VINSes
@@ -32,6 +34,10 @@ type ListRequest struct {
// Required: false
IncludeDeleted bool `url:"includeDeleted,omitempty" json:"includeDeleted,omitempty"`
// Sort by one of supported fields, format +|-(field)
// Required: false
SortBy string `url:"sortBy,omitempty" json:"sortBy,omitempty" validate:"omitempty,sortBy"`
// Page number
// Required: false
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
@@ -43,6 +49,7 @@ type ListRequest struct {
// List gets list of VINSes as a ListVINS struct
func (v VINS) List(ctx context.Context, req ListRequest) (*ListVINS, error) {
res, err := v.ListRaw(ctx, req)
if err != nil {
return nil, err
@@ -60,6 +67,12 @@ func (v VINS) List(ctx context.Context, req ListRequest) (*ListVINS, error) {
// ListRaw gets list of VINSes as an array of bytes
func (v VINS) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
err := validators.ValidateRequest(req)
if err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/vins/list"
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, req)

View File

@@ -4,6 +4,8 @@ import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// ListDeletedRequest struct to get list of deleted VINSes
@@ -28,6 +30,10 @@ type ListDeletedRequest struct {
// Required: false
ExtIP string `url:"extIp,omitempty" json:"extIp,omitempty"`
// Sort by one of supported fields, format +|-(field)
// Required: false
SortBy string `url:"sortBy,omitempty" json:"sortBy,omitempty" validate:"omitempty,sortBy"`
// Page number
// Required: false
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
@@ -39,6 +45,12 @@ type ListDeletedRequest struct {
// ListDeleted gets list of deleted VINSes
func (v VINS) ListDeleted(ctx context.Context, req ListDeletedRequest) (*ListVINS, error) {
err := validators.ValidateRequest(req)
if err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/vins/listDeleted"
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, req)

View File

@@ -146,6 +146,9 @@ type ItemInterface struct {
// Network type
NetType string `json:"netType"`
// NodeID
NodeID int64 `json:"nodeId"`
// PCI slot
PCISlot int64 `json:"pciSlot"`
@@ -337,7 +340,7 @@ type RecordGW struct {
}
// List NATRules
type ListNatRule []ItemNATRule
type ListNATRule []ItemNATRule
// NAT config
type NATConfig struct {
@@ -348,7 +351,7 @@ type NATConfig struct {
Network string `json:"network"`
// Rules
Rules ListNatRule `json:"rules"`
Rules ListNATRule `json:"rules"`
}
// Main information about NAT
@@ -677,6 +680,12 @@ type ItemVINS struct {
// External IP
ExternalIP string `json:"externalIP"`
// Extnet ID
ExtnetId uint64 `json:"extnetId"`
// Free IPs
FreeIPs uint64 `json:"freeIPs"`
// Grid ID
GID uint64 `json:"gid"`

View File

@@ -16,16 +16,16 @@ type NATRuleAddRequest struct {
// Internal IP address to apply this rule to
// Required: true
IntIP string `url:"intIp " json:"intIp " validate:"required"`
// Internal IP port number to use for this rule
// Required: true
IntPort uint64 `url:"intPort" json:"intPort" validate:"required"`
IntIP string `url:"intIp" json:"intIp" validate:"required"`
// External IP start port to use for this rule
// Required: true
ExtPortStart uint64 `url:"extPortStart" json:"extPortStart" validate:"required"`
// Internal IP port number to use for this rule
// Required: false
IntPort uint64 `url:"intPort,omitempty" json:"intPort,omitempty"`
// External IP end port to use for this rule
// Required: false
ExtPortEnd uint64 `url:"extPortEnd,omitempty" json:"extPortEnd,omitempty"`

View File

@@ -20,7 +20,7 @@ type NetQOSRequest struct {
// Internal traffic burst, kbit
// Required: false
IngressBirst uint64 `url:"ingress_birst,omitempty" json:"ingress_birst,omitempty"`
IngressBirst uint64 `url:"ingress_burst,omitempty" json:"ingress_burst,omitempty"`
// External traffic rate, kbit
// Required: false