v14.8.0
This commit is contained in:
@@ -2,6 +2,7 @@ package netobjgroups
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
|
||||
@@ -26,6 +27,7 @@ type AttachLogicalPortsRequest struct {
|
||||
// Required: true
|
||||
PortBindings []PortBindings `url:"port_bindings" json:"port_bindings" validate:"required,dive"`
|
||||
}
|
||||
|
||||
type PortBindings struct {
|
||||
// ID of a logical port
|
||||
// Required: true
|
||||
@@ -37,18 +39,25 @@ type PortBindings struct {
|
||||
}
|
||||
|
||||
// AttachLogicalPorts attaches logical ports to a network object group
|
||||
func (nog NetworkObjectGroups) AttachLogicalPorts(ctx context.Context, req AttachLogicalPortsRequest) (bool, error) {
|
||||
func (nog NetworkObjectGroups) AttachLogicalPorts(ctx context.Context, req AttachLogicalPortsRequest) (*RecordVersion, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/sdn/network_object_group/attach_logical_ports"
|
||||
|
||||
_, err = nog.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||
res, err := nog.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return true, nil
|
||||
info := RecordVersion{}
|
||||
|
||||
err = json.Unmarshal(res, &info)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user