v12.8.0
This commit is contained in:
49
pkg/sdn/netobjgroups/detach_external_network_ports.go
Normal file
49
pkg/sdn/netobjgroups/detach_external_network_ports.go
Normal file
@@ -0,0 +1,49 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user