Files
decort-golang-sdk/pkg/sdn/logicalports/unexclude_firewall.go
2026-03-13 17:03:28 +03:00

56 lines
1.5 KiB
Go

package logicalports
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/constants"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
type LogicalPortsForUnexcludeFromFirewall struct {
// Exclude IP Addresses
// Required: true
ID string `url:"id" json:"id" validate:"required"`
// Version ID
// Required: true
VersionID uint64 `url:"version_id" json:"version_id" validate:"required"`
}
// UnexcludeFirewallRequest struct to unexclude firewall for logical port
type UnexcludeFirewallRequest struct {
// Access Group ID
// Required: true
AccessGroupID string `url:"access_group_id" json:"access_group_id" validate:"required"`
// Logical Ports For Unexclude From Firewall
// Required: true
LogicalPortsForUnexcludeFromFirewall []LogicalPortsForUnexcludeFromFirewall `json:"logical_ports_for_unexclude_from_firewall" validate:"required,dive"`
}
// UnexcludeFirewallRequest struct to unexclude firewall for logical port
func (lp LogicalPorts) UnexcludeFirewall(ctx context.Context, req UnexcludeFirewallRequest) (*RecordVersion, error) {
err := validators.ValidateRequest(req)
if err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/sdn/logical_port/unexclude_firewall"
res, err := lp.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
}