Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a85ad3acd5 |
@@ -1,9 +1,4 @@
|
|||||||
## Version 1.7.0
|
## Version 1.7.1
|
||||||
|
|
||||||
## Feature
|
|
||||||
- Added support for authorization using the Basis.Virtual Security system. Add client and config
|
|
||||||
|
|
||||||
## Bugfix
|
## Bugfix
|
||||||
- Add model ListInfoSnapshots in cloudapi/bservice/models
|
- Fix panic in clients
|
||||||
- Fix func SnapshotList for work with new model cloudapi/bservice/snapshot_list
|
|
||||||
- Add models ItemAffinityGroup, ListAffinityGroup in cloudapi/rg/models
|
|
||||||
|
|||||||
15
client.go
15
client.go
@@ -164,21 +164,20 @@ func (dc *DecortClient) do(req *http.Request, ctype string) (*http.Response, err
|
|||||||
// var resp *http.Response
|
// var resp *http.Response
|
||||||
// var err error
|
// var err error
|
||||||
buf, _ := io.ReadAll(req.Body)
|
buf, _ := io.ReadAll(req.Body)
|
||||||
// req = req.Clone(req.Context())
|
|
||||||
|
|
||||||
// for i := uint64(0); i < dc.cfg.Retries; i++ {
|
// for i := uint64(0); i < dc.cfg.Retries; i++ {
|
||||||
|
// req = req.Clone(req.Context())
|
||||||
req.Body = io.NopCloser(bytes.NewBuffer(buf))
|
req.Body = io.NopCloser(bytes.NewBuffer(buf))
|
||||||
resp, err := dc.client.Do(req)
|
resp, err := dc.client.Do(req)
|
||||||
|
if err == nil {
|
||||||
// if err == nil {
|
if resp.StatusCode == 200 {
|
||||||
if resp.StatusCode == 200 {
|
return resp, err
|
||||||
return resp, err
|
}
|
||||||
}
|
}
|
||||||
|
// }
|
||||||
respBytes, _ := io.ReadAll(resp.Body)
|
respBytes, _ := io.ReadAll(resp.Body)
|
||||||
err = fmt.Errorf("%s", respBytes)
|
err = fmt.Errorf("%s", respBytes)
|
||||||
resp.Body.Close()
|
resp.Body.Close()
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
return nil, fmt.Errorf("could not execute request: %w", err)
|
return nil, fmt.Errorf("could not execute request: %w", err)
|
||||||
}
|
}
|
||||||
@@ -404,7 +403,7 @@ func createK8sCloudBroker(req k8s_cb.CreateRequest) (*bytes.Buffer, string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_ = writer.WriteField("extnetOnly", strconv.FormatBool(req.ExtNetOnly))
|
_ = writer.WriteField("extnetOnly", strconv.FormatBool(req.ExtNetOnly))
|
||||||
|
|
||||||
ct := writer.FormDataContentType()
|
ct := writer.FormDataContentType()
|
||||||
|
|
||||||
writer.Close()
|
writer.Close()
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ func (bdc *BVSDecortClient) getToken(ctx context.Context) error {
|
|||||||
|
|
||||||
body := fmt.Sprintf("grant_type=password&client_id=%s&client_secret=%s&username=%s&password=%s&response_type=token&scope=openid", bdc.cfg.AppID, bdc.cfg.AppSecret, bdc.cfg.Username, bdc.cfg.Password)
|
body := fmt.Sprintf("grant_type=password&client_id=%s&client_secret=%s&username=%s&password=%s&response_type=token&scope=openid", bdc.cfg.AppID, bdc.cfg.AppSecret, bdc.cfg.Username, bdc.cfg.Password)
|
||||||
bodyReader := strings.NewReader(body)
|
bodyReader := strings.NewReader(body)
|
||||||
|
|
||||||
bdc.cfg.SSOURL = strings.TrimSuffix(bdc.cfg.SSOURL, "/")
|
bdc.cfg.SSOURL = strings.TrimSuffix(bdc.cfg.SSOURL, "/")
|
||||||
|
|
||||||
req, _ := http.NewRequestWithContext(ctx, "POST", bdc.cfg.SSOURL+"/realms/"+bdc.cfg.Domain+"/protocol/openid-connect/token", bodyReader)
|
req, _ := http.NewRequestWithContext(ctx, "POST", bdc.cfg.SSOURL+"/realms/"+bdc.cfg.Domain+"/protocol/openid-connect/token", bodyReader)
|
||||||
@@ -154,20 +154,20 @@ func (bdc *BVSDecortClient) do(req *http.Request, ctype string) (*http.Response,
|
|||||||
// var resp *http.Response
|
// var resp *http.Response
|
||||||
// var err error
|
// var err error
|
||||||
buf, _ := io.ReadAll(req.Body)
|
buf, _ := io.ReadAll(req.Body)
|
||||||
// req = req.Clone(req.Context())
|
|
||||||
|
|
||||||
// for i := uint64(0); i < dc.cfg.Retries; i++ {
|
// for i := uint64(0); i < bdc.cfg.Retries; i++ {
|
||||||
|
// req = req.Clone(req.Context())
|
||||||
req.Body = io.NopCloser(bytes.NewBuffer(buf))
|
req.Body = io.NopCloser(bytes.NewBuffer(buf))
|
||||||
resp, err := bdc.client.Do(req)
|
resp, err := bdc.client.Do(req)
|
||||||
// if err == nil {
|
if err == nil {
|
||||||
if resp.StatusCode == 200 {
|
if resp.StatusCode == 200 {
|
||||||
return resp, err
|
return resp, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
// }
|
||||||
respBytes, _ := io.ReadAll(resp.Body)
|
respBytes, _ := io.ReadAll(resp.Body)
|
||||||
err = fmt.Errorf("%s", respBytes)
|
err = fmt.Errorf("%s", respBytes)
|
||||||
resp.Body.Close()
|
resp.Body.Close()
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
return nil, fmt.Errorf("could not execute request: %w", err)
|
return nil, fmt.Errorf("could not execute request: %w", err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ func (ldc *LegacyDecortClient) DecortApiCall(ctx context.Context, method, url st
|
|||||||
|
|
||||||
k8sCaCreateReq, okCa := params.(k8s_ca.CreateRequest)
|
k8sCaCreateReq, okCa := params.(k8s_ca.CreateRequest)
|
||||||
k8sCbCreateReq, okCb := params.(k8s_cb.CreateRequest)
|
k8sCbCreateReq, okCb := params.(k8s_cb.CreateRequest)
|
||||||
|
|
||||||
var body *bytes.Buffer
|
var body *bytes.Buffer
|
||||||
var ctype string
|
var ctype string
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@ func (ldc *LegacyDecortClient) DecortApiCall(ctx context.Context, method, url st
|
|||||||
}
|
}
|
||||||
body = bytes.NewBufferString(values.Encode() + fmt.Sprintf("&authkey=%s", ldc.cfg.Token))
|
body = bytes.NewBufferString(values.Encode() + fmt.Sprintf("&authkey=%s", ldc.cfg.Token))
|
||||||
}
|
}
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, method, ldc.decortURL+restmachine+url, body)
|
req, err := http.NewRequestWithContext(ctx, method, ldc.decortURL+restmachine+url, body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -159,22 +159,20 @@ func (ldc *LegacyDecortClient) do(req *http.Request, ctype string) (*http.Respon
|
|||||||
// var resp *http.Response
|
// var resp *http.Response
|
||||||
// var err error
|
// var err error
|
||||||
buf, _ := io.ReadAll(req.Body)
|
buf, _ := io.ReadAll(req.Body)
|
||||||
// req = req.Clone(req.Context())
|
|
||||||
|
|
||||||
// for i := uint64(0); i < ldc.cfg.Retries; i++ {
|
// for i := uint64(0); i < ldc.cfg.Retries; i++ {
|
||||||
|
// req = req.Clone(req.Context())
|
||||||
req.Body = io.NopCloser(bytes.NewBuffer(buf))
|
req.Body = io.NopCloser(bytes.NewBuffer(buf))
|
||||||
resp, err := ldc.client.Do(req)
|
resp, err := ldc.client.Do(req)
|
||||||
|
if err == nil {
|
||||||
// if err == nil {
|
if resp.StatusCode == 200 {
|
||||||
if resp.StatusCode == 200 {
|
return resp, err
|
||||||
return resp, err
|
}
|
||||||
}
|
}
|
||||||
|
// }
|
||||||
respBytes, _ := io.ReadAll(resp.Body)
|
respBytes, _ := io.ReadAll(resp.Body)
|
||||||
err = fmt.Errorf("%s", respBytes)
|
err = fmt.Errorf("%s", respBytes)
|
||||||
resp.Body.Close()
|
resp.Body.Close()
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
return nil, fmt.Errorf("could not execute request: %w", err)
|
return nil, fmt.Errorf("could not execute request: %w", err)
|
||||||
}
|
}
|
||||||
@@ -402,7 +400,7 @@ func createK8sCloudBrokerLegacy(req k8s_cb.CreateRequest, token string) (*bytes.
|
|||||||
}
|
}
|
||||||
|
|
||||||
_ = writer.WriteField("extnetOnly", strconv.FormatBool(req.ExtNetOnly))
|
_ = writer.WriteField("extnetOnly", strconv.FormatBool(req.ExtNetOnly))
|
||||||
|
|
||||||
_ = writer.WriteField("authkey", token)
|
_ = writer.WriteField("authkey", token)
|
||||||
|
|
||||||
ct := writer.FormDataContentType()
|
ct := writer.FormDataContentType()
|
||||||
|
|||||||
Reference in New Issue
Block a user