Compare commits
3 Commits
v1.6.0-zet
...
v1.6.0-bet
| Author | SHA1 | Date | |
|---|---|---|---|
| afcbc7e749 | |||
| 0b3de4df7f | |||
| c0608d08b9 |
@@ -1,6 +1,4 @@
|
||||
## Version 1.5.7
|
||||
## Version 1.6.0-beta
|
||||
|
||||
### Bugfix
|
||||
- Remove the required tag of the start field in the CreateRequest model in cb/lb/create, since it is impossible to create an lb without starting it
|
||||
- Fix model the RecordGrid, add the ItemGridList model to cloudbroker/grid/models to correctly receive information on get and list requests
|
||||
- Fix tag json field GID in model RecordResourcesConsumption cb/grid/models
|
||||
- Fixed RoudTrip bug in HTTP transport, made it concurrent safe
|
||||
@@ -3,6 +3,7 @@ package client
|
||||
import (
|
||||
"crypto/tls"
|
||||
"net/http"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/config"
|
||||
@@ -32,6 +33,7 @@ func NewHttpClient(cfg config.Config) *http.Client {
|
||||
ssoURL: cfg.SSOURL,
|
||||
token: cfg.Token,
|
||||
expiryTime: expiredTime,
|
||||
mutex: &sync.Mutex{},
|
||||
//TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
|
||||
},
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"crypto/tls"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/config"
|
||||
@@ -33,6 +34,7 @@ func NewLegacyHttpClient(cfg config.LegacyConfig) *http.Client {
|
||||
token: cfg.Token,
|
||||
decortURL: cfg.DecortURL,
|
||||
expiryTime: expiredTime,
|
||||
mutex: &sync.Mutex{},
|
||||
},
|
||||
|
||||
Timeout: cfg.Timeout.Get(),
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"io"
|
||||
"net/http"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -15,6 +16,7 @@ type transportLegacy struct {
|
||||
retries uint64
|
||||
token string
|
||||
decortURL string
|
||||
mutex *sync.Mutex
|
||||
expiryTime time.Time
|
||||
}
|
||||
|
||||
@@ -56,7 +58,9 @@ func (t *transportLegacy) RoundTrip(request *http.Request) (*http.Response, erro
|
||||
var resp *http.Response
|
||||
var err error
|
||||
for i := uint64(0); i < t.retries; i++ {
|
||||
t.mutex.Lock()
|
||||
resp, err = t.base.RoundTrip(req)
|
||||
t.mutex.Unlock()
|
||||
if err == nil {
|
||||
if resp.StatusCode == 200 {
|
||||
return resp, nil
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"io"
|
||||
"net/http"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -16,6 +17,7 @@ type transport struct {
|
||||
token string
|
||||
ssoURL string
|
||||
expiryTime time.Time
|
||||
mutex *sync.Mutex
|
||||
}
|
||||
|
||||
func (t *transport) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||
@@ -53,7 +55,9 @@ func (t *transport) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||
var resp *http.Response
|
||||
var err error
|
||||
for i := uint64(0); i < t.retries; i++ {
|
||||
t.mutex.Lock()
|
||||
resp, err = t.base.RoundTrip(req)
|
||||
t.mutex.Unlock()
|
||||
if err == nil {
|
||||
if resp.StatusCode == 200 {
|
||||
return resp, nil
|
||||
@@ -65,5 +69,6 @@ func (t *transport) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||
//logrus.Errorf("Could not execute request: %v. Retrying %d/%d", err, i+1, t.retries)
|
||||
time.Sleep(time.Second * 5)
|
||||
}
|
||||
|
||||
return nil, fmt.Errorf("could not execute request: %w", err)
|
||||
}
|
||||
|
||||
@@ -106,6 +106,10 @@ type CreateRequest struct {
|
||||
// Text description of this Kubernetes cluster
|
||||
// Required: false
|
||||
Description string `url:"desc,omitempty" json:"desc,omitempty"`
|
||||
|
||||
//Use only selected ExtNet for infrastructure connections
|
||||
// Required: false
|
||||
ExtNetOnly bool `url:"extnetOnly,omitempty" json:"extnetOnly,omitempty"`
|
||||
}
|
||||
|
||||
// Create creates a new Kubernetes cluster in the specified Resource Group
|
||||
|
||||
@@ -2,6 +2,7 @@ package lb
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
@@ -20,16 +21,16 @@ type CreateRequest struct {
|
||||
Name string `url:"name" json:"name" validate:"required"`
|
||||
|
||||
// External network to connect this load balancer to
|
||||
// Required: true
|
||||
ExtNetID uint64 `url:"extnetId" json:"extnetId" validate:"required"`
|
||||
// Required: false
|
||||
ExtNetID uint64 `url:"extnetId" json:"extnetId"`
|
||||
|
||||
// Internal network (VINS) to connect this load balancer to
|
||||
// Required: true
|
||||
VINSID uint64 `url:"vinsId" json:"vinsId" validate:"required"`
|
||||
// Required: false
|
||||
VINSID uint64 `url:"vinsId" json:"vinsId"`
|
||||
|
||||
// Start now Load balancer
|
||||
// Required: true
|
||||
Start bool `url:"start" json:"start" validate:"required"`
|
||||
// Required: false
|
||||
Start bool `url:"start" json:"start"`
|
||||
|
||||
// Text description of this load balancer
|
||||
// Required: false
|
||||
@@ -45,6 +46,10 @@ func (l LB) Create(ctx context.Context, req CreateRequest) (string, error) {
|
||||
}
|
||||
}
|
||||
|
||||
if req.ExtNetID == 0 && req.VINSID == 0 {
|
||||
return "", errors.New ("vinsId and extNetId cannot be both in the value 0")
|
||||
}
|
||||
|
||||
url := "/cloudapi/lb/create"
|
||||
|
||||
res, err := l.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
|
||||
Reference in New Issue
Block a user