This commit is contained in:
asteam
2025-09-26 18:56:58 +03:00
parent f1ffb4c0fd
commit 48e2b0f2f9
931 changed files with 1444 additions and 1130 deletions

View File

@@ -2,7 +2,7 @@
package extnet
import (
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v9/interfaces"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/interfaces"
)
// Structure for creating request to extnet

View File

@@ -5,7 +5,7 @@ import (
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v9/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
)
// GetRequest struct to get detailed information about external network

View File

@@ -0,0 +1,50 @@
package extnet
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/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
}

View File

@@ -5,7 +5,7 @@ import (
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v9/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
)
// ListRequest struct to get list of external network

View File

@@ -5,7 +5,7 @@ import (
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v9/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
)
// ListComputesRequest struct to get list computes

View File

@@ -87,6 +87,9 @@ type QOS struct {
// Main information about reservations
type ItemReservation struct {
// Account ID
AccountID uint64 `json:"account_id"`
// ClientType
ClientType string `json:"clientType"`
@@ -226,3 +229,20 @@ type RecordExtNet struct {
// VNFs
VNFs VNFs `json:"vnfs"`
}
// Detailed information about reserved address or address pool
type RecordReservedIP struct {
ExtnetID int `json:"extnet_id"`
Reservations []Reservations `json:"reservations"`
}
type Reservations struct {
AccountID int `json:"account_id"`
ClientType string `json:"clientType"`
DomainName string `json:"domainname"`
Hostname string `json:"hostname"`
IP string `json:"ip"`
Mac string `json:"mac"`
Type string `json:"type"`
VMID int `json:"vmId"`
}

View File

@@ -3,7 +3,7 @@ package extnet
import (
"encoding/json"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v9/internal/serialization"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/serialization"
)
// Serialize returns JSON-serialized []byte. Used as a wrapper over json.Marshal and json.MarshalIndent functions.