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.
dynamix-golang-sdk/pkg/sdn/netobjgroups/detach_external_network_por...

50 lines
1.5 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"
)
// DetachExtNetPortsRequest struct to detach an external network port from a network object group
type DetachExtNetPortsRequest 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"`
// ID of an external network port to detach from a network object group
// Required: true
ExternalNetworkPortID string `url:"external_network_port_id" json:"external_network_port_id" validate:"required"`
}
// DetachExtNetlPorts detaches external network ports from a network object group
func (nog NetworkObjectGroups) DetachExtNetPorts(ctx context.Context, req DetachExtNetPortsRequest) (*RecordVersion, error) {
err := validators.ValidateRequest(req)
if err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/sdn/network_object_group/detach_external_network_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
}