Add API client for Azure custom vnet (#271)

* Update vendor for azure vent support

* Add support for Azure custom vnets.

Use pointers intead of values. This allows the client to pass back
returned data from Azure.
This commit is contained in:
Brian Goff
2018-07-25 16:49:39 -07:00
committed by Robbie Zhang
parent 36eb3db8a9
commit 25e454d18f
56 changed files with 36373 additions and 3 deletions

View File

@@ -0,0 +1,42 @@
package network
import "testing"
func TestCreateGetSubnet(t *testing.T) {
c := newTestClient(t)
subnet := &Subnet{
Name: t.Name(),
Properties: &SubnetProperties{
AddressPrefix: "10.0.0.0/24",
Delegations: []Delegation{
{Name: "aciDelegation", Properties: DelegationProperties{
ServiceName: "Microsoft.ContainerInstance/containerGroups",
Actions: []string{"Microsoft.Network/virtualNetworks/subnets/action"},
}},
},
},
}
ensureVnet(t, t.Name())
if err := c.CreateOrUpdateSubnet(resourceGroup, t.Name(), subnet); err != nil {
t.Fatal(err)
}
s, err := c.GetSubnet(resourceGroup, t.Name(), subnet.Name)
if err != nil {
t.Fatal(err)
}
if s.Name != subnet.Name {
t.Fatal("got unexpected subnet")
}
if s.Properties.AddressPrefix != subnet.Properties.AddressPrefix {
t.Fatalf("got unexpected address prefix: %s", s.Properties.AddressPrefix)
}
if len(s.Properties.Delegations) != 1 {
t.Fatalf("got unexpected delgations: %v", s.Properties.Delegations)
}
if s.Properties.Delegations[0].Name != subnet.Properties.Delegations[0].Name {
t.Fatalf("got unexpected delegation: %v", s.Properties.Delegations[0])
}
}