diff --git a/CHANGELOG.md b/CHANGELOG.md index 03b9f9e..718d604 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## Version 1.14.0 +## Version 1.14.1 Методы `Audits` в cloudapi/compute, cloudbroker/compute, cloudapi/account, cloudbroker/account, cloudapi/vins, cloudbroker/vins, cloudapi/rg и cloudbroker/rg стали deprecated и в следующих версиях будут удалены, вместо них необходимо использовать метод `List` в cloudapi/audit и cloudbroker/audit с соответствующими фильтрами Методы `AccessGrant`, `AccessGrantToPool`, `AccessRevoke`, `AccessRevokeToPool` в cloudbroker/sep стали deprecated и в следующих версиях будут удалены @@ -12,38 +12,59 @@ #### account | Идентификатор
задачи | Описание | | --- | --- | -| BGOS-772 | Вычисляемое поле `UpdatedBy` в структуры ответа `RecordAccount` в cloudapi/account и `InfoAccount` в cloudbroker/account | +| BGOS-780 | Вычисляемое поле `DeletedBy` в структуру ответа `ItemAccount` в cloudapi/account | #### compute | Идентификатор
задачи | Описание | | --- | --- | -| BGOS-767 | Метод `CheckComputePlacement`, структура запроса `CheckComputePlacementRequest` и структуры ответа `CheckComputePlacementResult`, `CheckComputePlacementItem`,`CheckComputePlacementError` в cloudbroker/compute | -| BGOS-771 | Вычисляемое поле `BlockSize` в структуры ответа `ItemDisk` в cloudbroker/compute и в `ItemComputeDisk` в cloudapi/compute | +| BGOS-777 | Структура ответа `RecordCloneAbort` в cloudbroker/compute | +| BGOS-774 | Опциональное поле `Weight` в структуру запроса `UpdateRequest` в cloudbroker/compute | +| BGOS-774 | Вычисляемое поле `Weight` в структуры ответа `InfoCompute` и `RecordCompute` в cloudbroker/compute и в структуры ответа `RecordCompute` и `ItemCompute` в cloudapi/compute | + +#### kvmx86 +| Идентификатор
задачи | Описание | +| --- | --- | +| BGOS-775 | Опциональное поле `Weight` в структуры запроса `CreateRequest`, `CreateBlankRequest` и `MassCreateRequest` в cloudbroker/kvmx86 | + +#### rg +| Идентификатор
задачи | Описание | +| --- | --- | +| BGOS-776 | Вычисляемое поле `Email` в структуры ответа `ItemACL` в cloudapi/rg и в `ACL` в cloudbroker/rg | +| BGOS-779 | Опциональные поля `RGID` и `ComputeID` в структуру запроса `ListRequest` в cloudapi/rg и в cloudbroker/rg | + +#### stpolicy +| Идентификатор
задачи | Описание | +| --- | --- | +| BGOS-784 | Вычисляемое поле `Usage` в структуру ответа `InfoStoragePolicyWithID` в cloudbroker/stpolicy | + + +### Изменено + +#### compute +| Идентификатор
задачи | Описание | +| --- | --- | +| BGOS-777 | Тип возвращаемого значения метода `CloneAbort` с `bool` на `[]RecordCloneAbort` в cloudbroker/compute | + +### Удалено + +#### compute +| Идентификатор
задачи | Описание | +| --- | --- | +| BGOS-781 | Опциональное поле `DiskType` из структур `DiskAddRequest` и `DiskAttachRequest` в cloudapi/compute и в cloudbroker/compute | +| BGOS-785 | Вычисляемое поле `Type` из структур `ItemDisk`, `RecordDisk` и `ItemDiskUnattached` в cloudapi/compute и из структуры `InfoDisk` в cloudbroker/compute | #### disks | Идентификатор
задачи | Описание | | --- | --- | -| BGOS-770 | Опциональное поле `BlockSize` в структуру запроса `UpdateRequest` в cloudbroker/disks | -| BGOS-770 | Вычисляемое поле `BlockSize` в структуры ответа `ItemDisk`, `ItemDiskUnattached` и `RecordDisk` в cloudapi/disks и в структуры ответа `InfoDisk` и `RecordDisk` в cloudbroker/disks | - -#### node -| Идентификатор
задачи | Описание | -| --- | --- | -| BGOS-769 | Опциональное поле `ZoneID` в структуру запроса `ListRequest` в cloudbroker/node | - -#### SDN external networks -| Идентификатор
задачи | Описание | -| --- | --- | -| BGOS-694 | Опциональные поля `OperationStatus` и `HypervisorStatus` в структуру запроса `ListRequest` в sdn/external_networks | - -#### SDN network object groups -| Идентификатор
задачи | Описание | -| --- | --- | -| BGOS-749 | Методы `AttachL2ConnectionPorts`, `DetachL2ConnectionPorts` и структуры запросов `AttachL2ConnectionPortsRequest`, `L2PortBindings`, `DetachL2PortBindings`, `DetachL2ConnectionPortsRequest` в sdn/netobjgroups | - -### Удалено +| BGOS-781 | Структура запросов `ListTypesRequest`, структура ответов `ListTypes`, метод `ListTypes` в cloudapi/disks и в cloudbroker/disks | +| BGOS-781 | Опциональное поле `Type` из структур `ListRequest`, `ListDeletedRequest` и `ListUnattachedRequest` в cloudapi/disks и в cloudbroker/disks | #### kvmx86 | Идентификатор
задачи | Описание | | --- | --- | | BGOS-773 | Опциональные поля `IS` и `IPAType` из структур запроса `CreateRequest` в cloudapi/kvmx86 и в cloudbroker/kvmx86 | + +#### stpolicy +| Идентификатор
задачи | Описание | +| --- | --- | +| BGOS-784 | Вычисляемое поле `StoragePolicyID` из структуры ответа `InfoStoragePolicyWithID` в cloudbroker/stpolicy | diff --git a/README.md b/README.md index c51cf2c..8931444 100644 --- a/README.md +++ b/README.md @@ -467,16 +467,6 @@ type CreateRequest struct { // Node ID // Required: false NodeID uint64 `url:"nodeId,omitempty" json:"nodeId,omitempty"` - - // System name - // Required: false - IS string `url:"IS,omitempty" json:"IS,omitempty"` - - // Compute purpose - // Required: false - IPAType string `url:"ipaType,omitempty" json:"ipaType,omitempty"` - - } ``` diff --git a/internal/validators/custom.go b/internal/validators/custom.go index 12c255a..f2a4c6d 100644 --- a/internal/validators/custom.go +++ b/internal/validators/custom.go @@ -86,13 +86,6 @@ func computeModeValidator(fe validator.FieldLevel) bool { return IsInSlice(fieldValue, computeModeValues) } -// computeDiskTypeValidator is used to validate DiskType field. -func computeDiskTypeValidator(fe validator.FieldLevel) bool { - fieldValue := fe.Field().String() - - return IsInSlice(fieldValue, computeDiskTypeValues) -} - // computeNetTypeValidator is used to validate NetType field. func computeNetTypeValidator(fe validator.FieldLevel) bool { fieldValue := fe.Field().String() @@ -151,13 +144,6 @@ func computeDataDisksValidator(fe validator.FieldLevel) bool { return IsInSlice(fieldValue, computeDataDisksValues) } -// diskTypeValidator is used to validate Type field. -func diskTypeValidator(fe validator.FieldLevel) bool { - fieldValue := fe.Field().String() - - return IsInSlice(fieldValue, diskTypeValues) -} - // flipgroupClientTypeValidator is used to validate ClientType field. func flipgroupClientTypeValidator(fe validator.FieldLevel) bool { fieldValue := fe.Field().String() diff --git a/internal/validators/messages.go b/internal/validators/messages.go index 7dd0fa2..6894d6d 100644 --- a/internal/validators/messages.go +++ b/internal/validators/messages.go @@ -86,12 +86,6 @@ func errorMessage(fe validator.FieldError) string { fe.Field(), joinValues(computeModeValues)) - case "computeDiskType": - return fmt.Sprintf("%s %s must be one of the following: %s", - prefix, - fe.Field(), - joinValues(computeDiskTypeValues)) - case "mtu": return fmt.Sprint(prefix, fe.Field(), "must be ", mtuMin, "-", mtuMax) @@ -122,13 +116,6 @@ func errorMessage(fe validator.FieldError) string { fe.Field(), joinValues(computeDataDisksValues)) - // Disk Validators - case "diskType": - return fmt.Sprintf("%s %s must be one of the following: %s", - prefix, - fe.Field(), - joinValues(diskTypeValues)) - // Flipgroup Validators case "flipgroupClientType": return fmt.Sprintf("%s %s must be one of the following: %s", diff --git a/internal/validators/validator.go b/internal/validators/validator.go index e963c1e..38c26da 100644 --- a/internal/validators/validator.go +++ b/internal/validators/validator.go @@ -86,11 +86,6 @@ func registerAllValidators(validate *validator.Validate) error { return err } - err = validate.RegisterValidation("computeDiskType", computeDiskTypeValidator) - if err != nil { - return err - } - err = validate.RegisterValidation("computeNetType", computeNetTypeValidator) if err != nil { return err @@ -111,11 +106,6 @@ func registerAllValidators(validate *validator.Validate) error { return err } - err = validate.RegisterValidation("diskType", diskTypeValidator) - if err != nil { - return err - } - err = validate.RegisterValidation("flipgroupClientType", flipgroupClientTypeValidator) if err != nil { return err diff --git a/internal/validators/values.go b/internal/validators/values.go index 4c91a39..0d9f560 100644 --- a/internal/validators/values.go +++ b/internal/validators/values.go @@ -14,14 +14,11 @@ var ( computeTopologyValues = []string{"compute", "node"} computePolicyValues = []string{"RECOMMENDED", "REQUIRED"} computeModeValues = []string{"EQ", "EN", "ANY"} - computeDiskTypeValues = []string{"D", "B"} computeNetTypeValues = []string{"EXTNET", "VINS"} computex86NetTypeValues = []string{"EXTNET", "VINS", "VFNIC", "DPDK", "SDN", "EMPTY", "TRUNK"} computeOrderValues = []string{"cdrom", "network", "hd"} computeDataDisksValues = []string{"KEEP", "DETACH", "DESTROY"} - diskTypeValues = []string{"B", "T", "D"} - flipgroupClientTypeValues = []string{"compute", "vins"} massCreateNetTypeValues = []string{"EXTNET", "VINS", "TRUNK"} diff --git a/pkg/cloudapi/account/models.go b/pkg/cloudapi/account/models.go index 357cbc1..dd43fa7 100644 --- a/pkg/cloudapi/account/models.go +++ b/pkg/cloudapi/account/models.go @@ -95,6 +95,9 @@ type ItemAccount struct { // Deleted time DeletedTime uint64 `json:"deletedTime"` + // Deleted by + DeletedBy string `json:"deletedBy"` + // Description Description string `json:"desc"` diff --git a/pkg/cloudapi/compute/disk_add.go b/pkg/cloudapi/compute/disk_add.go index 13f4d86..436fda2 100644 --- a/pkg/cloudapi/compute/disk_add.go +++ b/pkg/cloudapi/compute/disk_add.go @@ -26,13 +26,6 @@ type DiskAddRequest struct { // Required: true StoragePolicyID uint64 `url:"storage_policy_id" json:"storage_policy_id" validate:"required"` - // Type of the disk - // Should be one of: - // - D - // - B - // Required: false - DiskType string `url:"diskType,omitempty" json:"diskType,omitempty" validate:"omitempty,computeDiskType"` - // Storage endpoint provider ID // By default the same with boot disk // Required: false diff --git a/pkg/cloudapi/compute/disk_attach.go b/pkg/cloudapi/compute/disk_attach.go index 5f9294e..9b18375 100644 --- a/pkg/cloudapi/compute/disk_attach.go +++ b/pkg/cloudapi/compute/disk_attach.go @@ -18,10 +18,6 @@ type DiskAttachRequest struct { // Required: true DiskID uint64 `url:"diskId" json:"diskId" validate:"required"` - // Type of the disk B;D - // Required: false - DiskType string `url:"diskType,omitempty" json:"diskType,omitempty" validate:"omitempty,computeDiskType"` - // Desired PCI slot (hex string, e.g. "0x1A") // Required: false PCISlot string `url:"pci_slot,omitempty" json:"pci_slot,omitempty"` diff --git a/pkg/cloudapi/compute/models.go b/pkg/cloudapi/compute/models.go index 5442273..51b5021 100644 --- a/pkg/cloudapi/compute/models.go +++ b/pkg/cloudapi/compute/models.go @@ -545,6 +545,9 @@ type RecordCompute struct { // VNC password VNCPassword string `json:"vncPasswd"` + // Weight + Weight uint64 `json:"weight"` + // Zone ID // Required: false ZoneID uint64 `json:"zoneId"` @@ -1235,6 +1238,9 @@ type ItemCompute struct { // VINS connected VINSConnected uint64 `json:"vinsConnected"` + // Weight + Weight uint64 `json:"weight"` + // Zone ID ZoneID uint64 `json:"zoneId"` } diff --git a/pkg/cloudapi/disks/filter_test.go b/pkg/cloudapi/disks/filter_test.go index 947912b..e89f579 100644 --- a/pkg/cloudapi/disks/filter_test.go +++ b/pkg/cloudapi/disks/filter_test.go @@ -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, }, } diff --git a/pkg/cloudapi/disks/list.go b/pkg/cloudapi/disks/list.go index 6799816..0ea935b 100644 --- a/pkg/cloudapi/disks/list.go +++ b/pkg/cloudapi/disks/list.go @@ -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 diff --git a/pkg/cloudapi/disks/list_deleted.go b/pkg/cloudapi/disks/list_deleted.go index 60e4db5..ef6c2a8 100644 --- a/pkg/cloudapi/disks/list_deleted.go +++ b/pkg/cloudapi/disks/list_deleted.go @@ -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"` diff --git a/pkg/cloudapi/disks/list_types.go b/pkg/cloudapi/disks/list_types.go deleted file mode 100644 index 81f5ded..0000000 --- a/pkg/cloudapi/disks/list_types.go +++ /dev/null @@ -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 -} diff --git a/pkg/cloudapi/disks/list_unattached.go b/pkg/cloudapi/disks/list_unattached.go index df00642..8857385 100644 --- a/pkg/cloudapi/disks/list_unattached.go +++ b/pkg/cloudapi/disks/list_unattached.go @@ -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"` diff --git a/pkg/cloudapi/disks/models.go b/pkg/cloudapi/disks/models.go index cd8fe09..49c24e5 100644 --- a/pkg/cloudapi/disks/models.go +++ b/pkg/cloudapi/disks/models.go @@ -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"` -} diff --git a/pkg/cloudapi/rg/models.go b/pkg/cloudapi/rg/models.go index 5c79e98..c6bca70 100644 --- a/pkg/cloudapi/rg/models.go +++ b/pkg/cloudapi/rg/models.go @@ -267,6 +267,9 @@ type ListResourceGroups struct { // Main information about Access Control List type ItemACL struct { + // Email + Email string `json:"email"` + // Explicit Explicit bool `json:"explicit"` diff --git a/pkg/cloudbroker/compute/clone_abort.go b/pkg/cloudbroker/compute/clone_abort.go index acb0fe4..cef4e1e 100644 --- a/pkg/cloudbroker/compute/clone_abort.go +++ b/pkg/cloudbroker/compute/clone_abort.go @@ -2,8 +2,8 @@ package compute import ( "context" + "encoding/json" "net/http" - "strconv" "repository.basistech.ru/BASIS/decort-golang-sdk/internal/constants" "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" @@ -17,22 +17,24 @@ type CloneAbortRequest struct { } // CloneAbort aborts a compute clone -func (c Compute) CloneAbort(ctx context.Context, req CloneAbortRequest) (bool, error) { +func (c Compute) CloneAbort(ctx context.Context, req CloneAbortRequest) ([]RecordCloneAbort, error) { err := validators.ValidateRequest(req) if err != nil { - return false, validators.ValidationErrors(validators.GetErrors(err)) + return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/clone_abort" res, err := c.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req) if err != nil { - return false, err + return nil, err } - result, err := strconv.ParseBool(string(res)) + result := make([]RecordCloneAbort, 0) + + err = json.Unmarshal(res, &result) if err != nil { - return false, err + return nil, err } return result, nil diff --git a/pkg/cloudbroker/compute/disk_add.go b/pkg/cloudbroker/compute/disk_add.go index 9355185..2a3f984 100644 --- a/pkg/cloudbroker/compute/disk_add.go +++ b/pkg/cloudbroker/compute/disk_add.go @@ -31,13 +31,6 @@ type DiskAddRequest struct { // Required: true StoragePolicyID uint64 `url:"storage_policy_id" json:"storage_policy_id" validate:"required"` - // Type of the disk - // Should be one of: - // - D - // - B - // Required: false - DiskType string `url:"diskType,omitempty" json:"diskType,omitempty" validate:"omitempty,computeDiskType"` - // Pool name // By default will be chosen automatically // Required: false diff --git a/pkg/cloudbroker/compute/disk_attach.go b/pkg/cloudbroker/compute/disk_attach.go index 32b97f7..05ed72d 100644 --- a/pkg/cloudbroker/compute/disk_attach.go +++ b/pkg/cloudbroker/compute/disk_attach.go @@ -18,10 +18,6 @@ type DiskAttachRequest struct { // Required: true DiskID uint64 `url:"diskId" json:"diskId" validate:"required"` - // Type of the disk B;D - // Required: false - DiskType string `url:"diskType,omitempty" json:"diskType,omitempty"` - // Desired PCI slot (hex string, e.g. "0x1A") // Required: false PCISlot string `url:"pci_slot,omitempty" json:"pci_slot,omitempty"` diff --git a/pkg/cloudbroker/compute/models.go b/pkg/cloudbroker/compute/models.go index 030a824..3e8ecd1 100644 --- a/pkg/cloudbroker/compute/models.go +++ b/pkg/cloudbroker/compute/models.go @@ -891,6 +891,9 @@ type InfoCompute struct { // VINS connected VINSConnected uint64 `json:"vinsConnected"` + // Weight + Weight uint64 `json:"weight"` + // Zone ID ZoneID uint64 `json:"zoneId"` } @@ -1178,6 +1181,9 @@ type RecordCompute struct { // VNC password VNCPassword string `json:"vncPasswd"` + // Weight + Weight uint64 `json:"weight"` + // Zone ID ZoneID uint64 `json:"zoneId"` @@ -1469,6 +1475,14 @@ type MigrateStorageItem struct { TargetNodeID uint64 `json:"targetNodeId"` } +type RecordCloneAbort struct { + // Disk ID + DiskID uint64 `json:"disk_id"` + + // Abort status + Status bool `json:"status"` +} + type RecordCloneStatus struct { // Disk ID DiskID int `json:"disk_id"` diff --git a/pkg/cloudbroker/compute/update.go b/pkg/cloudbroker/compute/update.go index 58a5331..81804c4 100644 --- a/pkg/cloudbroker/compute/update.go +++ b/pkg/cloudbroker/compute/update.go @@ -69,6 +69,10 @@ type UpdateRequest struct { // The OS version that will be installed on the virtual machine // Required: false OSVersion string `url:"os_version,omitempty" json:"os_version,omitempty"` + + // Priority weight of the compute: higher value means higher priority and later migration + // Required: false + Weight uint64 `url:"weight,omitempty" json:"weight,omitempty"` } // Update updates some properties of the compute diff --git a/pkg/cloudbroker/disks/filter_test.go b/pkg/cloudbroker/disks/filter_test.go index c31e65a..eef62a1 100644 --- a/pkg/cloudbroker/disks/filter_test.go +++ b/pkg/cloudbroker/disks/filter_test.go @@ -59,7 +59,6 @@ var disks = ListDisks{ Snapshots: []ItemSnapshot{}, Status: "ASSIGNED", TechStatus: "ALLOCATED", - Type: "B", VMID: 48500, }, }, @@ -120,7 +119,6 @@ var disks = ListDisks{ Snapshots: []ItemSnapshot{}, Status: "ASSIGNED", TechStatus: "ALLOCATED", - Type: "B", VMID: 48502, }, }, diff --git a/pkg/cloudbroker/disks/list.go b/pkg/cloudbroker/disks/list.go index abec582..e9b2093 100644 --- a/pkg/cloudbroker/disks/list.go +++ b/pkg/cloudbroker/disks/list.go @@ -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 diff --git a/pkg/cloudbroker/disks/list_deleted.go b/pkg/cloudbroker/disks/list_deleted.go index f4a6c39..d673c6f 100644 --- a/pkg/cloudbroker/disks/list_deleted.go +++ b/pkg/cloudbroker/disks/list_deleted.go @@ -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"` diff --git a/pkg/cloudbroker/disks/list_types.go b/pkg/cloudbroker/disks/list_types.go deleted file mode 100644 index b3770e5..0000000 --- a/pkg/cloudbroker/disks/list_types.go +++ /dev/null @@ -1,53 +0,0 @@ -package disks - -import ( - "context" - "encoding/json" - "net/http" - - "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" -) - -// ListTypesRequest struct to get list of types of disks -type ListTypesRequest struct { - // Show detailed disk types by seps - // Required: false - 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 of 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 := "/cloudbroker/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 - -} diff --git a/pkg/cloudbroker/disks/list_unattached.go b/pkg/cloudbroker/disks/list_unattached.go index dcee451..8a11bb9 100644 --- a/pkg/cloudbroker/disks/list_unattached.go +++ b/pkg/cloudbroker/disks/list_unattached.go @@ -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"` diff --git a/pkg/cloudbroker/disks/models.go b/pkg/cloudbroker/disks/models.go index fbfe439..e46606d 100644 --- a/pkg/cloudbroker/disks/models.go +++ b/pkg/cloudbroker/disks/models.go @@ -185,9 +185,6 @@ type InfoDisk struct { // Need to clean before destroy ToClean bool `json:"to_clean"` - // Type - Type string `json:"type"` - // Virtual machine ID VMID uint64 `json:"vmid"` @@ -322,14 +319,6 @@ type ItemSnapshot struct { // List snapshots type ListSnapshots []ItemSnapshot -type ListTypes struct { - // Data - Data []interface{} `json:"data"` - - // Entry count - EntryCount uint64 `json:"entryCount"` -} - type MigrateStatus struct { // Type Type int `json:"type"` diff --git a/pkg/cloudbroker/kvmx86/create.go b/pkg/cloudbroker/kvmx86/create.go index a02f0ba..27a44a8 100644 --- a/pkg/cloudbroker/kvmx86/create.go +++ b/pkg/cloudbroker/kvmx86/create.go @@ -235,6 +235,11 @@ type CreateRequest struct { // Boot Disk BLK Discard // Required: false BootDiskBLKDiscard interface{} `url:"boot_disk_blkdiscard,omitempty" json:"boot_disk_blkdiscard,omitempty" validate:"omitempty,isBool"` + + // Priority weight of the VM: higher value means higher priority and later migration + // Required: false + // Default: 1 + Weight uint64 `url:"weight,omitempty" json:"weight,omitempty"` } // GetRAM returns RAM field values diff --git a/pkg/cloudbroker/kvmx86/create_blank.go b/pkg/cloudbroker/kvmx86/create_blank.go index 79ddc1f..d114112 100644 --- a/pkg/cloudbroker/kvmx86/create_blank.go +++ b/pkg/cloudbroker/kvmx86/create_blank.go @@ -123,6 +123,11 @@ type CreateBlankRequest struct { // Boot Disk BLK Discard // Required: false BootDiskBLKDiscard interface{} `url:"boot_disk_blkdiscard" json:"boot_disk_blkdiscard" validate:"omitempty,isBool"` + + // Priority weight of the VM: higher value means higher priority and later migration + // Required: false + // Default: 1 + Weight uint64 `url:"weight,omitempty" json:"weight,omitempty"` } // GetRAM returns RAM field values diff --git a/pkg/cloudbroker/kvmx86/mass_create.go b/pkg/cloudbroker/kvmx86/mass_create.go index f1fa98a..5f2ddef 100644 --- a/pkg/cloudbroker/kvmx86/mass_create.go +++ b/pkg/cloudbroker/kvmx86/mass_create.go @@ -160,6 +160,11 @@ type MassCreateRequest struct { // Boot Disk BLK Discard // Required: false BootDiskBLKDiscard interface{} `url:"boot_disk_blkdiscard" json:"boot_disk_blkdiscard" validate:"omitempty,isBool"` + + // Priority weight of the VM: higher value means higher priority and later migration + // Required: false + // Default: 1 + Weight uint64 `url:"weight,omitempty" json:"weight,omitempty"` } type asyncWrapperMassCreateRequest struct { diff --git a/pkg/cloudbroker/rg/models.go b/pkg/cloudbroker/rg/models.go index 438d255..ecde0b5 100644 --- a/pkg/cloudbroker/rg/models.go +++ b/pkg/cloudbroker/rg/models.go @@ -79,6 +79,9 @@ type ListResourceConsumption struct { // Access Control List type ACL struct { + // Email + Email string `json:"email"` + // Explicit Explicit bool `json:"explicit"` diff --git a/pkg/cloudbroker/stpolicy/models.go b/pkg/cloudbroker/stpolicy/models.go index 4a86b94..88f2511 100644 --- a/pkg/cloudbroker/stpolicy/models.go +++ b/pkg/cloudbroker/stpolicy/models.go @@ -22,8 +22,8 @@ type InfoStoragePolicyWithID struct { // Max IOPS for the sotrage policy LimitIOPS uint64 `json:"limit_iops"` - // ID of the storage policy - StoragePolicyID uint64 `json:"storage_policy_id"` + // Which accounts and resource groups use the storage policy + Usage Usage `json:"usage"` } type ListStoragePolicies struct { diff --git a/tests/platform_upgrade/request_map.go b/tests/platform_upgrade/request_map.go index c8f4978..764b90b 100644 --- a/tests/platform_upgrade/request_map.go +++ b/tests/platform_upgrade/request_map.go @@ -237,7 +237,6 @@ func getRequestsMapCloudAPI() map[string]interface{} { "/restmachine/cloudapi/disks/limitIO": disks.LimitIORequest{}, "/restmachine/cloudapi/disks/list": disks.ListRequest{}, "/restmachine/cloudapi/disks/listDeleted": disks.ListDeletedRequest{}, - "/restmachine/cloudapi/disks/listTypes": disks.ListTypesRequest{}, "/restmachine/cloudapi/disks/listUnattached": disks.ListUnattachedRequest{}, "/restmachine/cloudapi/disks/rename": disks.RenameRequest{}, "/restmachine/cloudapi/disks/replicate": disks.ReplicateRequest{}, @@ -673,7 +672,6 @@ func getRequestsMapCloudbroker() map[string]interface{} { "/restmachine/cloudbroker/disks/limitIO": disks_cb.LimitIORequest{}, "/restmachine/cloudbroker/disks/list": disks_cb.ListRequest{}, "/restmachine/cloudbroker/disks/listDeleted": disks_cb.ListDeletedRequest{}, - "/restmachine/cloudbroker/disks/listTypes": disks_cb.ListTypesRequest{}, "/restmachine/cloudbroker/disks/listUnattached": disks_cb.ListUnattachedRequest{}, "/restmachine/cloudbroker/disks/rename": disks_cb.RenameRequest{}, "/restmachine/cloudbroker/disks/present": disks_cb.PresentRequest{},