File: nat_gateway_test.go

package info (click to toggle)
golang-github-denverdino-aliyungo 0.0~git20180921.13fa8aa-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 1,824 kB
  • sloc: xml: 1,359; makefile: 3
file content (40 lines) | stat: -rw-r--r-- 1,100 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package ecs

import "testing"

func TestDescribeNatGateway(t *testing.T) {

	client := NewTestClient()
	args := DescribeBandwidthPackagesArgs{
		RegionId:           "cn-beijing",
		BandwidthPackageId: "bwp-2zes6svn910zjqhcyqnxm",
		NatGatewayId:       "ngw-2zex6oklf8901t76yut6c",
	}
	packages, err := client.DescribeBandwidthPackages(&args)
	if err != nil {
		t.Fatalf("Failed to DescribeBandwidthPackages: %v", err)
	}
	for _, pack := range packages.BandwidthPackages.BandwidthPackage {
		t.Logf("pack.IpCount: %++v", pack.IpCount)
		t.Logf("pack.Bandwidth: %++v", pack.Bandwidth)
		t.Logf("pack.ZoneId: %++v", pack.ZoneId)
		t.Logf("pack.ipAddress: %++v", len(pack.PublicIpAddresses.PublicIpAddresse))
	}
}

func TestClient_DescribeNatGateways(t *testing.T) {
	client := NewVpcTestClientForDebug()
	args := &DescribeNatGatewaysArgs{
		RegionId: TestRegionID,
		VpcId:    TestVpcId,
	}

	natGateways, _, err := client.DescribeNatGateways(args)
	if err != nil {
		t.Fatalf("Error %++v", err)
	} else {
		for index, item := range natGateways {
			t.Logf("natGateways[%d]=%++v", index, item)
		}
	}
}