Skip to content

Commit

Permalink
Merge branch 'simplify'
Browse files Browse the repository at this point in the history
  • Loading branch information
alkar committed Oct 23, 2019
2 parents 6cd27cd + 04cef8e commit a10dff0
Showing 1 changed file with 13 additions and 26 deletions.
39 changes: 13 additions & 26 deletions megaport/api/vxc.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,27 +84,19 @@ type vxcCreatePayload struct {
}

type vxcCreatePayloadAssociatedVxc struct {
ProductName *string `json:"productName,omitempty"`
RateLimit *uint64 `json:"rateLimit,omitempty"`
CostCentre *string `json:"costCentre,omitempty"`
AEnd *vxcCreatePayloadVxcEndA `json:"aEnd,omitempty"`
BEnd interface{} `json:"bEnd,omitempty"`
PartnerConfig *PartnerConfig `json:"partnerConfigs,omitempty"`
ProductName *string `json:"productName,omitempty"`
RateLimit *uint64 `json:"rateLimit,omitempty"`
CostCentre *string `json:"costCentre,omitempty"`
AEnd *vxcCreatePayloadVxcEnd `json:"aEnd,omitempty"`
BEnd *vxcCreatePayloadVxcEnd `json:"bEnd,omitempty"`
PartnerConfig *PartnerConfig `json:"partnerConfigs,omitempty"`
}

type vxcCreatePayloadVxcEndA struct {
Vlan *uint64 `json:"vlan,omitempty"`
}

type vxcCreatePayloadVxcEndBPrivate struct {
type vxcCreatePayloadVxcEnd struct {
ProductUid *string `json:"productUid,omitempty"`
Vlan *uint64 `json:"vlan,omitempty"`
}

type vxcCreatePayloadVxcEndBPartner struct {
ProductUid string `json:"productUid,omitempty"`
}

type PrivateVxcCreateInput struct {
InvoiceReference *string
Name *string
Expand All @@ -127,10 +119,10 @@ func (v *PrivateVxcCreateInput) toPayload() ([]byte, error) {
CostCentre: v.InvoiceReference,
}
if v.VlanA != nil {
av.AEnd = &vxcCreatePayloadVxcEndA{Vlan: v.VlanA}
av.AEnd = &vxcCreatePayloadVxcEnd{Vlan: v.VlanA}
}
bEnd := &vxcCreatePayloadVxcEndBPrivate{ProductUid: v.ProductUidB, Vlan: v.VlanB}
if *bEnd != (vxcCreatePayloadVxcEndBPrivate{}) {
bEnd := &vxcCreatePayloadVxcEnd{ProductUid: v.ProductUidB, Vlan: v.VlanB}
if *bEnd != (vxcCreatePayloadVxcEnd{}) {
av.BEnd = bEnd
}
if *av != (vxcCreatePayloadAssociatedVxc{}) {
Expand Down Expand Up @@ -194,11 +186,6 @@ func (c *Client) DeletePrivateVxc(uid string) error {
return c.delete(uid)
}

type vxcCreatePayloadVxcEndBCloud struct {
ProductUid *string `json:"productUid,omitempty"`
Vlan *uint64 `json:"vlan,omitempty"`
}

type PartnerConfig map[string]interface{}

type CloudVxcCreateInput struct {
Expand All @@ -220,10 +207,10 @@ func (v *CloudVxcCreateInput) toPayload() ([]byte, error) {
RateLimit: v.RateLimit,
}
if v.VlanA != nil {
av.AEnd = &vxcCreatePayloadVxcEndA{Vlan: v.VlanA}
av.AEnd = &vxcCreatePayloadVxcEnd{Vlan: v.VlanA}
}
bEnd := &vxcCreatePayloadVxcEndBCloud{ProductUid: v.ProductUidB}
if *bEnd != (vxcCreatePayloadVxcEndBCloud{}) {
bEnd := &vxcCreatePayloadVxcEnd{ProductUid: v.ProductUidB}
if *bEnd != (vxcCreatePayloadVxcEnd{}) {
av.BEnd = bEnd
}
if *av != (vxcCreatePayloadAssociatedVxc{}) {
Expand Down

0 comments on commit a10dff0

Please sign in to comment.