Merge 'dev' into 'main'

This commit is contained in:
stSolo
2022-10-03 16:56:47 +03:00
parent 6271fa6d45
commit 5fd450382c
400 changed files with 14394 additions and 13407 deletions

View File

@@ -1,41 +1,39 @@
package k8ci
import (
"context"
"encoding/json"
"errors"
"github.com/rudecs/decort-sdk/opts"
"github.com/rudecs/decort-sdk/typed"
)
type GetRequest struct {
K8CIID uint64 `url:"k8ciId"`
}
func (krq GetRequest) Validate() error {
if krq.K8CIID == 0 {
return errors.New("field K8CIID can not be empty or equal to 0")
}
return nil
}
func (k K8CI) Get(ctx context.Context, req GetRequest, options ...opts.DecortOpts) (*K8CIRecord, error) {
if err := req.Validate(); err != nil {
return nil, err
}
url := "/cloudapi/k8ci/get"
k8ciRaw, err := k.client.DecortApiCall(ctx, typed.POST, url, req)
if err != nil {
return nil, err
}
k8ci := &K8CIRecord{}
if err := json.Unmarshal(k8ciRaw, k8ci); err != nil {
return nil, err
}
return k8ci, nil
}
package k8ci
import (
"context"
"encoding/json"
"errors"
"net/http"
)
type GetRequest struct {
K8CIID uint64 `url:"k8ciId"`
}
func (krq GetRequest) Validate() error {
if krq.K8CIID == 0 {
return errors.New("field K8CIID can not be empty or equal to 0")
}
return nil
}
func (k K8CI) Get(ctx context.Context, req GetRequest) (*K8CIRecord, error) {
if err := req.Validate(); err != nil {
return nil, err
}
url := "/cloudapi/k8ci/get"
k8ciRaw, err := k.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return nil, err
}
k8ci := &K8CIRecord{}
if err := json.Unmarshal(k8ciRaw, k8ci); err != nil {
return nil, err
}
return k8ci, nil
}