v1.6.6
This commit is contained in:
@@ -8,25 +8,16 @@ import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for get detailed information about kubernetes cluster
|
||||
// GetRequest struct to get detailed information about kubernetes cluster
|
||||
type GetRequest struct {
|
||||
// Kubernetes cluster ID
|
||||
// Required: true
|
||||
K8SID uint64 `url:"k8sId" json:"k8sId" validate:"required"`
|
||||
}
|
||||
|
||||
// Get gets information about Kubernetes cluster
|
||||
// Get gets information about Kubernetes cluster as a RecordK8S struct
|
||||
func (k8s K8S) Get(ctx context.Context, req GetRequest) (*RecordK8S, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudapi/k8s/get"
|
||||
|
||||
res, err := k8s.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := k8s.GetRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -40,3 +31,18 @@ func (k8s K8S) Get(ctx context.Context, req GetRequest) (*RecordK8S, error) {
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
// GetRaw gets information about Kubernetes cluster as an array of bytes
|
||||
func (k8s K8S) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudapi/k8s/get"
|
||||
|
||||
res, err := k8s.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// Request struct for get list information K8S
|
||||
// ListRequest struct to get list information K8S
|
||||
type ListRequest struct {
|
||||
// Find by ID
|
||||
// Required: false
|
||||
@@ -53,11 +53,9 @@ type ListRequest struct {
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
}
|
||||
|
||||
// List gets list all kubernetes clusters the user has access to
|
||||
// List gets list of all kubernetes clusters the user has access to as a ListK8SClusters
|
||||
func (k8s K8S) List(ctx context.Context, req ListRequest) (*ListK8SClusters, error) {
|
||||
url := "/cloudapi/k8s/list"
|
||||
|
||||
res, err := k8s.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := k8s.ListRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -71,3 +69,11 @@ func (k8s K8S) List(ctx context.Context, req ListRequest) (*ListK8SClusters, err
|
||||
|
||||
return &list, nil
|
||||
}
|
||||
|
||||
// ListRaw gets list of all kubernetes clusters the user has access to as an array of bytes
|
||||
func (k8s K8S) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||
url := "/cloudapi/k8s/list"
|
||||
|
||||
res, err := k8s.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user