Skip to content

Commit

Permalink
Merge pull request #66 from megaport/fix/vrouter-iproutes
Browse files Browse the repository at this point in the history
fix: added fields to csp connection for vrouter and azure
  • Loading branch information
MegaportPhilipBrowne authored Aug 30, 2024
2 parents 0144faf + 4b4f9cc commit d80e1a4
Showing 1 changed file with 31 additions and 10 deletions.
41 changes: 31 additions & 10 deletions vxc_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -442,15 +442,16 @@ type CSPConnectionAWSHC struct {
// CSPConnectionAzure represents the configuration of a CSP connection for Azure ExpressRoute.
type CSPConnectionAzure struct {
CSPConnectionConfig
ConnectType string `json:"connectType"`
ResourceName string `json:"resource_name"`
ResourceType string `json:"resource_type"`
Bandwidth int `json:"bandwidth"`
Managed bool `json:"managed"`
Megaports []CSPConnectionAzureMegaport `json:"megaports"`
Ports []CSPConnectionAzurePort `json:"ports"`
ServiceKey string `json:"service_key"`
VLAN int `json:"vlan"`
ConnectType string `json:"connectType"`
ResourceName string `json:"resource_name"`
ResourceType string `json:"resource_type"`
Bandwidth int `json:"bandwidth"`
Managed bool `json:"managed"`
Megaports []CSPConnectionAzureMegaport `json:"megaports"`
Ports []CSPConnectionAzurePort `json:"ports"`
ServiceKey string `json:"service_key"`
VLAN int `json:"vlan"`
Peers []PartnerOrderAzurePeeringConfig `json:"peers"`
}

// CSPConnectionAzureMegaport represents the configuration of a CSP connection for Azure ExpressRoute megaport.
Expand Down Expand Up @@ -507,7 +508,17 @@ type CSPConnectionVirtualRouter struct {

// CSPConnectionVirtualRouterInterface represents the configuration of a CSP connection for Virtual Router interface.
type CSPConnectionVirtualRouterInterface struct {
IPAddresses []string `json:"ipAddresses"`
IPAddresses []string `json:"ipAddresses"`
IPRoutes []IpRoute `json:"ipRoutes"`
BGPConnections []BgpConnectionConfig `json:"bgpConnections"`
NatIPAddresses []string `json:"natIpAddresses"`
BFD BfdConfig `json:"bfd"`
}

type CSPConnectionOracle struct {
CSPConnectionConfig
ConnectType string `json:"connectType"`
VirtualCircuitId string `json:"virtualCircuitId"`
}

// CSPConnectionTransit represents the configuration of a CSP connection for a Transit VXC.
Expand Down Expand Up @@ -680,6 +691,16 @@ func (c *CSPConnection) UnmarshalJSON(data []byte) error {
return err
}
c.CSPConnection = append(c.CSPConnection, transit)
case "ORACLE":
marshaled, err := json.Marshal(cn)
if err != nil {
return err
}
oracle := CSPConnectionOracle{}
if err := json.Unmarshal(marshaled, &oracle); err != nil {
return err
}
c.CSPConnection = append(c.CSPConnection, oracle)
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 d80e1a4

Please sign in to comment.