Merge 'dev' into 'main'
This commit is contained in:
@@ -3,10 +3,8 @@ package bservice
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/rudecs/decort-sdk/opts"
|
||||
"github.com/rudecs/decort-sdk/typed"
|
||||
)
|
||||
|
||||
type CreateRequest struct {
|
||||
@@ -28,13 +26,13 @@ func (bsrq CreateRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b BService) Create(ctx context.Context, req CreateRequest, options ...opts.DecortOpts) (uint64, error) {
|
||||
func (b BService) Create(ctx context.Context, req CreateRequest) (uint64, error) {
|
||||
if err := req.Validate(); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
url := "/cloudapi/bservice/create"
|
||||
res, err := b.client.DecortApiCall(ctx, typed.POST, url, req)
|
||||
res, err := b.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
@@ -3,10 +3,8 @@ package bservice
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/rudecs/decort-sdk/opts"
|
||||
"github.com/rudecs/decort-sdk/typed"
|
||||
)
|
||||
|
||||
type DeleteRequest struct {
|
||||
@@ -22,13 +20,13 @@ func (bsrq DeleteRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b BService) Delete(ctx context.Context, req DeleteRequest, options ...opts.DecortOpts) (bool, error) {
|
||||
func (b BService) Delete(ctx context.Context, req DeleteRequest) (bool, error) {
|
||||
if err := req.Validate(); err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
url := "/cloudapi/bservice/delete"
|
||||
res, err := b.client.DecortApiCall(ctx, typed.POST, url, req)
|
||||
res, err := b.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
@@ -3,10 +3,8 @@ package bservice
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/rudecs/decort-sdk/opts"
|
||||
"github.com/rudecs/decort-sdk/typed"
|
||||
)
|
||||
|
||||
type DisableRequest struct {
|
||||
@@ -21,13 +19,13 @@ func (bsrq DisableRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b BService) Disable(ctx context.Context, req DisableRequest, options ...opts.DecortOpts) (bool, error) {
|
||||
func (b BService) Disable(ctx context.Context, req DisableRequest) (bool, error) {
|
||||
if err := req.Validate(); err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
url := "/cloudapi/bservice/delete"
|
||||
res, err := b.client.DecortApiCall(ctx, typed.POST, url, req)
|
||||
res, err := b.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
@@ -3,10 +3,8 @@ package bservice
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/rudecs/decort-sdk/opts"
|
||||
"github.com/rudecs/decort-sdk/typed"
|
||||
)
|
||||
|
||||
type EnableRequest struct {
|
||||
@@ -21,13 +19,13 @@ func (bsrq EnableRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b BService) Enable(ctx context.Context, req EnableRequest, options ...opts.DecortOpts) (bool, error) {
|
||||
func (b BService) Enable(ctx context.Context, req EnableRequest) (bool, error) {
|
||||
if err := req.Validate(); err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
url := "/cloudapi/bservice/enable"
|
||||
res, err := b.client.DecortApiCall(ctx, typed.POST, url, req)
|
||||
res, err := b.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
@@ -4,9 +4,7 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
|
||||
"github.com/rudecs/decort-sdk/opts"
|
||||
"github.com/rudecs/decort-sdk/typed"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type GetRequest struct {
|
||||
@@ -21,13 +19,13 @@ func (bsrq GetRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b BService) Get(ctx context.Context, req GetRequest, options ...opts.DecortOpts) (*BasicService, error) {
|
||||
func (b BService) Get(ctx context.Context, req GetRequest) (*BasicService, error) {
|
||||
if err := req.Validate(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
url := "/cloudapi/bservice/get"
|
||||
bsRaw, err := b.client.DecortApiCall(ctx, typed.POST, url, req)
|
||||
bsRaw, err := b.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -3,10 +3,8 @@ package bservice
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/rudecs/decort-sdk/opts"
|
||||
"github.com/rudecs/decort-sdk/typed"
|
||||
)
|
||||
|
||||
type GroupAddRequest struct {
|
||||
@@ -20,7 +18,7 @@ type GroupAddRequest struct {
|
||||
Driver string `url:"driver"`
|
||||
Role string `url:"role,omitempty"`
|
||||
VINSes []uint64 `url:"vinses,omitempty"`
|
||||
Extnets []uint64 `url:"extnets,omitempty"`
|
||||
ExtNets []uint64 `url:"extnets,omitempty"`
|
||||
TimeoutStart uint64 `url:"timeoutStart"`
|
||||
}
|
||||
|
||||
@@ -60,13 +58,13 @@ func (bsrq GroupAddRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b BService) GroupAdd(ctx context.Context, req GroupAddRequest, options ...opts.DecortOpts) (uint64, error) {
|
||||
func (b BService) GroupAdd(ctx context.Context, req GroupAddRequest) (uint64, error) {
|
||||
if err := req.Validate(); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
url := "/cloudapi/bservice/groupAdd"
|
||||
res, err := b.client.DecortApiCall(ctx, typed.POST, url, req)
|
||||
res, err := b.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
@@ -3,10 +3,8 @@ package bservice
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/rudecs/decort-sdk/opts"
|
||||
"github.com/rudecs/decort-sdk/typed"
|
||||
)
|
||||
|
||||
type GroupComputeRemoveRequest struct {
|
||||
@@ -31,13 +29,13 @@ func (bsrq GroupComputeRemoveRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b BService) GroupComputeRemove(ctx context.Context, req GroupComputeRemoveRequest, options ...opts.DecortOpts) (bool, error) {
|
||||
func (b BService) GroupComputeRemove(ctx context.Context, req GroupComputeRemoveRequest) (bool, error) {
|
||||
if err := req.Validate(); err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
url := "/cloudapi/bservice/groupComputeRemove"
|
||||
res, err := b.client.DecortApiCall(ctx, typed.POST, url, req)
|
||||
res, err := b.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
@@ -4,9 +4,7 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
|
||||
"github.com/rudecs/decort-sdk/opts"
|
||||
"github.com/rudecs/decort-sdk/typed"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type GroupGetRequest struct {
|
||||
@@ -26,13 +24,13 @@ func (bsrq GroupGetRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b BService) GroupGet(ctx context.Context, req GroupGetRequest, options ...opts.DecortOpts) (*Group, error) {
|
||||
func (b BService) GroupGet(ctx context.Context, req GroupGetRequest) (*Group, error) {
|
||||
if err := req.Validate(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
url := "/cloudapi/bservice/groupGet"
|
||||
groupRaw, err := b.client.DecortApiCall(ctx, typed.POST, url, req)
|
||||
groupRaw, err := b.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -3,10 +3,8 @@ package bservice
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/rudecs/decort-sdk/opts"
|
||||
"github.com/rudecs/decort-sdk/typed"
|
||||
)
|
||||
|
||||
type GroupParentAddRequest struct {
|
||||
@@ -31,13 +29,13 @@ func (bsrq GroupParentAddRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b BService) GroupParentAdd(ctx context.Context, req GroupParentAddRequest, options ...opts.DecortOpts) (bool, error) {
|
||||
func (b BService) GroupParentAdd(ctx context.Context, req GroupParentAddRequest) (bool, error) {
|
||||
if err := req.Validate(); err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
url := "/cloudapi/bservice/groupParentAdd"
|
||||
res, err := b.client.DecortApiCall(ctx, typed.POST, url, req)
|
||||
res, err := b.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
@@ -3,10 +3,8 @@ package bservice
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/rudecs/decort-sdk/opts"
|
||||
"github.com/rudecs/decort-sdk/typed"
|
||||
)
|
||||
|
||||
type GroupParentRemoveRequest struct {
|
||||
@@ -31,13 +29,13 @@ func (bsrq GroupParentRemoveRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b BService) GroupParentRemove(ctx context.Context, req GroupParentRemoveRequest, options ...opts.DecortOpts) (bool, error) {
|
||||
func (b BService) GroupParentRemove(ctx context.Context, req GroupParentRemoveRequest) (bool, error) {
|
||||
if err := req.Validate(); err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
url := "/cloudapi/bservice/groupParentRemove"
|
||||
res, err := b.client.DecortApiCall(ctx, typed.POST, url, req)
|
||||
res, err := b.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
@@ -3,10 +3,8 @@ package bservice
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/rudecs/decort-sdk/opts"
|
||||
"github.com/rudecs/decort-sdk/typed"
|
||||
)
|
||||
|
||||
type GroupRemoveRequest struct {
|
||||
@@ -26,13 +24,13 @@ func (bsrq GroupRemoveRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b BService) GroupRemove(ctx context.Context, req GroupRemoveRequest, options ...opts.DecortOpts) (bool, error) {
|
||||
func (b BService) GroupRemove(ctx context.Context, req GroupRemoveRequest) (bool, error) {
|
||||
if err := req.Validate(); err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
url := "/cloudapi/bservice/groupRemove"
|
||||
res, err := b.client.DecortApiCall(ctx, typed.POST, url, req)
|
||||
res, err := b.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
|
||||
|
||||
@@ -3,11 +3,10 @@ package bservice
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/rudecs/decort-sdk/internal/validators"
|
||||
"github.com/rudecs/decort-sdk/opts"
|
||||
"github.com/rudecs/decort-sdk/typed"
|
||||
)
|
||||
|
||||
type GroupResizeRequest struct {
|
||||
@@ -37,13 +36,13 @@ func (bsrq GroupResizeRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b BService) GroupResize(ctx context.Context, req GroupResizeRequest, options ...opts.DecortOpts) (uint64, error) {
|
||||
func (b BService) GroupResize(ctx context.Context, req GroupResizeRequest) (uint64, error) {
|
||||
if err := req.Validate(); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
url := "/cloudapi/bservice/groupResize"
|
||||
res, err := b.client.DecortApiCall(ctx, typed.POST, url, req)
|
||||
res, err := b.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
@@ -3,10 +3,8 @@ package bservice
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/rudecs/decort-sdk/opts"
|
||||
"github.com/rudecs/decort-sdk/typed"
|
||||
)
|
||||
|
||||
type GroupStartRequest struct {
|
||||
@@ -26,13 +24,13 @@ func (bsrq GroupStartRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b BService) GroupStart(ctx context.Context, req GroupStartRequest, options ...opts.DecortOpts) (bool, error) {
|
||||
func (b BService) GroupStart(ctx context.Context, req GroupStartRequest) (bool, error) {
|
||||
if err := req.Validate(); err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
url := "/cloudapi/bservice/groupStart"
|
||||
res, err := b.client.DecortApiCall(ctx, typed.POST, url, req)
|
||||
res, err := b.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
@@ -3,10 +3,8 @@ package bservice
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/rudecs/decort-sdk/opts"
|
||||
"github.com/rudecs/decort-sdk/typed"
|
||||
)
|
||||
|
||||
type GroupStopRequest struct {
|
||||
@@ -27,13 +25,13 @@ func (bsrq GroupStopRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b BService) GroupStop(ctx context.Context, req GroupStopRequest, options ...opts.DecortOpts) (bool, error) {
|
||||
func (b BService) GroupStop(ctx context.Context, req GroupStopRequest) (bool, error) {
|
||||
if err := req.Validate(); err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
url := "/cloudapi/bservice/groupStop"
|
||||
res, err := b.client.DecortApiCall(ctx, typed.POST, url, req)
|
||||
res, err := b.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
@@ -3,10 +3,8 @@ package bservice
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/rudecs/decort-sdk/opts"
|
||||
"github.com/rudecs/decort-sdk/typed"
|
||||
)
|
||||
|
||||
type GroupUpdateRequest struct {
|
||||
@@ -32,13 +30,13 @@ func (bsrq GroupUpdateRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b BService) GroupUpdate(ctx context.Context, req GroupUpdateRequest, options ...opts.DecortOpts) (bool, error) {
|
||||
func (b BService) GroupUpdate(ctx context.Context, req GroupUpdateRequest) (bool, error) {
|
||||
if err := req.Validate(); err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
url := "/cloudapi/bservice/groupUpdate"
|
||||
res, err := b.client.DecortApiCall(ctx, typed.POST, url, req)
|
||||
res, err := b.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
@@ -3,19 +3,17 @@ package bservice
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/rudecs/decort-sdk/opts"
|
||||
"github.com/rudecs/decort-sdk/typed"
|
||||
)
|
||||
|
||||
type GroupUpdateExtnetRequest struct {
|
||||
type GroupUpdateExtNetRequest struct {
|
||||
ServiceID uint64 `url:"serviceId"`
|
||||
CompGroupID uint64 `url:"compgroupId"`
|
||||
Extnets []uint64 `url:"extnets,omitempty"`
|
||||
ExtNets []uint64 `url:"extnets,omitempty"`
|
||||
}
|
||||
|
||||
func (bsrq GroupUpdateExtnetRequest) Validate() error {
|
||||
func (bsrq GroupUpdateExtNetRequest) Validate() error {
|
||||
if bsrq.ServiceID == 0 {
|
||||
return errors.New("field ServiceID can not be empty or equal to 0")
|
||||
}
|
||||
@@ -27,13 +25,13 @@ func (bsrq GroupUpdateExtnetRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b BService) GroupUpdateExtnet(ctx context.Context, req GroupUpdateExtnetRequest, options ...opts.DecortOpts) (bool, error) {
|
||||
func (b BService) GroupUpdateExtNet(ctx context.Context, req GroupUpdateExtNetRequest) (bool, error) {
|
||||
if err := req.Validate(); err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
url := "/cloudapi/bservice/groupUpdateExtnet"
|
||||
res, err := b.client.DecortApiCall(ctx, typed.POST, url, req)
|
||||
res, err := b.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
@@ -3,10 +3,8 @@ package bservice
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/rudecs/decort-sdk/opts"
|
||||
"github.com/rudecs/decort-sdk/typed"
|
||||
)
|
||||
|
||||
type GroupUpdateVINSRequest struct {
|
||||
@@ -27,13 +25,13 @@ func (bsrq GroupUpdateVINSRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b BService) GroupUpdateVINS(ctx context.Context, req GroupUpdateVINSRequest, options ...opts.DecortOpts) (bool, error) {
|
||||
func (b BService) GroupUpdateVINS(ctx context.Context, req GroupUpdateVINSRequest) (bool, error) {
|
||||
if err := req.Validate(); err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
url := "/cloudapi/bservice/groupUpdateVins"
|
||||
res, err := b.client.DecortApiCall(ctx, typed.POST, url, req)
|
||||
res, err := b.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
@@ -3,9 +3,7 @@ package bservice
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
|
||||
"github.com/rudecs/decort-sdk/opts"
|
||||
"github.com/rudecs/decort-sdk/typed"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type ListRequest struct {
|
||||
@@ -15,9 +13,9 @@ type ListRequest struct {
|
||||
Size uint64 `url:"size,omitempty"`
|
||||
}
|
||||
|
||||
func (b BService) List(ctx context.Context, req ListRequest, options ...opts.DecortOpts) (BasicServiceList, error) {
|
||||
func (b BService) List(ctx context.Context, req ListRequest) (BasicServiceList, error) {
|
||||
url := "/cloudapi/bservice/list"
|
||||
bsListRaw, err := b.client.DecortApiCall(ctx, typed.POST, url, req)
|
||||
bsListRaw, err := b.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -30,9 +28,9 @@ func (b BService) List(ctx context.Context, req ListRequest, options ...opts.Dec
|
||||
return bsList, nil
|
||||
}
|
||||
|
||||
func (b BService) ListDeleted(ctx context.Context, req ListRequest, options ...opts.DecortOpts) (BasicServiceList, error) {
|
||||
func (b BService) ListDeleted(ctx context.Context, req ListRequest) (BasicServiceList, error) {
|
||||
url := "/cloudapi/bservice/listDeleted"
|
||||
bsListRaw, err := b.client.DecortApiCall(ctx, typed.POST, url, req)
|
||||
bsListRaw, err := b.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ type Group struct {
|
||||
DeletedTime uint64 `json:"deletedTime"`
|
||||
Disk uint64 `json:"disk"`
|
||||
Driver string `json:"driver"`
|
||||
Extnets []uint64 `json:"extnets"`
|
||||
ExtNets []uint64 `json:"extnets"`
|
||||
GID uint64 `json:"gid"`
|
||||
GUID uint64 `json:"guid"`
|
||||
ID uint64 `json:"id"`
|
||||
|
||||
@@ -3,10 +3,8 @@ package bservice
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/rudecs/decort-sdk/opts"
|
||||
"github.com/rudecs/decort-sdk/typed"
|
||||
)
|
||||
|
||||
type RestoreRequest struct {
|
||||
@@ -21,13 +19,13 @@ func (bsrq RestoreRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b BService) Restore(ctx context.Context, req RestoreRequest, options ...opts.DecortOpts) (bool, error) {
|
||||
func (b BService) Restore(ctx context.Context, req RestoreRequest) (bool, error) {
|
||||
if err := req.Validate(); err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
url := "/cloudapi/bservice/restore"
|
||||
res, err := b.client.DecortApiCall(ctx, typed.POST, url, req)
|
||||
res, err := b.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
@@ -3,10 +3,8 @@ package bservice
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/rudecs/decort-sdk/opts"
|
||||
"github.com/rudecs/decort-sdk/typed"
|
||||
)
|
||||
|
||||
type SnapshotCreateRequest struct {
|
||||
@@ -26,13 +24,13 @@ func (bsrq SnapshotCreateRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b BService) SnapshotCreate(ctx context.Context, req SnapshotCreateRequest, options ...opts.DecortOpts) (bool, error) {
|
||||
func (b BService) SnapshotCreate(ctx context.Context, req SnapshotCreateRequest) (bool, error) {
|
||||
if err := req.Validate(); err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
url := "/cloudapi/bservice/snapshotCreate"
|
||||
res, err := b.client.DecortApiCall(ctx, typed.POST, url, req)
|
||||
res, err := b.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
@@ -3,10 +3,8 @@ package bservice
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/rudecs/decort-sdk/opts"
|
||||
"github.com/rudecs/decort-sdk/typed"
|
||||
)
|
||||
|
||||
type SnapshotDeleteRequest struct {
|
||||
@@ -26,13 +24,13 @@ func (bsrq SnapshotDeleteRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b BService) SnapshotDelete(ctx context.Context, req SnapshotDeleteRequest, options ...opts.DecortOpts) (bool, error) {
|
||||
func (b BService) SnapshotDelete(ctx context.Context, req SnapshotDeleteRequest) (bool, error) {
|
||||
if err := req.Validate(); err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
url := "/cloudapi/bservice/snapshotDelete"
|
||||
res, err := b.client.DecortApiCall(ctx, typed.POST, url, req)
|
||||
res, err := b.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
@@ -4,9 +4,7 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
|
||||
"github.com/rudecs/decort-sdk/opts"
|
||||
"github.com/rudecs/decort-sdk/typed"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type SnapshotListRequest struct {
|
||||
@@ -21,13 +19,13 @@ func (bsrq SnapshotListRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b BService) SnapshotList(ctx context.Context, req SnapshotListRequest, options ...opts.DecortOpts) ([]Snapshot, error) {
|
||||
func (b BService) SnapshotList(ctx context.Context, req SnapshotListRequest) ([]Snapshot, error) {
|
||||
if err := req.Validate(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
url := "/cloudapi/bservice/snapshotList"
|
||||
snapshotListRaw, err := b.client.DecortApiCall(ctx, typed.POST, url, req)
|
||||
snapshotListRaw, err := b.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -3,10 +3,8 @@ package bservice
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/rudecs/decort-sdk/opts"
|
||||
"github.com/rudecs/decort-sdk/typed"
|
||||
)
|
||||
|
||||
type SnapshotRollbackRequest struct {
|
||||
@@ -26,13 +24,13 @@ func (bsrq SnapshotRollbackRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b BService) SnapshotRollback(ctx context.Context, req SnapshotRollbackRequest, options ...opts.DecortOpts) (bool, error) {
|
||||
func (b BService) SnapshotRollback(ctx context.Context, req SnapshotRollbackRequest) (bool, error) {
|
||||
if err := req.Validate(); err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
url := "/cloudapi/bservice/snapshotRollback"
|
||||
res, err := b.client.DecortApiCall(ctx, typed.POST, url, req)
|
||||
res, err := b.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
@@ -3,10 +3,8 @@ package bservice
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/rudecs/decort-sdk/opts"
|
||||
"github.com/rudecs/decort-sdk/typed"
|
||||
)
|
||||
|
||||
type StartRequest struct {
|
||||
@@ -21,13 +19,13 @@ func (bsrq StartRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b BService) Start(ctx context.Context, req StartRequest, options ...opts.DecortOpts) (bool, error) {
|
||||
func (b BService) Start(ctx context.Context, req StartRequest) (bool, error) {
|
||||
if err := req.Validate(); err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
url := "/cloudapi/bservice/start"
|
||||
res, err := b.client.DecortApiCall(ctx, typed.POST, url, req)
|
||||
res, err := b.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
@@ -3,10 +3,8 @@ package bservice
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/rudecs/decort-sdk/opts"
|
||||
"github.com/rudecs/decort-sdk/typed"
|
||||
)
|
||||
|
||||
type StopRequest struct {
|
||||
@@ -21,13 +19,13 @@ func (bsrq StopRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b BService) Stop(ctx context.Context, req StopRequest, options ...opts.DecortOpts) (bool, error) {
|
||||
func (b BService) Stop(ctx context.Context, req StopRequest) (bool, error) {
|
||||
if err := req.Validate(); err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
url := "/cloudapi/bservice/stop"
|
||||
res, err := b.client.DecortApiCall(ctx, typed.POST, url, req)
|
||||
res, err := b.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user