Skip to content

Commit

Permalink
Merge pull request #75 from megaport/feat/partnerConfig-IBM
Browse files Browse the repository at this point in the history
feat: support IBM partner configuration in VXC service
  • Loading branch information
MegaportPhilipBrowne authored Oct 1, 2024
2 parents 5997df4 + 8ff0c90 commit 0decef3
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions vxc_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,17 @@ type VXCPartnerConfigTransit struct {
ConnectType string `json:"connectType"`
}

// VXCPartnerConfigIBM represents the configuration of a VXC partner for IBM Cloud Direct Link.
type VXCPartnerConfigIBM struct {
VXCPartnerConfiguration `json:"-"`
ConnectType string `json:"connectType"`
AccountID string `json:"account_id"` // Customer's IBM Acount ID. 32 Hexadecimal Characters. REQUIRED
CustomerASN int `json:"customer_asn"` // Customer's ASN. Valid ranges: 1-64495, 64999, 131072-4199999999, 4201000000-4201064511. Required unless the connection at the other end of the VXC is an MCR.
Name string `json:"name"` // Description of this connection for identification purposes. Max 100 characters from 0-9 a-z A-Z / - _ , Defaults to "MEGAPORT".
CustomerIPAddress string `json:"customer_ip_address"` // IPv4 network address including subnet mask. Default is /30 assigned from 169.254.0.0/16.
ProviderIPAddress string `json:"provider_ip_address"` // IPv4 network address including subnet mask. Default is /30 assigned from 169.254.0.0/16. Must be in the same subnet as customer_ip_address.
}

// VXCOrderMVEConfig represents the configuration of a VXC endpoint for MVE.
type VXCOrderMVEConfig struct {
InnerVLAN int `json:"innerVlan,omitempty"`
Expand Down Expand Up @@ -562,6 +573,21 @@ type CSPConnectionTransit struct {
IPv6GatewayAddress string `json:"ipv6_gateway_address"`
}

// CSPConnectionIBM represents the configuration of a CSP connection for IBM Cloud Direct Link.
type CSPConnectionIBM struct {
CSPConnectionConfig
ConnectType string `json:"connectType"`
ResourceName string `json:"resource_name"`
ResourceType string `json:"resource_type"`
CSPName string `json:"csp_name"`
Bandwidth int `json:"bandwidth"`
AccountID string `json:"account_id"`
CustomerASN int `json:"customer_asn"`
ProviderIPAddress string `json:"provider_ip_address"`
CustomerIPAddress string `json:"customer_ip_address"`
Bandwidths []int `json:"bandwidths"`
}

// CSPConnectionOther represents the configuration of a CSP connection for any other CSP that is not presently defined.
type CSPConnectionOther struct {
CSPConnectionConfig
Expand Down Expand Up @@ -730,6 +756,16 @@ func (c *CSPConnection) UnmarshalJSON(data []byte) error {
return err
}
c.CSPConnection = append(c.CSPConnection, oracle)
case "IBM":
marshaled, err := json.Marshal(cn)
if err != nil {
return err
}
ibm := CSPConnectionIBM{}
if err := json.Unmarshal(marshaled, &ibm); err != nil {
return err
}
c.CSPConnection = append(c.CSPConnection, ibm)
default: // Any other cases will be marshaled into a map[string]interface{}
marshaled, err := json.Marshal(cn)
if err != nil {
Expand Down

0 comments on commit 0decef3

Please sign in to comment.