Merge 'dev' into 'main'
This commit is contained in:
@@ -3,11 +3,10 @@ package rg
|
||||
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 AccessGrantRequest struct {
|
||||
@@ -33,13 +32,13 @@ func (rgrq AccessGrantRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r RG) AccessGrant(ctx context.Context, req AccessGrantRequest, options ...opts.DecortOpts) (bool, error) {
|
||||
func (r RG) AccessGrant(ctx context.Context, req AccessGrantRequest) (bool, error) {
|
||||
if err := req.Validate(); err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
url := "/cloudapi/rg/accessGrant"
|
||||
res, err := r.client.DecortApiCall(ctx, typed.POST, url, req)
|
||||
res, err := r.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
@@ -3,10 +3,8 @@ package rg
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/rudecs/decort-sdk/opts"
|
||||
"github.com/rudecs/decort-sdk/typed"
|
||||
)
|
||||
|
||||
type AccessRevokeRequest struct {
|
||||
@@ -27,13 +25,13 @@ func (rgrq AccessRevokeRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r RG) AccessRevoke(ctx context.Context, req AccessRevokeRequest, options ...opts.DecortOpts) (bool, error) {
|
||||
func (r RG) AccessRevoke(ctx context.Context, req AccessRevokeRequest) (bool, error) {
|
||||
if err := req.Validate(); err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
url := "/cloudapi/rg/accessRevoke"
|
||||
res, err := r.client.DecortApiCall(ctx, typed.POST, url, req)
|
||||
res, err := r.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 AffinityGroupComputesRequest struct {
|
||||
@@ -26,13 +24,13 @@ func (rgrq AffinityGroupComputesRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r RG) AffinityGroupComputes(ctx context.Context, req AffinityGroupComputesRequest, options ...opts.DecortOpts) (AffinityGroupComputeList, error) {
|
||||
func (r RG) AffinityGroupComputes(ctx context.Context, req AffinityGroupComputesRequest) (AffinityGroupComputeList, error) {
|
||||
if err := req.Validate(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
url := "/cloudapi/rg/affinityGroupComputes"
|
||||
agcListRaw, err := r.client.DecortApiCall(ctx, typed.POST, url, req)
|
||||
agcListRaw, err := r.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return nil, 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 AffinityGroupsGetRequest struct {
|
||||
@@ -26,13 +24,13 @@ func (rgrq AffinityGroupsGetRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r RG) AffinityGroupsGet(ctx context.Context, req AffinityGroupsGetRequest, options ...opts.DecortOpts) ([]uint64, error) {
|
||||
func (r RG) AffinityGroupsGet(ctx context.Context, req AffinityGroupsGetRequest) ([]uint64, error) {
|
||||
if err := req.Validate(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
url := "/cloudapi/rg/affinityGroupsGet"
|
||||
agListRaw, err := r.client.DecortApiCall(ctx, typed.POST, url, req)
|
||||
agListRaw, err := r.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return nil, 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 AffinityGroupsListRequest struct {
|
||||
@@ -21,13 +19,13 @@ func (rgrq AffinityGroupsListRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r RG) AffinityGroupsList(ctx context.Context, req AffinityGroupsListRequest, options ...opts.DecortOpts) (map[string][]uint64, error) {
|
||||
func (r RG) AffinityGroupsList(ctx context.Context, req AffinityGroupsListRequest) (map[string][]uint64, error) {
|
||||
if err := req.Validate(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
url := "/cloudapi/rg/affinityGroupsList"
|
||||
agListRaw, err := r.client.DecortApiCall(ctx, typed.POST, url, req)
|
||||
agListRaw, err := r.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return nil, 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 AuditsRequest struct {
|
||||
@@ -21,13 +19,13 @@ func (rgrq AuditsRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r RG) Audits(ctx context.Context, req AuditsRequest, options ...opts.DecortOpts) (AuditList, error) {
|
||||
func (r RG) Audits(ctx context.Context, req AuditsRequest) (AuditList, error) {
|
||||
if err := req.Validate(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
url := "/cloudapi/rg/audits"
|
||||
auditListRaw, err := r.client.DecortApiCall(ctx, typed.POST, url, req)
|
||||
auditListRaw, err := r.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -3,10 +3,8 @@ package rg
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/rudecs/decort-sdk/opts"
|
||||
"github.com/rudecs/decort-sdk/typed"
|
||||
)
|
||||
|
||||
type CreateRequest struct {
|
||||
@@ -44,13 +42,13 @@ func (rgrq CreateRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r RG) Create(ctx context.Context, req CreateRequest, options ...opts.DecortOpts) (uint64, error) {
|
||||
func (r RG) Create(ctx context.Context, req CreateRequest) (uint64, error) {
|
||||
if err := req.Validate(); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
url := "/cloudapi/rg/create"
|
||||
res, err := r.client.DecortApiCall(ctx, typed.POST, url, req)
|
||||
res, err := r.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
@@ -3,10 +3,8 @@ package rg
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/rudecs/decort-sdk/opts"
|
||||
"github.com/rudecs/decort-sdk/typed"
|
||||
)
|
||||
|
||||
type DeleteRequest struct {
|
||||
@@ -24,13 +22,13 @@ func (rgrq DeleteRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r RG) Delete(ctx context.Context, req DeleteRequest, options ...opts.DecortOpts) (bool, error) {
|
||||
func (r RG) Delete(ctx context.Context, req DeleteRequest) (bool, error) {
|
||||
if err := req.Validate(); err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
url := "/cloudapi/rg/delete"
|
||||
res, err := r.client.DecortApiCall(ctx, typed.POST, url, req)
|
||||
res, err := r.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
@@ -3,10 +3,8 @@ package rg
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/rudecs/decort-sdk/opts"
|
||||
"github.com/rudecs/decort-sdk/typed"
|
||||
)
|
||||
|
||||
type DisableRequest struct {
|
||||
@@ -22,13 +20,13 @@ func (rgrq DisableRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r RG) Disable(ctx context.Context, req DisableRequest, options ...opts.DecortOpts) (bool, error) {
|
||||
func (r RG) Disable(ctx context.Context, req DisableRequest) (bool, error) {
|
||||
if err := req.Validate(); err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
url := "/cloudapi/rg/disable"
|
||||
res, err := r.client.DecortApiCall(ctx, typed.POST, url, req)
|
||||
res, err := r.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
@@ -3,10 +3,8 @@ package rg
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/rudecs/decort-sdk/opts"
|
||||
"github.com/rudecs/decort-sdk/typed"
|
||||
)
|
||||
|
||||
type EnableRequest struct {
|
||||
@@ -22,13 +20,13 @@ func (rgrq EnableRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r RG) Enable(ctx context.Context, req EnableRequest, options ...opts.DecortOpts) (bool, error) {
|
||||
func (r RG) Enable(ctx context.Context, req EnableRequest) (bool, error) {
|
||||
if err := req.Validate(); err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
url := "/cloudapi/rg/enable"
|
||||
res, err := r.client.DecortApiCall(ctx, typed.POST, url, req)
|
||||
res, err := r.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 {
|
||||
@@ -22,13 +20,13 @@ func (rgrq GetRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r RG) Get(ctx context.Context, req GetRequest, options ...opts.DecortOpts) (*ResourceGroup, error) {
|
||||
func (r RG) Get(ctx context.Context, req GetRequest) (*ResourceGroup, error) {
|
||||
if err := req.Validate(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
url := "/cloudapi/rg/get"
|
||||
rgRaw, err := r.client.DecortApiCall(ctx, typed.POST, url, req)
|
||||
rgRaw, err := r.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -3,9 +3,7 @@ package rg
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
|
||||
"github.com/rudecs/decort-sdk/opts"
|
||||
"github.com/rudecs/decort-sdk/typed"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type ListRequest struct {
|
||||
@@ -14,9 +12,9 @@ type ListRequest struct {
|
||||
Size uint64 `url:"size,omitempty"`
|
||||
}
|
||||
|
||||
func (r RG) List(ctx context.Context, req ListRequest, options ...opts.DecortOpts) (ResourceGroupList, error) {
|
||||
func (r RG) List(ctx context.Context, req ListRequest) (ResourceGroupList, error) {
|
||||
url := "/cloudapi/rg/list"
|
||||
rgListRaw, err := r.client.DecortApiCall(ctx, typed.POST, url, req)
|
||||
rgListRaw, err := r.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return nil, 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 ListComputesRequest struct {
|
||||
@@ -22,13 +20,13 @@ func (rgrq ListComputesRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r RG) ListComputes(ctx context.Context, req ListComputesRequest, options ...opts.DecortOpts) (ComputeList, error) {
|
||||
func (r RG) ListComputes(ctx context.Context, req ListComputesRequest) (ComputeList, error) {
|
||||
if err := req.Validate(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
url := "/cloudapi/rg/listComputes"
|
||||
computeListRaw, err := r.client.DecortApiCall(ctx, typed.POST, url, req)
|
||||
computeListRaw, err := r.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -3,9 +3,7 @@ package rg
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
|
||||
"github.com/rudecs/decort-sdk/opts"
|
||||
"github.com/rudecs/decort-sdk/typed"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type ListDeletedRequest struct {
|
||||
@@ -13,9 +11,9 @@ type ListDeletedRequest struct {
|
||||
Size uint64 `url:"size,omitempty"`
|
||||
}
|
||||
|
||||
func (r RG) ListDeleted(ctx context.Context, req ListDeletedRequest, options ...opts.DecortOpts) (ResourceGroupList, error) {
|
||||
func (r RG) ListDeleted(ctx context.Context, req ListDeletedRequest) (ResourceGroupList, error) {
|
||||
url := "/cloudapi/rg/listDeleted"
|
||||
rgListRaw, err := r.client.DecortApiCall(ctx, typed.POST, url, req)
|
||||
rgListRaw, err := r.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return nil, 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 ListLBRequest struct {
|
||||
@@ -21,13 +19,13 @@ func (rgrq ListLBRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r RG) ListLB(ctx context.Context, req ListLBRequest, options ...opts.DecortOpts) (LBList, error) {
|
||||
func (r RG) ListLB(ctx context.Context, req ListLBRequest) (LBList, error) {
|
||||
if err := req.Validate(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
url := "/cloudapi/rg/listLb"
|
||||
lbListRaw, err := r.client.DecortApiCall(ctx, typed.POST, url, req)
|
||||
lbListRaw, err := r.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return nil, 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 ListPFWRequest struct {
|
||||
@@ -21,13 +19,13 @@ func (rgrq ListPFWRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r RG) ListPFW(ctx context.Context, req ListPFWRequest, options ...opts.DecortOpts) (PortForwardList, error) {
|
||||
func (r RG) ListPFW(ctx context.Context, req ListPFWRequest) (PortForwardList, error) {
|
||||
if err := req.Validate(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
url := "/cloudapi/rg/listPFW"
|
||||
pfwListRaw, err := r.client.DecortApiCall(ctx, typed.POST, url, req)
|
||||
pfwListRaw, err := r.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return nil, 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 ListVINSRequest struct {
|
||||
@@ -22,21 +20,21 @@ func (rgrq ListVINSRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r RG) ListVINS(ctx context.Context, req ListVINSRequest, options ...opts.DecortOpts) (VINSList, error) {
|
||||
func (r RG) ListVINS(ctx context.Context, req ListVINSRequest) (VINSList, error) {
|
||||
if err := req.Validate(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
url := "/cloudapi/rg/listVins"
|
||||
vinsListRaw, err := r.client.DecortApiCall(ctx, typed.POST, url, req)
|
||||
VINSListRaw, err := r.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
vinsList := VINSList{}
|
||||
if err := json.Unmarshal(vinsListRaw, &vinsList); err != nil {
|
||||
VINSList := VINSList{}
|
||||
if err := json.Unmarshal(VINSListRaw, &VINSList); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return vinsList, nil
|
||||
return VINSList, nil
|
||||
}
|
||||
|
||||
@@ -6,17 +6,17 @@ type ResourceGroup struct {
|
||||
ACL []ACL `json:"acl"`
|
||||
CreatedBy string `json:"createdBy"`
|
||||
CreatedTime uint64 `json:"createdTime"`
|
||||
DefNetID uint64 `json:"def_net_id"`
|
||||
DefNetID int64 `json:"def_net_id"`
|
||||
DefNetType string `json:"def_net_type"`
|
||||
DeletedBy string `json:"deletedBy"`
|
||||
DeletedTime uint64 `json:"deletedTime"`
|
||||
Desc string `json:"desc"`
|
||||
Dirty bool `url:"dirty"`
|
||||
Dirty bool `json:"dirty"`
|
||||
GID uint64 `json:"gid"`
|
||||
GUID uint64 `json:"guid"`
|
||||
ID uint64 `json:"id"`
|
||||
LockStatus string `json:"lockStatus"`
|
||||
Milestones int `json:"milestones"`
|
||||
Milestones uint64 `json:"milestones"`
|
||||
Name string `json:"name"`
|
||||
RegisterComputes bool `json:"registerComputes"`
|
||||
ResourceLimits ResourceLimits `json:"resourceLimits"`
|
||||
@@ -111,12 +111,12 @@ type LoadBalancer struct {
|
||||
DeletedTime uint64 `json:"deletedTime"`
|
||||
Description string `json:"desc"`
|
||||
DPAPIUser string `json:"dpApiUser"`
|
||||
ExtnetId uint64 `json:"extnetId"`
|
||||
ExtNetID uint64 `json:"extnetId"`
|
||||
Frontends []Frontend `json:"frontends"`
|
||||
GID uint64 `json:"gid"`
|
||||
GUID uint64 `json:"guid"`
|
||||
ID uint64 `json:"id"`
|
||||
ImageId uint64 `json:"imageId"`
|
||||
ImageID uint64 `json:"imageId"`
|
||||
Milestones uint64 `json:"milestones"`
|
||||
Name string `json:"name"`
|
||||
PrimaryNode Node `json:"primaryNode"`
|
||||
@@ -127,7 +127,7 @@ type LoadBalancer struct {
|
||||
TechStatus string `json:"techStatus"`
|
||||
UpdatedBy string `json:"updatedBy"`
|
||||
UpdatedTime uint64 `json:"updatedTime"`
|
||||
VinsId uint64 `json:"vinsId"`
|
||||
VINSID uint64 `json:"vinsId"`
|
||||
}
|
||||
|
||||
type LoadBalancerDetailed struct {
|
||||
@@ -149,12 +149,12 @@ type ServerSettings struct {
|
||||
Inter uint64 `json:"inter"`
|
||||
GUID string `json:"guid"`
|
||||
DownInter uint64 `json:"downinter"`
|
||||
Rise uint `json:"rise"`
|
||||
Fall uint `json:"fall"`
|
||||
Rise uint64 `json:"rise"`
|
||||
Fall uint64 `json:"fall"`
|
||||
SlowStart uint64 `json:"slowstart"`
|
||||
MaxConn uint `json:"maxconn"`
|
||||
MaxQueue uint `json:"maxqueue"`
|
||||
Weight uint `json:"weight"`
|
||||
MaxConn uint64 `json:"maxconn"`
|
||||
MaxQueue uint64 `json:"maxqueue"`
|
||||
Weight uint64 `json:"weight"`
|
||||
}
|
||||
|
||||
type Server struct {
|
||||
@@ -162,17 +162,17 @@ type Server struct {
|
||||
Check string `json:"check"`
|
||||
GUID string `json:"guid"`
|
||||
Name string `json:"name"`
|
||||
Port uint `json:"port"`
|
||||
Port uint64 `json:"port"`
|
||||
ServerSettings ServerSettings `json:"serverSettings"`
|
||||
}
|
||||
|
||||
type Node struct {
|
||||
BackendIp string `json:"backendIp"`
|
||||
ComputeId uint64 `json:"computeId"`
|
||||
FrontendIp string `json:"frontendIp"`
|
||||
BackendIP string `json:"backendIp"`
|
||||
ComputeID uint64 `json:"computeId"`
|
||||
FrontendIP string `json:"frontendIp"`
|
||||
GUID string `json:"guid"`
|
||||
MGMTIp string `json:"mgmtIp"`
|
||||
NetworkId uint64 `json:"networkId"`
|
||||
MGMTIP string `json:"mgmtIp"`
|
||||
NetworkID uint64 `json:"networkId"`
|
||||
}
|
||||
|
||||
type Frontend struct {
|
||||
@@ -186,16 +186,16 @@ type Binding struct {
|
||||
Address string `json:"address"`
|
||||
GUID string `json:"guid"`
|
||||
Name string `json:"name"`
|
||||
Port uint `json:"port"`
|
||||
Port uint64 `json:"port"`
|
||||
}
|
||||
|
||||
type PortForward struct {
|
||||
PublicPortEnd uint16 `json:"Public Port End"`
|
||||
PublicPortStart uint16 `json:"Public Port Start"`
|
||||
PublicPortEnd uint64 `json:"Public Port End"`
|
||||
PublicPortStart uint64 `json:"Public Port Start"`
|
||||
VMID uint64 `json:"VM ID"`
|
||||
VMIP string `json:"VM IP"`
|
||||
VMName string `json:"VM Name"`
|
||||
VMPort uint16 `json:"VM Port"`
|
||||
VMPort uint64 `json:"VM Port"`
|
||||
VINSID uint64 `json:"ViNS ID"`
|
||||
VINSName string `json:"ViNS Name"`
|
||||
}
|
||||
|
||||
@@ -3,10 +3,8 @@ package rg
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/rudecs/decort-sdk/opts"
|
||||
"github.com/rudecs/decort-sdk/typed"
|
||||
)
|
||||
|
||||
type RestoreRequest struct {
|
||||
@@ -22,13 +20,13 @@ func (rgrq RestoreRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r RG) Restore(ctx context.Context, req RestoreRequest, options ...opts.DecortOpts) (bool, error) {
|
||||
func (r RG) Restore(ctx context.Context, req RestoreRequest) (bool, error) {
|
||||
if err := req.Validate(); err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
url := "/cloudapi/rg/restore"
|
||||
res, err := r.client.DecortApiCall(ctx, typed.POST, url, req)
|
||||
res, err := r.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
@@ -3,11 +3,10 @@ package rg
|
||||
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 SetDefNetRequest struct {
|
||||
@@ -29,13 +28,13 @@ func (rgrq SetDefNetRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r RG) SetDefNet(ctx context.Context, req SetDefNetRequest, options ...opts.DecortOpts) (uint64, error) {
|
||||
func (r RG) SetDefNet(ctx context.Context, req SetDefNetRequest) (uint64, error) {
|
||||
if err := req.Validate(); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
url := "/cloudapi/rg/setDefNet"
|
||||
res, err := r.client.DecortApiCall(ctx, typed.POST, url, req)
|
||||
res, err := r.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
@@ -3,10 +3,8 @@ package rg
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/rudecs/decort-sdk/opts"
|
||||
"github.com/rudecs/decort-sdk/typed"
|
||||
)
|
||||
|
||||
type UpdateRequest struct {
|
||||
@@ -30,13 +28,13 @@ func (rgrq UpdateRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r RG) Update(ctx context.Context, req UpdateRequest, options ...opts.DecortOpts) (bool, error) {
|
||||
func (r RG) Update(ctx context.Context, req UpdateRequest) (bool, error) {
|
||||
if err := req.Validate(); err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
url := "/cloudapi/rg/update"
|
||||
res, err := r.client.DecortApiCall(ctx, typed.POST, url, req)
|
||||
res, err := r.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 UsageRequest struct {
|
||||
@@ -22,13 +20,13 @@ func (rgrq UsageRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r RG) Usage(ctx context.Context, req UpdateRequest, options ...opts.DecortOpts) (*ResourceUsage, error) {
|
||||
func (r RG) Usage(ctx context.Context, req UpdateRequest) (*ResourceUsage, error) {
|
||||
if err := req.Validate(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
url := "/cloudapi/rg/usage"
|
||||
usageRaw, err := r.client.DecortApiCall(ctx, typed.POST, url, req)
|
||||
usageRaw, err := r.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user