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.
58 lines
1.6 KiB
58 lines
1.6 KiB
package netobjgroups
|
|
|
|
import (
|
|
"context"
|
|
"encoding/json"
|
|
"net/http"
|
|
|
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/constants"
|
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
|
|
)
|
|
|
|
// DetachLogicalPortsRequest struct to detach an logical port from a network object group
|
|
type DetachLogicalPortsRequest 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"`
|
|
|
|
// Version ID
|
|
// Required: true
|
|
VersionID uint64 `url:"version_id" json:"version_id" validate:"required"`
|
|
|
|
// ID of a logical port
|
|
// Required: true
|
|
LogicalPortID string `url:"logical_port_id" json:"logical_port_id" validate:"required"`
|
|
|
|
// Version of a logical port
|
|
// Required: true
|
|
LogicalPortVersion uint64 `url:"logical_port_version" json:"logical_port_version" validate:"required"`
|
|
}
|
|
|
|
// DetachLogicalPorts detaches logical ports from a network object group
|
|
func (nog NetworkObjectGroups) DetachLogicalPorts(ctx context.Context, req DetachLogicalPortsRequest) (*RecordVersion, error) {
|
|
err := validators.ValidateRequest(req)
|
|
if err != nil {
|
|
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
|
}
|
|
|
|
url := "/sdn/network_object_group/detach_logical_ports"
|
|
|
|
res, err := nog.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
info := RecordVersion{}
|
|
|
|
err = json.Unmarshal(res, &info)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &info, nil
|
|
}
|