You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.3 KiB
42 lines
1.3 KiB
package netobjgroups
|
|
|
|
import (
|
|
"context"
|
|
"net/http"
|
|
|
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/constants"
|
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
|
|
)
|
|
|
|
// AttachExtNetPortsRequest struct to attach external network ports to a network object group
|
|
type AttachExtNetPortsRequest struct {
|
|
// ID of a network object group
|
|
// Required: true
|
|
ObjectGroupID string `url:"object_group_id" json:"object_group_id" validate:"required"`
|
|
|
|
// ID of an access group
|
|
// Required: true
|
|
AccessGroupID string `url:"access_group_id" json:"access_group_id" validate:"required"`
|
|
|
|
// IDs of external network ports to attach to a network object group
|
|
// Required: true
|
|
PortIDs []string `url:"port_ids" json:"port_ids" validate:"required"`
|
|
}
|
|
|
|
// AttachExtNetPorts attaches external network ports to a network object group
|
|
func (nog NetworkObjectGroups) AttachExtNetPorts(ctx context.Context, req AttachExtNetPortsRequest) (bool, error) {
|
|
err := validators.ValidateRequest(req)
|
|
if err != nil {
|
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
|
}
|
|
|
|
url := "/sdn/network_object_group/attach_external_network_ports"
|
|
|
|
_, err = nog.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
|
if err != nil {
|
|
return false, err
|
|
}
|
|
|
|
return true, nil
|
|
}
|