v1.8.0
This commit is contained in:
@@ -42,6 +42,10 @@ type CreateInAccountRequest struct {
|
||||
// Required: false
|
||||
Description string `url:"desc,omitempty" json:"desc,omitempty"`
|
||||
|
||||
// List of DNS ip address
|
||||
// Required: false
|
||||
DNSList []string `url:"dnsList" json:"dnsList,omitempty"`
|
||||
|
||||
// Number of pre created reservations
|
||||
// Required: false
|
||||
PreReservationsNum uint64 `url:"preReservationsNum,omitempty" json:"preReservationsNum,omitempty"`
|
||||
|
||||
@@ -36,6 +36,10 @@ type CreateInRGRequest struct {
|
||||
// Required: false
|
||||
Description string `url:"desc,omitempty" json:"desc,omitempty"`
|
||||
|
||||
// List of DNS ip address
|
||||
// Required: false
|
||||
DNSList []string `url:"dnsList" json:"dnsList,omitempty"`
|
||||
|
||||
// Number of pre created reservations
|
||||
// Required: false
|
||||
PreReservationsNum uint64 `url:"preReservationsNum,omitempty" json:"preReservationsNum,omitempty"`
|
||||
|
||||
43
pkg/cloudapi/vins/dns_apply.go
Normal file
43
pkg/cloudapi/vins/dns_apply.go
Normal 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: false
|
||||
DNSList []string `url:"dnsList" json:"dnsList"`
|
||||
}
|
||||
|
||||
// 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 := "/cloudapi/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
|
||||
|
||||
}
|
||||
@@ -26,6 +26,7 @@ type IPReleaseRequest struct {
|
||||
// IPRelese delete IP reservation matched by specified IP & MAC address combination.
|
||||
// If both IP and MAC address are empty strings, all IP reservations will be deleted.
|
||||
func (v VINS) IPRelese(ctx context.Context, req IPReleaseRequest) (bool, error) {
|
||||
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
|
||||
@@ -40,6 +40,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))
|
||||
|
||||
@@ -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 available for current user 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,11 @@ func (v VINS) List(ctx context.Context, req ListRequest) (*ListVINS, error) {
|
||||
|
||||
// ListRaw gets list of VINSes available for current user as an array of bytes
|
||||
func (v VINS) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||
|
||||
if err := validators.ValidateRequest(req); err != nil {
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudapi/vins/list"
|
||||
|
||||
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
|
||||
@@ -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,11 @@ type ListDeletedRequest struct {
|
||||
|
||||
// ListDeleted gets list of deleted VINSes available for current user
|
||||
func (v VINS) ListDeleted(ctx context.Context, req ListDeletedRequest) (*ListVINS, error) {
|
||||
|
||||
if err := validators.ValidateRequest(req); err != nil {
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudapi/vins/listDeleted"
|
||||
|
||||
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
|
||||
@@ -23,6 +23,12 @@ type ItemVINS struct {
|
||||
// External IP
|
||||
ExternalIP string `json:"externalIP"`
|
||||
|
||||
// Extnet ID
|
||||
ExtnetId uint64 `json:"extnetId"`
|
||||
|
||||
// Free IPs
|
||||
FreeIPs uint64 `json:"freeIPs"`
|
||||
|
||||
// ID
|
||||
ID uint64 `json:"id"`
|
||||
|
||||
@@ -53,8 +59,10 @@ type ItemVINS struct {
|
||||
|
||||
// List of VINSes
|
||||
type ListVINS struct {
|
||||
// Data
|
||||
Data []ItemVINS `json:"data"`
|
||||
|
||||
// Entry count
|
||||
EntryCount uint64 `json:"entryCount"`
|
||||
}
|
||||
|
||||
@@ -282,6 +290,9 @@ type ItemVNFInterface struct {
|
||||
// Network type
|
||||
NetType string `json:"netType"`
|
||||
|
||||
// NodeID
|
||||
NodeID int64 `json:"nodeId"`
|
||||
|
||||
// PCI slot
|
||||
PCISlot int64 `json:"pciSlot"`
|
||||
|
||||
|
||||
@@ -18,14 +18,14 @@ type NATRuleAddRequest struct {
|
||||
// Required: true
|
||||
IntIP string `url:"intIp" json:"intIp" validate:"required"`
|
||||
|
||||
// Internal IP port number to use for this rule
|
||||
// Required: true
|
||||
IntPort uint `url:"intPort" json:"intPort" validate:"required"`
|
||||
|
||||
// External IP start port to use for this rule
|
||||
// Required: true
|
||||
ExtPortStart uint `url:"extPortStart" json:"extPortStart" validate:"required"`
|
||||
|
||||
// Internal IP port number to use for this rule
|
||||
// Required: false
|
||||
IntPort uint `url:"intPort,omitempty" json:"intPort,omitempty"`
|
||||
|
||||
// External IP end port to use for this rule
|
||||
// Required: false
|
||||
ExtPortEnd uint `url:"extPortEnd,omitempty" json:"extPortEnd,omitempty"`
|
||||
|
||||
Reference in New Issue
Block a user