v1.16.0
This commit is contained in:
@@ -1,40 +0,0 @@
|
||||
package account
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// AuditsRequest struct to give list of account audits
|
||||
type AuditsRequest struct {
|
||||
// ID of the account
|
||||
// Required: true
|
||||
AccountID uint64 `url:"accountId" json:"accountId" validate:"required"`
|
||||
}
|
||||
|
||||
// Audits gets audit records for the specified account object
|
||||
func (a Account) Audits(ctx context.Context, req AuditsRequest) (ListAudits, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/account/audits"
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
list := ListAudits{}
|
||||
|
||||
err = json.Unmarshal(res, &list)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return list, nil
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
package account
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// DisableRequest struct to disable account
|
||||
type DisableRequest struct {
|
||||
// ID of account
|
||||
// Required: true
|
||||
AccountID uint64 `url:"accountId" json:"accountId" validate:"required"`
|
||||
}
|
||||
|
||||
// Disable disables an account
|
||||
func (a Account) Disable(ctx context.Context, req DisableRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/account/disable"
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
result, err := strconv.ParseBool(string(res))
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
package account
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// EnableRequest struct to enable account
|
||||
type EnableRequest struct {
|
||||
// ID of account
|
||||
// Required: true
|
||||
AccountID uint64 `url:"accountId" json:"accountId" validate:"required"`
|
||||
}
|
||||
|
||||
// Enable enables an account
|
||||
func (a Account) Enable(ctx context.Context, req EnableRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/account/enable"
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
result, err := strconv.ParseBool(string(res))
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
@@ -456,11 +456,56 @@ type ItemFLIPGroup struct {
|
||||
|
||||
// Computes info
|
||||
type Computes struct {
|
||||
// Starting
|
||||
Starting uint64 `json:"STARTING"`
|
||||
|
||||
// Started
|
||||
Started uint64 `json:"Started"`
|
||||
Started uint64 `json:"STARTED"`
|
||||
|
||||
// Stopping
|
||||
Stopping uint64 `json:"STOPPING"`
|
||||
|
||||
// Stopped
|
||||
Stopped uint64 `json:"Stopped"`
|
||||
Stopped uint64 `json:"STOPPED"`
|
||||
|
||||
// Paused
|
||||
Paused uint64 `json:"PAUSED"`
|
||||
|
||||
// Pausing
|
||||
Pausing uint64 `json:"PAUSING"`
|
||||
|
||||
// Merge
|
||||
Merge uint64 `json:"MERGE"`
|
||||
|
||||
// Migrating
|
||||
Migrating uint64 `json:"MIGRATING"`
|
||||
|
||||
// Migrating in
|
||||
MigratingIn uint64 `json:"MIGRATING_IN"`
|
||||
|
||||
// Migrating out
|
||||
MigratingOut uint64 `json:"MIGRATING_OUT"`
|
||||
|
||||
// Down
|
||||
Down uint64 `json:"DOWN"`
|
||||
|
||||
// Scheduled
|
||||
Scheduled uint64 `json:"SCHEDULED"`
|
||||
|
||||
// Backup stopped
|
||||
BackupStopped uint64 `json:"BACKUP_STOPPED"`
|
||||
|
||||
// Backup running
|
||||
BackupRunning uint64 `json:"BACKUP_RUNNING"`
|
||||
|
||||
// Snapcreate
|
||||
Snapcreate uint64 `json:"SNAPCREATE"`
|
||||
|
||||
// Cloning
|
||||
Cloning uint64 `json:"CLONING"`
|
||||
|
||||
// Rollback
|
||||
Rollback uint64 `json:"ROLLBACK"`
|
||||
}
|
||||
|
||||
// Limits
|
||||
@@ -579,6 +624,9 @@ type ItemVINS struct {
|
||||
// Deleted time
|
||||
DeletedTime uint64 `json:"deletedTime"`
|
||||
|
||||
// Enable Default Gateway
|
||||
EnableDefaultGateway bool `json:"enable_default_gateway"`
|
||||
|
||||
// External IP
|
||||
ExternalIP string `json:"externalIP"`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user