This commit is contained in:
dayterr
2026-02-27 17:02:27 +03:00
parent b834e5d074
commit c2c810504d
34 changed files with 118 additions and 268 deletions

View File

@@ -48,7 +48,6 @@ var disks = ListDisks{
Snapshots: []ItemSnapshot{},
Status: "ASSIGNED",
TechStatus: techStatusAllocated,
Type: "B",
VMID: 48500,
},
{
@@ -92,7 +91,6 @@ var disks = ListDisks{
Snapshots: []ItemSnapshot{},
Status: "ASSIGNED",
TechStatus: techStatusAllocated,
Type: "B",
VMID: 48502,
},
},
@@ -224,7 +222,6 @@ var searchDisks = ListSearchDisks{
Snapshots: []ItemSnapshot{},
Status: "ASSIGNED",
TechStatus: techStatusAllocated,
Type: "B",
VMID: 48500,
},
ItemDisk{
@@ -268,7 +265,6 @@ var searchDisks = ListSearchDisks{
Snapshots: []ItemSnapshot{},
Status: "ASSIGNED",
TechStatus: techStatusAllocated,
Type: "B",
VMID: 48502,
},
}

View File

@@ -38,10 +38,6 @@ type ListRequest struct {
// Required: false
AccountID uint64 `url:"accountId,omitempty" json:"accountId,omitempty"`
// Type of the disks
// Required: false
Type string `url:"type,omitempty" json:"type,omitempty"`
// Find by sep ID
// Required: false
SEPID uint64 `url:"sepId,omitempty" json:"sepId,omitempty"`
@@ -65,6 +61,14 @@ type ListRequest struct {
// Page size
// Required: false
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
// ID of the resource group
// Required: false
RGID uint64 `url:"rg_id,omitempty" json:"rg_id,omitempty"`
// ID of the compute
// Required: false
ComputeID uint64 `url:"compute_id,omitempty" json:"compute_id,omitempty"`
}
// List gets list of the created disks belonging to an account as a ListDisks struct

View File

@@ -34,10 +34,6 @@ type ListDeletedRequest struct {
// Required: false
AccountID uint64 `url:"accountId,omitempty" json:"accountId,omitempty"`
// Type of the disks
// Required: false
Type string `url:"type,omitempty" json:"type,omitempty"`
// Sort by one of supported fields, format +|-(field)
// Required: false
SortBy string `url:"sortBy,omitempty" json:"sortBy,omitempty" validate:"omitempty,sortBy"`

View File

@@ -1,52 +0,0 @@
package disks
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// ListTypesRequest struct to get list types of disks
type ListTypesRequest struct {
// Show detailed disk types by seps
// Required: true
Detailed bool `url:"detailed" json:"detailed"`
// 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
// Required: false
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
}
// ListTypes gets list defined disk types
func (d Disks) ListTypes(ctx context.Context, req ListTypesRequest) (*ListTypes, error) {
if err := validators.ValidateRequest(req); err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/disks/listTypes"
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return nil, err
}
list := ListTypes{}
err = json.Unmarshal(res, &list)
if err != nil {
return nil, err
}
return &list, nil
}

View File

@@ -26,10 +26,6 @@ type ListUnattachedRequest struct {
// Required: false
Status string `url:"status,omitempty" json:"status,omitempty"`
// Type of the disks
// Required: false
Type string `url:"type,omitempty" json:"type,omitempty"`
// ID of the account
// Required: false
AccountID uint64 `url:"accountId,omitempty" json:"accountId,omitempty"`

View File

@@ -134,9 +134,6 @@ type ItemDisk struct {
// Need to clean before destroy
ToClean bool `json:"to_clean"`
// Type
Type string `json:"type"`
// Virtual machine ID
VMID uint64 `json:"vmid"`
@@ -283,9 +280,6 @@ type ItemDiskUnattached struct {
// Tech status
TechStatus string `json:"techStatus"`
// Type
Type string `json:"type"`
// Virtual machine ID
VMID uint64 `json:"vmid"`
}
@@ -513,9 +507,6 @@ type RecordDisk struct {
// Need to clean before destroy
ToClean bool `json:"to_clean"`
// Type
Type string `json:"type"`
// Virtual machine ID
VMID uint64 `json:"vmid"`
@@ -548,11 +539,3 @@ type ItemReplication struct {
// VolumeID
VolumeID string `json:"volumeId"`
}
type ListTypes struct {
// Data
Data []interface{} `json:"data"`
// Entry count
EntryCount uint64 `json:"entryCount"`
}