diff --git a/CHANGELOG.md b/CHANGELOG.md index 8170a12..875d3a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## Version 1.15.5 +## Version 1.15.6 Методы `Audits` в cloudapi/compute, cloudbroker/compute, cloudapi/account, cloudbroker/account, cloudapi/vins, cloudbroker/vins, cloudapi/rg и cloudbroker/rg стали deprecated и будут удалены в версии 1.16, вместо них необходимо использовать метод `List` в cloudapi/audit и cloudbroker/audit с соответствующими фильтрами Методы `AccessGrant`, `AccessGrantToPool`, `AccessRevoke`, `AccessRevokeToPool` в cloudbroker/sep стали deprecated и будут удалены в версии 1.16 @@ -11,69 +11,52 @@ Методы `ExecuteMaintenanceScript`, `ListEmails`, `ServicesRestart` в cloudbroker/grid стали deprecated и будут удалены в версии 1.16 Метод `Get` в cloudbroker/group стал deprecated и будет удален в версии 1.16 + + ### Добавлено #### compute | Идентификатор задачи | Описание | | --- | --- | -| BGOS-954 | Вычисляемое поле `ResizedOnline` в структуры ответа `RecordCompute` и `ItemCompute` в cloudapi/compute и cloudbroker/compute | +| BGOS-962 | Вычисляемое поле `NodeID` в структуру `SnapRecordCompute` в cloudapi/compute | +| BGOS-960 | Структура ответа `SnapRecordCompute` в cloudbroker/compute | -#### resmon +#### SDN netobjgroups | Идентификатор задачи | Описание | | --- | --- | -| BGOS-947 | Вычисляемое поле `UID` в структуру ответа `GetByNodePoint` в cloudbroker/resmon | -| BGOS-947 | Вычисляемые поля `ThreadCount`, `ModelName`, `Flags` и `MaxSupportedGeneration` в структуру ответа `CPUinfoByNode` в cloudbroker/resmon | -| BGOS-947 | Вычисляемые поля `UsedGiB` и `TotalGiB` в структуру ответа `ItemStorage` в cloudbroker/resmon | +| BGOS-961 | Вычисляемые поля `Comment`, `DisplayName`, `Enabled`, `ExternalNetworkID`, `IPv4` и `MAC` в структуру ответа `ExternalNetworkPort` в sdn/netobjgroups | -#### SDN logicalports -| Идентификатор задачи | Описание | -| --- | --- | -| BGOS-951 | Вычисляемое поле `ExcludeFirewall` в структуру ответа `LogicalPort` в sdn/logicalports | ### Изменено #### compute | Идентификатор задачи | Описание | | --- | --- | -| BGOS-958 | Тип возвращаемого значения с `string` на `RecordMigrateStorageInfo` в методе `MigrateStorageInfo` в cloudbroker/compute | +| BGOS-960 | Тип вычисляемого поля `Compute` в структуре ответа `ItemSnapshot` с `RecordCompute` на `SnapRecordCompute` в cloudbroker/compute | -#### resmon + +### Исправлено + +#### sep | Идентификатор задачи | Описание | | --- | --- | -| BGOS-947 | Тип вычисляемых полей `CPUTime` и `RAMConsumedReal` с `uint64` на `float64` в структуре ответа `ComputeUsage` в cloudbroker/resmon | -| BGOS-947 | Тип вычисляемого поля `IsUp` с `uint64` на `bool` в структуре ответа `ComputeUsage` в cloudbroker/resmon | -| BGOS-947 | Тип вычисляемого поля `SizeMax` с `float64` на `uint64` в структуре ответа `ItemDisk` в cloudbroker/resmon | -| BGOS-947 | Тип вычисляемых полей `CPUPower`, `CPUUtil`, `TotalMem`, `ReservedMem`, `UsedMem` и `FreeMem` с `uint64` на `float64` в структуре ответа `ItemTotalByGRID` в cloudbroker/resmon | -| BGOS-947 | Тип вычисляемых полей `PCPU` и `CPUUtil` с `uint64` на `float64` в структуре ответа `NodeUsage` в cloudbroker/resmon | - -#### SDN hypervisors -| Идентификатор задачи | Описание | -| --- | --- | -| BGOS-956 | Тип возвращаемого значения в методе `Delete` c `bool` на `RecordVersion` в sdn/hypervisors | - -#### SDN logicalports -| Идентификатор задачи | Описание | -| --- | --- | -| BGOS-951 | Тип опционального поля `LogicalPortAddresses` в структуре запроса `CreateRequest` с `[]LogicalPortAddress` на `[]LogicalPortAddressRequest` в sdn/logicalports | -| BGOS-951 | Тип обязательного поля `IP` в структуре запроса `LogicalPortAddressRequest` с `string` на `interface{}` в sdn/logicalports | -| BGOS-951 | Тип обязательного поля `IsDiscovered` в структуре запроса `UpdateAddress` и `AddAddress` с `bool` на `interface{}` в sdn/logicalports | -| BGOS-951 | Тип опционального поля `Labels` в структуре запроса `CreateRequest` с `CreateLabels` на `*CreateLabels` в sdn/logicalports | -| BGOS-951 | Тип опционального поля `Labels` в структуре запроса `UpdateRequest` с `UpdateLabels` на `*UpdateLabels` в sdn/logicalports | +| BGOS-949 | Тип возвращаемого значения в методе `AddConsumerNodes` с `uint64` на `[]uint64` в cloudbroker/sep | #### SDN netobjgroups | Идентификатор задачи | Описание | | --- | --- | -| BGOS-957 | Тип вычисляемого поля `ExternalNetworkPorts` с массива на объект в sdn/netobjgroups | +| BGOS-959 | Тип вычисляемого поля `ExternalNetworkPorts` с объекта на массив в sdn/netobjgroups | + ### Удалено -#### resmon +#### compute | Идентификатор задачи | Описание | | --- | --- | -| BGOS-947 | Вычисляемые поля `NodesCPU`, `StorageCapacity` и `VCPUConsumed` из структуры ответа `ItemTotalByGRID` в cloudbroker/resmon | -| BGOS-947 | Вычисляемые поля `CapacityLimit`, `Consumed`, `Type` и `UID` из структуры ответа `ItemStorage` в cloudbroker/resmon | +| BGOS-960 | Вычисляемое поле `SnapSets` из структуры ответа `SnapRecordCompute` в cloudapi/compute | +| BGOS-962 | Вычисляемое поле `NodeID` из структуры ответа `RecordCompute` в cloudapi/compute | #### SDN netobjgroups | Идентификатор задачи | Описание | | --- | --- | -| BGOS-957 | Вычисляемые поля `Comment`, `Enabled`, `IPv4` и `MAC` в структуре `ExternalNetworkPorts` в структуре ответа `RecordNetObjGroup` в sdn/netobjgroups | \ No newline at end of file +| BGOS-961 | Вычисляемые поля `BridgeNetworkName`, `DefaultGatewayIPv4` `DefaultGatewayIPv6`, `Description`, `ExternalNetworkPorts`, `Hypervisors`, `Status`, `SubnetV4`, `SubnetV6`, `CreatedAt`, `UpdatedAt`, `VLANTag` из структуры `ExternalNetworkPort` в структуре ответа `RecordNetObjGroup` в sdn/netobjgroups | \ No newline at end of file diff --git a/client.go b/client.go index c286da8..bab3efb 100644 --- a/client.go +++ b/client.go @@ -34,7 +34,7 @@ type DecortClient struct { mutex *sync.Mutex } -// Сlient builder +// Client builder func New(cfg config.Config) *DecortClient { if err := validators.ValidateConfig(cfg); err != nil { panic(validators.ValidationErrors(validators.GetErrors(err))) diff --git a/pkg/cloudapi/compute/models.go b/pkg/cloudapi/compute/models.go index 47cdce0..5ffb113 100644 --- a/pkg/cloudapi/compute/models.go +++ b/pkg/cloudapi/compute/models.go @@ -482,9 +482,6 @@ type RecordCompute struct { // Natable VINS network name NatableVINSNetworkName string `json:"natableVinsNetworkName"` - // Node ID - NodeID uint64 `json:"node_id"` - // Name of OS OSVersion string `json:"os_version"` @@ -722,6 +719,9 @@ type SnapRecordCompute struct { // Network interface naming NetworkInterfaceNaming string `json:"networkInterfaceNaming"` + // Node ID + NodeID uint64 `json:"node_id"` + // Numa Affinity NumaAffinity string `json:"numaAffinity"` @@ -785,9 +785,6 @@ type SnapRecordCompute struct { // Resource group name RGName string `json:"rgName"` - // List snapsets - SnapSets ListSnapSets `json:"snapSets"` - // Stateless SepID StatelessSepID int64 `json:"statelessSepId"` diff --git a/pkg/cloudbroker/compute/models.go b/pkg/cloudbroker/compute/models.go index 99f3f59..9169494 100644 --- a/pkg/cloudbroker/compute/models.go +++ b/pkg/cloudbroker/compute/models.go @@ -68,7 +68,7 @@ type ListACL []ItemACL // Main information about snapshot type ItemSnapshot struct { // Compute info - Compute RecordCompute `json:"compute"` + Compute SnapRecordCompute `json:"compute"` // List of disk IDs Disks []uint64 `json:"disks"` @@ -1239,6 +1239,270 @@ type RecordCompute struct { _ uint64 `json:"nodeId"` } +// SnapRecordCompute is RecordCompute but without the SnapSets field +type SnapRecordCompute struct { + // Account ID + AccountID uint64 `json:"accountId"` + + // Account name + AccountName string `json:"accountName"` + + // Access Control List + ACL []interface{} `json:"acl"` + + // Affinity label + AffinityLabel string `json:"affinityLabel"` + + // Affinity rules + AffinityRules ListRules `json:"affinityRules"` + + // Affinity weight + AffinityWeight uint64 `json:"affinityWeight"` + + // Anti affinity rules + AntiAffinityRules ListRules `json:"antiAffinityRules"` + + // Auto start when node restarted + AutoStart bool `json:"autoStart"` + + // Architecture + Arch string `json:"arch"` + + // Boot image ID + BootImageID uint64 `json:"boot_image_id"` + + // Boot order + BootOrder []string `json:"bootOrder"` + + // Boot type + BootType string `json:"bootType"` + + // Boot disk size + BootDiskSize uint64 `json:"bootdiskSize"` + + // CD Image Id + CdImageId uint64 `json:"cdImageId"` + + // Chipset + Chipset string `json:"chipset"` + + // Clone reference + CloneReference uint64 `json:"cloneReference"` + + // Clock + Clock string `json:"clock"` + + // List clone IDs + Clones []uint64 `json:"clones"` + + // Compute CI ID + ComputeCIID uint64 `json:"computeciId"` + + // CPU Pin + CPUPin bool `json:"cpupin"` + + // Number of CPU + CPUs uint64 `json:"cpus"` + + // Created by + CreatedBy string `json:"createdBy"` + + // Created time + CreatedTime uint64 `json:"createdTime"` + + // Custom fields + CustomFields map[string]interface{} `json:"customFields"` + + // Deleted by + DeletedBy string `json:"deletedBy"` + + // Deleted time + DeletedTime uint64 `json:"deletedTime"` + + // Description + Description string `json:"desc"` + + // Devices + Devices interface{} `json:"devices"` + + // List disks + Disks ListDisks `json:"disks"` + + // Driver + Driver string `json:"driver"` + + // Grid ID + GID uint64 `json:"gid"` + + // GUID + GUID uint64 `json:"guid"` + + // HPBacked + HPBacked bool `json:"hpBacked"` + + // Hot resize + HotResize bool `json:"hotResize"` + + // ID + ID uint64 `json:"id"` + + // Image ID + ImageID uint64 `json:"imageId"` + + // Image name + ImageName string `json:"imageName"` + + // List interfaces + Interfaces ListInterfaces `json:"interfaces"` + + // Loader meta iso information + LoaderMetaIso LoaderMetaIso `json:"loaderMetaIso"` + + // Live migration job ID + LiveMigrationJobID uint64 `json:"live_migration_job_id"` + + // Loader type + LoaderType string `json:"loaderType"` + + // Lock status + LockStatus string `json:"lockStatus"` + + // Manager ID + ManagerID uint64 `json:"managerId"` + + // Manager type + ManagerType string `json:"managerType"` + + // Migration job + MigrationJob uint64 `json:"migrationjob"` + + // Milestones + Milestones uint64 `json:"milestones"` + + // Name + Name string `json:"name"` + + // Natable VINS ID + NatableVINSID uint64 `json:"natableVinsId"` + + // Natable VINS IP + NatableVINSIP string `json:"natableVinsIp"` + + // Natable VINS Name + NatableVINSName string `json:"natableVinsName"` + + // Natable VINS network + NatableVINSNetwork string `json:"natableVinsNetwork"` + + // Natable VINS network name + NatableVINSNetworkName string `json:"natableVinsNetworkName"` + + // Need reboot + NeedReboot bool `json:"needReboot"` + + // network interface naming + NetworkInterfaceNaming string `json:"networkInterfaceNaming"` + + // NumaAffinity + NumaAffinity string `json:"numaAffinity"` + + //NumaNodeId + NumaNodeId int64 `json:"numaNodeId"` + + // List OS users + OSUsers ListOSUsers `json:"osUsers"` + + // Name of OS + OSVersion string `json:"os_version"` + + // Pinned to node + PinnedToNode int64 `json:"pinnedToNode"` + + // PreferredCPU + PreferredCPU []int64 `json:"preferredCpu"` + + // CPU alignment profile + CPUAlignmentProfile CPUAlignmentProfile `json:"cpu_alignment_profile"` + + // Qemu_quest + QemuQuest QemuQuest `json:"qemu_guest"` + + // ReadOnly indicates read-only mode state + ReadOnly bool `json:"read_only"` + + // Number of RAM + RAM uint64 `json:"ram"` + + // Reference ID + ReferenceID string `json:"referenceId"` + + // Registered + Registered bool `json:"registered"` + + // Whether a compute has been resized online + ResizedOnline bool `json:"resizedOnline"` + + // Resource name + ResName string `json:"resName"` + + // Reserved Node Cpus + ReservedNodeCpus []uint64 `json:"reservedNodeCpus"` + + // Resource group ID + RGID uint64 `json:"rgId"` + + // Resource group name + RGName string `json:"rgName"` + + // Node ID + NodeID uint64 `json:"node_id"` + + // Node name + NodeName string `json:"nodeName"` + + // Stateless SEP ID + StatelessSEPID int64 `json:"statelessSepId"` + + // Stateless SEP Type + StatelessSEPType string `json:"statelessSepType"` + + // Status + Status string `json:"status"` + + // Tags + Tags map[string]interface{} `json:"tags"` + + // Tech status + TechStatus string `json:"techStatus"` + + // Total disk size + TotalDiskSize uint64 `json:"totalDisksSize"` + + // Updated by + UpdatedBy string `json:"updatedBy"` + + // Updated time + UpdatedTime uint64 `json:"updatedTime"` + + // User managed + UserManaged bool `json:"userManaged"` + + // Userdata + Userdata interface{} `json:"userdata"` + + // List VGPU + VGPUs []VGPUItem `json:"vgpus"` + + // VNC password + VNCPassword string `json:"vncPasswd"` + + // Weight + Weight uint64 `json:"weight"` + + // Zone ID + ZoneID uint64 `json:"zoneId"` +} + type LoaderMetaIso struct { // Name DeviceName string `json:"devicename"` diff --git a/pkg/cloudbroker/sep/add_consumer_nodes.go b/pkg/cloudbroker/sep/add_consumer_nodes.go index eb6e3e8..59d67f7 100644 --- a/pkg/cloudbroker/sep/add_consumer_nodes.go +++ b/pkg/cloudbroker/sep/add_consumer_nodes.go @@ -2,8 +2,8 @@ package sep import ( "context" + "encoding/json" "net/http" - "strconv" "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) @@ -20,23 +20,24 @@ type AddConsumerNodesRequest struct { } // AddConsumerNodes adds consumer nodes to SEP parameters -func (s SEP) AddConsumerNodes(ctx context.Context, req AddConsumerNodesRequest) (uint64, error) { +func (s SEP) AddConsumerNodes(ctx context.Context, req AddConsumerNodesRequest) ([]uint64, error) { err := validators.ValidateRequest(req) + list := []uint64{} if err != nil { - return 0, validators.ValidationErrors(validators.GetErrors(err)) + return list, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/sep/addConsumerNodes" res, err := s.client.DecortApiCall(ctx, http.MethodPost, url, req) if err != nil { - return 0, err + return list, err } - result, err := strconv.ParseUint(string(res), 10, 64) + err = json.Unmarshal(res, &list) if err != nil { - return 0, err + return nil, err } - return result, nil + return list, nil } diff --git a/pkg/sdn/netobjgroups/models.go b/pkg/sdn/netobjgroups/models.go index 3f0e963..7c65602 100644 --- a/pkg/sdn/netobjgroups/models.go +++ b/pkg/sdn/netobjgroups/models.go @@ -181,55 +181,39 @@ type L2ExternalNetwork struct { VLANTag *int `json:"vlan_tag"` } +type ExternalNetworkPorts []ExternalNetworkPort + // Info about an external network port -type ExternalNetworkPorts struct { +type ExternalNetworkPort struct { // Access group ID AccessGroupID string `json:"access_group_id"` // Access group name AccessGroupName string `json:"access_group_name"` - // Bridge network name - BridgeNetworkName string `json:"bridge_network_name"` + // Comment + Comment string `json:"comment"` - // Default gateway for IPv4 - DefaultGatewayIPv4 string `json:"default_gateway_ipv4"` + // The name displayed + DisplayName string `json:"display_name"` - // Default gateway for IPv6 - DefaultGatewayIPv6 string `json:"default_gateway_ipv6"` + // Whether the port is enabled + Enabled bool `json:"enabled"` - // Description - Description string `json:"description"` - - // Details of external network ports - ExternalNetworkPorts ExternalNetworkPortsField `json:"external_network_ports"` - - // Hypervisors - Hypervisors []string `json:"hypervisors"` + // The ID of the external network + ExternalNetworkID string `json:"external_network_id"` // ID of an external network port ID string `json:"id"` - // Status - Status Status `json:"status"` + // IP of version 4 + IPv4 string `json:"ipv4"` // Version ID VersionID uint64 `json:"version_id"` - // Subnet for V4 - SubnetV4 string `json:"subnet_v4"` - - // Subnet for V6 - SubnetV6 string `json:"subnet_v6"` - - // Created at - CreatedAt string `json:"created_at"` - - // Updated at - UpdatedAt string `json:"updated_at"` - - // VLAN Tag - VLANTag int `json:"vlan_tag"` + // MAC + MAC string `json:"mac"` } // Info about a logical port