This commit is contained in:
dayterr
2026-04-17 17:10:10 +03:00
parent cd67633a52
commit 5e5d90e24f
22 changed files with 752 additions and 112 deletions

View File

@@ -0,0 +1,46 @@
package segments
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
)
// GetFAARequest struct to get the floating/anycast IP address of a segment
type GetFAARequest struct {
// ID of segment
// Required: true
SegmentID string `url:"segment_id" json:"segment_id" validate:"required"`
}
// GetFAA gets the floating/anycast IP address info for a segment
func (s Segments) GetFAA(ctx context.Context, req GetFAARequest) (*GetFAAResponse, error) {
res, err := s.GetFAARaw(ctx, req)
if err != nil {
return nil, err
}
info := GetFAAResponse{}
err = json.Unmarshal(res, &info)
if err != nil {
return nil, err
}
return &info, nil
}
// GetFAARaw gets the floating/anycast IP address info for a segment as an array of bytes
func (s Segments) GetFAARaw(ctx context.Context, req GetFAARequest) ([]byte, error) {
err := validators.ValidateRequest(req)
if err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/sdn/segment/get_faa"
res, err := s.client.DecortApiCall(ctx, http.MethodGet, url, req)
return res, err
}