Skip to content

Commit

Permalink
Merge pull request #191 from civo/vlan-net
Browse files Browse the repository at this point in the history
Change Network struct
  • Loading branch information
uzaxirr committed Apr 9, 2024
2 parents cb1158c + f730e8a commit b287a41
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 18 deletions.
11 changes: 5 additions & 6 deletions fake_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -924,12 +924,11 @@ func (c *FakeClient) CreateNetwork(config NetworkConfig) (*NetworkResult, error)

// Handle VLAN configuration if present
if config.VLanConfig != nil {
newNetwork.VLAN.VlanID = config.VLanConfig.VlanID
newNetwork.VLAN.HardwareAddr = config.VLanConfig.HardwareAddr
newNetwork.VLAN.CIDRv4 = config.VLanConfig.CIDRv4
newNetwork.VLAN.GatewayIPv4 = config.VLanConfig.GatewayIPv4
newNetwork.VLAN.AllocationPoolV4Start = config.VLanConfig.AllocationPoolV4Start
newNetwork.VLAN.AllocationPoolV4Start = config.VLanConfig.AllocationPoolV4End
newNetwork.VlanID = config.VLanConfig.VlanID
newNetwork.HardwareAddr = config.VLanConfig.HardwareAddr
newNetwork.GatewayIPv4 = config.VLanConfig.GatewayIPv4
newNetwork.AllocationPoolV4Start = config.VLanConfig.AllocationPoolV4Start
newNetwork.AllocationPoolV4Start = config.VLanConfig.AllocationPoolV4End
}

// Append the newly created network to the networks slice
Expand Down
28 changes: 16 additions & 12 deletions network.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,22 @@ import (

// Network represents a private network for instances to connect to
type Network struct {
ID string `json:"id"`
Name string `json:"name,omitempty"`
Default bool `json:"default"`
CIDR string `json:"cidr,omitempty"`
CIDRV6 string `json:"cidr_v6,omitempty"`
Label string `json:"label,omitempty"`
Status string `json:"status,omitempty"`
IPv4Enabled bool `json:"ipv4_enabled,omitempty"`
IPv6Enabled bool `json:"ipv6_enabled,omitempty"`
NameserversV4 []string `json:"nameservers_v4,omitempty"`
NameserversV6 []string `json:"nameservers_v6,omitempty"`
VLAN VLANConnectConfig `json:"vlan,omitempty"`
ID string `json:"id"`
Name string `json:"name,omitempty"`
Default bool `json:"default"`
CIDR string `json:"cidr,omitempty"`
CIDRV6 string `json:"cidr_v6,omitempty"`
Label string `json:"label,omitempty"`
Status string `json:"status,omitempty"`
IPv4Enabled bool `json:"ipv4_enabled,omitempty"`
IPv6Enabled bool `json:"ipv6_enabled,omitempty"`
NameserversV4 []string `json:"nameservers_v4,omitempty"`
NameserversV6 []string `json:"nameservers_v6,omitempty"`
VlanID int `json:"vlan_id" validate:"required" schema:"vlan_id"`
HardwareAddr string `json:"hardware_addr,omitempty" schema:"hardware_addr"`
GatewayIPv4 string `json:"gateway_ipv4" validate:"required" schema:"gateway_ipv4"`
AllocationPoolV4Start string `json:"allocation_pool_v4_start" validate:"required" schema:"allocation_pool_v4_start"`
AllocationPoolV4End string `json:"allocation_pool_v4_end" validate:"required" schema:"allocation_pool_v4_end"`
}

// Subnet represents a subnet within a private network
Expand Down

0 comments on commit b287a41

Please sign in to comment.