diff --git a/errors.go b/errors.go index 88c6c33..18e5ab7 100644 --- a/errors.go +++ b/errors.go @@ -66,3 +66,9 @@ var ErrManagedAccountNotFound = errors.New("managed account not found") // ErrInvalidVLAN is returned when a VLAN is invalid var ErrInvalidVLAN = errors.New("invalid VLAN, must be between 0 and 4094") + +// ErrInvalidVXCAEndPartnerConfig is returned when an invalid VXC A-End partner config is provided +var ErrInvalidVXCAEndPartnerConfig = errors.New("invalid vxc a-end partner config") + +// ErrInvalidVXCBEndPartnerConfig is returned when an invalid VXC B-End partner config is provided +var ErrInvalidVXCBEndPartnerConfig = errors.New("invalid vxc b-end partner config") diff --git a/vxc.go b/vxc.go index 7044f3b..9c1162a 100644 --- a/vxc.go +++ b/vxc.go @@ -90,6 +90,9 @@ type UpdateVXCRequest struct { AEndInnerVLAN *int BEndInnerVLAN *int + AEndPartnerConfig VXCPartnerConfiguration + BEndPartnerConfig VXCPartnerConfiguration + WaitForUpdate bool // Wait until the VXC updates before returning WaitForTime time.Duration // How long to wait for the VXC to update if WaitForUpdate is true (default is 5 minutes) } @@ -267,6 +270,26 @@ func (svc *VXCServiceOp) UpdateVXC(ctx context.Context, id string, req *UpdateVX Shutdown: req.Shutdown, } + if req.AEndPartnerConfig != nil { + // Only allow AENdPartnerConfig or VROUTER Partner Config for AEndPartnerConfig in VXC Updates + switch req.AEndPartnerConfig.(type) { + case VXCPartnerConfiguration, VXCOrderVrouterPartnerConfig: + update.AEndPartnerConfig = req.AEndPartnerConfig + default: + return nil, ErrInvalidVXCAEndPartnerConfig + } + } + + if req.BEndPartnerConfig != nil { + // Only allow Vrouter Partner Config for BEndPartnerConfig in VXC Updates + switch req.BEndPartnerConfig.(type) { + case VXCOrderVrouterPartnerConfig: + update.BEndPartnerConfig = req.BEndPartnerConfig + default: + return nil, ErrInvalidVXCBEndPartnerConfig + } + } + if req.Name != nil { update.Name = *req.Name } diff --git a/vxc_types.go b/vxc_types.go index 1f39da9..8e9cd0d 100644 --- a/vxc_types.go +++ b/vxc_types.go @@ -189,6 +189,9 @@ type VXCUpdate struct { AEndProductUID string `json:"aEndProductUid,omitempty"` BEndProductUID string `json:"bEndProductUid,omitempty"` Term *int `json:"term,omitempty"` + + AEndPartnerConfig VXCPartnerConfiguration `json:"aEndConfig,omitempty"` + BEndPartnerConfig VXCPartnerConfiguration `json:"bEndConfig,omitempty"` } // VXCOrderResponse represents the response from the VXC Order API.