v1.14.7
This commit is contained in:
33
pkg/sdn/version/get.go
Normal file
33
pkg/sdn/version/get.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// Get gets SDN version info as a RecordVersion struct
|
||||
func (v Version) Get(ctx context.Context) (*RecordVersion, error) {
|
||||
res, err := v.GetRaw(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := RecordVersion{}
|
||||
|
||||
err = json.Unmarshal(res, &info)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
// GetRaw gets SDN version info as an array of bytes
|
||||
func (v Version) GetRaw(ctx context.Context) ([]byte, error) {
|
||||
|
||||
url := "/sdn/version/get"
|
||||
|
||||
res, err := v.client.DecortApiCall(ctx, http.MethodGet, url, nil)
|
||||
return res, err
|
||||
}
|
||||
Reference in New Issue
Block a user