v1.16.0
This commit is contained in:
@@ -1,61 +0,0 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// GetAuditRequest struct for getting user's audits.
|
||||
type GetAuditRequest struct {
|
||||
// Find by api call.
|
||||
// Required: false
|
||||
Call string `url:"call,omitempty" json:"call,omitempty"`
|
||||
|
||||
// Find all audits after point in time (unixtime)
|
||||
// Required: false
|
||||
TimestampAt uint64 `url:"timestampAt,omitempty" json:"timestampAt,omitempty"`
|
||||
|
||||
// Find all audits before point in time (unixtime)
|
||||
// Required: false
|
||||
TimestampTo uint64 `url:"timestampTo,omitempty" json:"timestampTo,omitempty"`
|
||||
|
||||
// find by HTTP max status code
|
||||
// Required: false
|
||||
MaxStatusCode uint64 `url:"maxStatusCode,omitempty" json:"maxStatusCode,omitempty"`
|
||||
|
||||
// find by HTTP min status code
|
||||
// Required: false
|
||||
MinStatusCode uint64 `url:"minStatusCode,omitempty" json:"minStatusCode,omitempty"`
|
||||
|
||||
// Sort by one of supported fields, format +|-(field)
|
||||
// Required: false
|
||||
SortBy string `url:"sortBy,omitempty" json:"sortBy,omitempty" validate:"omitempty,sortBy"`
|
||||
|
||||
// Page number.
|
||||
// Required: false
|
||||
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
||||
|
||||
// Page size, maximum - 100.
|
||||
// Required: false
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
}
|
||||
|
||||
// GetAudit gets user's audits.
|
||||
func (u User) GetAudit(ctx context.Context, req GetAuditRequest) (ListAudits, error) {
|
||||
url := "/cloudapi/user/getAudit"
|
||||
|
||||
res, err := u.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return ListAudits{}, err
|
||||
}
|
||||
|
||||
list := ListAudits{}
|
||||
|
||||
err = json.Unmarshal(res, &list)
|
||||
if err != nil {
|
||||
return ListAudits{}, err
|
||||
}
|
||||
|
||||
return list, nil
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// GetRequest struct to check if the inviteusertoken and emailaddress pair are valid and matching.
|
||||
type IsValidInviteUserTokenRequest struct {
|
||||
// InviteUserToken
|
||||
// The token that was previously sent to the invited user email
|
||||
// Required: true
|
||||
InviteUserToken string `url:"inviteusertoken" json:"inviteusertoken" validate:"required"`
|
||||
|
||||
// EmailAddress
|
||||
// Email address for the user
|
||||
// Required: true
|
||||
EmailAddress string `url:"emailaddress" json:"emailaddress" validate:"required"`
|
||||
}
|
||||
|
||||
// IsValidInviteUserToken checks if the inviteusertoken and emailaddress pair are valid and matching.
|
||||
func (u User) IsValidInviteUserToken(ctx context.Context, req IsValidInviteUserTokenRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudapi/user/isValidInviteUserToken"
|
||||
|
||||
res, err := u.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
|
||||
}
|
||||
@@ -78,35 +78,47 @@ func (s *StatusCode) UnmarshalJSON(b []byte) error {
|
||||
|
||||
type BriefResources struct {
|
||||
Accounts Accounts `json:"Accounts,omitempty"`
|
||||
CSs CSs `json:"CSs,omitempty"`
|
||||
Computes Computes `json:"Computes,omitempty"`
|
||||
RGs RGs `json:"RGs,omitempty"`
|
||||
VMs VMs `json:"VMs,omitempty"`
|
||||
}
|
||||
|
||||
type Accounts struct {
|
||||
Disabled uint64 `json:"DISABLED,omitempty"`
|
||||
Enabled uint64 `json:"ENABLED,omitempty"`
|
||||
}
|
||||
|
||||
type CSs struct {
|
||||
Disabled uint64 `json:"DISABLED,omitempty"`
|
||||
Enabled uint64 `json:"ENABLED,omitempty"`
|
||||
Destroying uint64 `json:"DESTROYING,omitempty"`
|
||||
Confirmed uint64 `json:"CONFIRMED,omitempty"`
|
||||
Disabled uint64 `json:"DISABLED,omitempty"`
|
||||
Deleted uint64 `json:"DELETED,omitempty"`
|
||||
}
|
||||
|
||||
type Computes struct {
|
||||
Started uint64 `json:"Started,omitempty"`
|
||||
Stopped uint64 `json:"Stopped,omitempty"`
|
||||
Starting uint64 `json:"STARTING,omitempty"`
|
||||
Started uint64 `json:"STARTED,omitempty"`
|
||||
Stopping uint64 `json:"STOPPING,omitempty"`
|
||||
Stopped uint64 `json:"STOPPED,omitempty"`
|
||||
Paused uint64 `json:"PAUSED,omitempty"`
|
||||
Pausing uint64 `json:"PAUSING,omitempty"`
|
||||
Merge uint64 `json:"MERGE,omitempty"`
|
||||
Migrating uint64 `json:"MIGRATING,omitempty"`
|
||||
MigratingIn uint64 `json:"MIGRATING_IN,omitempty"`
|
||||
MigratingOut uint64 `json:"MIGRATING_OUT,omitempty"`
|
||||
Down uint64 `json:"DOWN,omitempty"`
|
||||
Scheduled uint64 `json:"SCHEDULED,omitempty"`
|
||||
BackupStopped uint64 `json:"BACKUP_STOPPED,omitempty"`
|
||||
BackupRunning uint64 `json:"BACKUP_RUNNING,omitempty"`
|
||||
SnapСreate uint64 `json:"SNAPCREATE,omitempty"`
|
||||
Cloning uint64 `json:"CLONING,omitempty"`
|
||||
Rollback uint64 `json:"ROLLBACK,omitempty"`
|
||||
}
|
||||
|
||||
type RGs struct {
|
||||
Disabled uint64 `json:"DISABLED,omitempty"`
|
||||
Enabled uint64 `json:"ENABLED,omitempty"`
|
||||
}
|
||||
|
||||
type VMs struct {
|
||||
Halted uint64 `json:"Halted,omitempty"`
|
||||
Running uint64 `json:"Running,omitempty"`
|
||||
Modeled uint64 `json:"MODELED,omitempty"`
|
||||
Created uint64 `json:"CREATED,omitempty"`
|
||||
Deleted uint64 `json:"DELETED,omitempty"`
|
||||
Deleting uint64 `json:"DELETING,omitempty"`
|
||||
Destroying uint64 `json:"DESTROYING,omitempty"`
|
||||
Disabled uint64 `json:"DISABLED,omitempty"`
|
||||
Disabling uint64 `json:"DISABLING,omitempty"`
|
||||
Enabling uint64 `json:"ENABLING,omitempty"`
|
||||
Restoring uint64 `json:"RESTORING,omitempty"`
|
||||
}
|
||||
|
||||
type APIsEndpoints struct {
|
||||
|
||||
Reference in New Issue
Block a user