parent
88eb9e8898
commit
e04dc42d2b
@ -0,0 +1,50 @@
|
||||
package extnet
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// GetRequest struct to get information about reserved address or address poll
|
||||
type GetReservedIP struct {
|
||||
// AccountID of the account whose reservation information we want to receive
|
||||
// Required: true
|
||||
AccountID uint64 `url:"accountId" json:"accountId" validate:"required"`
|
||||
|
||||
// Field for specifying the ID of extnet whose reservation information we want to receive
|
||||
// Required: false
|
||||
ExtNetID uint64 `url:"extnetId,omitempty" json:"extnetId,omitempty"`
|
||||
}
|
||||
|
||||
// GetReservedIP gets information about reserved address or address poll as a slice of RecordReservedIP struct
|
||||
func (e ExtNet) GetReservedIP(ctx context.Context, req GetReservedIP) ([]RecordReservedIP, error) {
|
||||
res, err := e.GetReservedIPRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
reservedIP := make([]RecordReservedIP, 0)
|
||||
|
||||
err = json.Unmarshal(res, &reservedIP)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return reservedIP, nil
|
||||
}
|
||||
|
||||
// GetRaw gets detailed information about external network as an array of bytes
|
||||
func (e ExtNet) GetReservedIPRaw(ctx context.Context, req GetReservedIP) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudapi/extnet/getReservedIp"
|
||||
|
||||
res, err := e.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
package extnet
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// AddReserveIPRequest struct to reserved address or address poll
|
||||
type AddReserveIPRequest struct {
|
||||
// AccountID to which a reserved address or address pool is added
|
||||
// Required: true
|
||||
AccountID uint64 `url:"accountId" json:"accountId" validate:"required"`
|
||||
|
||||
// ExtNetID from which the address or address pool is reserved
|
||||
// Required: true
|
||||
ExtNetID uint64 `url:"extnetId" json:"extnetId" validate:"required"`
|
||||
|
||||
// Field for specifying the number of reserved addresses
|
||||
// Required: false
|
||||
IPCount uint64 `url:"ipCount,omitempty" json:"ipCount,omitempty"`
|
||||
|
||||
// List of IPs for specifying the desired address
|
||||
// Required: false
|
||||
IPs []string `url:"ips,omitempty" json:"ips,omitempty"`
|
||||
}
|
||||
|
||||
// AddReserveIP reserves address or address poll to external network for account ID
|
||||
func (e ExtNet) AddReserveIP(ctx context.Context, req AddReserveIPRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/extnet/addReservedIp"
|
||||
|
||||
res, err := e.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
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
package extnet
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// DelReserveIPRequest struct to delete reserved address or address poll
|
||||
type DelReserveIPRequest struct {
|
||||
// AccountID to which a reserved address or address pool is added
|
||||
// Required: true
|
||||
AccountID uint64 `url:"accountId" json:"accountId" validate:"required"`
|
||||
|
||||
// ExtNetID from which the address or address pool is reserved
|
||||
// Required: true
|
||||
ExtNetID uint64 `url:"extnetId" json:"extnetId" validate:"required"`
|
||||
|
||||
// Field for specifying the number of reserved addresses
|
||||
// Required: false
|
||||
IPCount uint64 `url:"ipCount,omitempty" json:"ipCount,omitempty"`
|
||||
|
||||
// List of IPs for specifying the desired address
|
||||
// Required: false
|
||||
IPs []string `url:"ips,omitempty" json:"ips,omitempty"`
|
||||
}
|
||||
|
||||
// DelReserveIP deletes reserved address or address poll to external network for account ID
|
||||
func (e ExtNet) DelReserveIP(ctx context.Context, req DelReserveIPRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/extnet/delReservedIp"
|
||||
|
||||
res, err := e.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
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
package extnet
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// GetRequest struct to get information about reserved address or address poll
|
||||
type GetReservedIP struct {
|
||||
// AccountID of the account whose reservation information we want to receive
|
||||
// Required: true
|
||||
AccountID uint64 `url:"accountId" json:"accountId" validate:"required"`
|
||||
|
||||
// Field for specifying the ID of extnet whose reservation information we want to receive
|
||||
// Required: false
|
||||
ExtNetID uint64 `url:"extnetId,omitempty" json:"extnetId,omitempty"`
|
||||
}
|
||||
|
||||
// GetReservedIP gets information about reserved address or address poll as a slice of RecordReservedIP struct
|
||||
func (e ExtNet) GetReservedIP(ctx context.Context, req GetReservedIP) ([]RecordReservedIP, error) {
|
||||
res, err := e.GetReservedIPRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
reservedIP := make([]RecordReservedIP, 0)
|
||||
|
||||
err = json.Unmarshal(res, &reservedIP)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return reservedIP, nil
|
||||
}
|
||||
|
||||
// GetRaw gets detailed information about external network as an array of bytes
|
||||
func (e ExtNet) GetReservedIPRaw(ctx context.Context, req GetReservedIP) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/extnet/getReservedIp"
|
||||
|
||||
res, err := e.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
package sep
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// UpdateCapacityLimitRequest struct to update capacity limits
|
||||
type UpdateCapacityLimitRequest struct {
|
||||
// Storage endpoint provider ID
|
||||
// Required: true
|
||||
SEPID uint64 `url:"sep_id" json:"sep_id" validate:"required"`
|
||||
}
|
||||
|
||||
// UpdateCapacityLimit updates SEP capacity limit
|
||||
func (s SEP) UpdateCapacityLimit(ctx context.Context, req UpdateCapacityLimitRequest) (uint64, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return 0, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/sep/updateCapacityLimit"
|
||||
|
||||
res, err := s.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
result, err := strconv.ParseUint(string(res), 10, 64)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
[
|
||||
"Account list: OK",
|
||||
"Account get: OK",
|
||||
"",
|
||||
"Bservice get: OK",
|
||||
"Compute list: \nPlatform has these fields that golang struct doesn't: [lb mgmt_target mgmt_mac mgmt_slot]\n",
|
||||
"Compute get: \nPlatform has these fields that golang struct doesn't: [mgmt_target mgmt_mac mgmt_slot lb]\n",
|
||||
"Disk list: OK",
|
||||
"Disk get: OK",
|
||||
"",
|
||||
"ExtNet get: OK",
|
||||
"FLIPGroup list: OK",
|
||||
"",
|
||||
"",
|
||||
"Image get: \nPlatform has these fields that golang struct doesn't: [12]\n",
|
||||
"K8CI list: OK",
|
||||
"",
|
||||
"K8S list: OK",
|
||||
"K8S get: OK",
|
||||
"LB list: \nPlatform has these fields that golang struct doesn't: [fs.inotify.max_queued_events kernel.kptr_restrict net.ipv4.tcp_congestion_control]\n",
|
||||
"LB get: \nPlatform has these fields that golang struct doesn't: [kernel.kptr_restrict net.ipv4.tcp_congestion_control fs.inotify.max_queued_events]\n",
|
||||
"Locations list: OK",
|
||||
"RG list: OK",
|
||||
"",
|
||||
"Sizes list: OK",
|
||||
"",
|
||||
"Tasks list: \nPlatform has these fields that golang struct doesn't: [completed guid stage updateTime updatedTime auditId error log status]\n",
|
||||
"Tasks get: \nPlatform has these fields that golang struct doesn't: [updatedTime completed error updateTime auditId stage status log]\n",
|
||||
"",
|
||||
"VINS get: OK"
|
||||
]
|
@ -1,34 +0,0 @@
|
||||
[
|
||||
"Account list: OK",
|
||||
"Account get: OK",
|
||||
"",
|
||||
"Audit get: OK",
|
||||
"Compute list: \nPlatform has these fields that golang struct doesn't: [disks]\n",
|
||||
"Compute get: OK",
|
||||
"Disk list: \nPlatform has these fields that golang struct doesn't: [machineId machineName sepType devicename]\n",
|
||||
"Disk get: \nPlatform has these fields that golang struct doesn't: [devicename sepType updatedBy]\n",
|
||||
"ExtNet list: OK",
|
||||
"ExtNet get: OK",
|
||||
"FLIPGroup list: OK",
|
||||
"",
|
||||
"Grid list: \nPlatform has these fields that golang struct doesn't: [1 90 380 1 90 380]\n",
|
||||
"Grid get: OK",
|
||||
"Image list: OK",
|
||||
"Image get: OK",
|
||||
"K8CI list: \nPlatform has these fields that golang struct doesn't: [createdTime]\n",
|
||||
"K8CI get: OK",
|
||||
"K8S list: OK",
|
||||
"K8S get: OK",
|
||||
"LB list: OK",
|
||||
"LB get: OK",
|
||||
"Pcidevice list: OK",
|
||||
"RG list: OK",
|
||||
"RG get: OK",
|
||||
"SEP list: \nPlatform has these fields that golang struct doesn't: [protocol disk_max_size format name name_prefix pools]\n",
|
||||
"SEP get: \nPlatform has these fields that golang struct doesn't: [format name name_prefix pools protocol disk_max_size]\n",
|
||||
"Stack list: OK",
|
||||
"Stack get: OK",
|
||||
"Tasks list: \nPlatform has these fields that golang struct doesn't: [stage status error log auditId completed updateTime guid]\n",
|
||||
"",
|
||||
"VINS get: \nPlatform has these fields that golang struct doesn't: [computes config config config]\n"
|
||||
]
|
@ -1,14 +0,0 @@
|
||||
[
|
||||
"Path /cloudapi/compute/antiAffinityRuleAdd has following errors: [Field value has different required parameters on the platform and in golang structure]",
|
||||
"Path /cloudapi/user/setData has following errors: [Field data has different required parameters on the platform and in golang structure]",
|
||||
"Path /cloudapi/compute/affinityRuleRemove has following errors: [Field value has different required parameters on the platform and in golang structure]",
|
||||
"Path /cloudapi/compute/createTemplate has following errors: [Platform (3) and golang structure (2) have different amount of fields. Platform has field asyncMode that golang structure doesn't]",
|
||||
"Path /cloudapi/k8s/create has following errors: [Field oidcCertificate has different type parameters on the platform and in golang structure]",
|
||||
"Path /cloudapi/disks/fromPlatformDisk has following errors: [Platform (14) and golang structure (13) have different amount of fields. Field drivers has different type parameters on the platform and in golang structure Platform has field asyncMode that golang structure doesn't]",
|
||||
"Path /cloudapi/compute/affinityRuleAdd has following errors: [Field value has different required parameters on the platform and in golang structure]",
|
||||
"Path /cloudapi/compute/antiAffinityRuleRemove has following errors: [Field value has different required parameters on the platform and in golang structure]",
|
||||
"Path /cloudapi/compute/createTemplateFromBlank has following errors: [Platform (11) and golang structure (10) have different amount of fields. Platform has field asyncMode that golang structure doesn't]",
|
||||
"Path /cloudapi/lb/create has following errors: [Field extnetId has different required parameters on the platform and in golang structure Field vinsId has different required parameters on the platform and in golang structure]",
|
||||
"Path /cloudapi/image/list has following errors: [Field size has different type parameters on the platform and in golang structure]",
|
||||
"Path /cloudapi/compute/snapshotDelete has following errors: [Platform (3) and golang structure (2) have different amount of fields. Platform has field asyncMode that golang structure doesn't]"
|
||||
]
|
@ -1 +0,0 @@
|
||||
["Path /cloudbroker/compute/createTemplate has following errors: [Platform (4) and golang structure (3) have different amount of fields. Platform has field asyncMode that golang structure doesn't]","Path /cloudbroker/backup/createDisksBackup has following errors: [Platform (3) and golang structure (2) have different amount of fields. Platform has field asyncMode that golang structure doesn't]","Path /cloudbroker/compute/affinityRuleAdd has following errors: [Field value has different required parameters on the platform and in golang structure]","Path /cloudbroker/apiaccess/update has following errors: [Platform has field apis that golang structure doesn't]","Path /cloudbroker/compute/antiAffinityRuleRemove has following errors: [Field value has different required parameters on the platform and in golang structure]","Path /cloudbroker/compute/snapshotDelete has following errors: [Platform (3) and golang structure (2) have different amount of fields. Platform has field asyncMode that golang structure doesn't]","Path /cloudbroker/backup/restoreDiskFromBackup has following errors: [Platform (5) and golang structure (4) have different amount of fields. Platform has field asyncMode that golang structure doesn't]","Path /cloudbroker/backup/createDiskBackup has following errors: [Platform (4) and golang structure (3) have different amount of fields. Platform has field asyncMode that golang structure doesn't]","Path /cloudbroker/compute/createTemplateFromBlank has following errors: [Platform (11) and golang structure (10) have different amount of fields. Platform has field asyncMode that golang structure doesn't]","Path /cloudbroker/account/setCpuAllocationRatio has following errors: [Field ratio has different required parameters on the platform and in golang structure]","Path /cloudbroker/disks/fromPlatformDisk has following errors: [Platform (14) and golang structure (13) have different amount of fields. Field drivers has different type parameters on the platform and in golang structure Platform has field asyncMode that golang structure doesn't]","Path /cloudbroker/lb/create has following errors: [Field extnetId has different required parameters on the platform and in golang structure Field vinsId has different required parameters on the platform and in golang structure]","Path /cloudbroker/stack/setCpuAllocationRatio has following errors: [Field ratio has different required parameters on the platform and in golang structure]","Path /cloudbroker/backup/deleteDiskBackup has following errors: [Platform (3) and golang structure (2) have different amount of fields. Platform has field asyncMode that golang structure doesn't]","Path /cloudbroker/image/updateNodes has following errors: [Field enabledStacks has different type parameters on the platform and in golang structure]","Path /cloudbroker/stack/setMemAllocationRatio has following errors: [Field ratio has different required parameters on the platform and in golang structure]","Path /cloudbroker/compute/antiAffinityRuleAdd has following errors: [Field value has different required parameters on the platform and in golang structure]","Path /cloudbroker/k8s/create has following errors: [Field oidcCertificate has different type parameters on the platform and in golang structure]","Path /cloudbroker/backup/restoreDisksFromBackup has following errors: [Platform (3) and golang structure (2) have different amount of fields. Platform has field disks that golang structure doesn't Platform has field asyncMode that golang structure doesn't]","Path /cloudbroker/node/enable has following errors: [Platform (4) and golang structure (3) have different amount of fields. Platform has field asyncMode that golang structure doesn't]","Path /cloudbroker/compute/affinityRuleRemove has following errors: [Field value has different required parameters on the platform and in golang structure]","Path /cloudbroker/image/list has following errors: [Field size has different type parameters on the platform and in golang structure]"]
|
Loading…
Reference in new issue