| 1 |
package ecs |
| 2 |
|
| 3 |
import ( |
| 4 |
"github.com/denverdino/aliyungo/common" |
| 5 |
) |
| 6 |
|
| 7 |
type BandwidthPackageType struct { |
| 8 |
IpCount int |
| 9 |
Bandwidth int |
| 10 |
Zone string |
| 11 |
} |
| 12 |
|
| 13 |
type CreateNatGatewayArgs struct { |
| 14 |
RegionId common.Region |
| 15 |
VpcId string |
| 16 |
Spec string |
| 17 |
BandwidthPackage []BandwidthPackageType |
| 18 |
Name string |
| 19 |
Description string |
| 20 |
ClientToken string |
| 21 |
} |
| 22 |
|
| 23 |
type ForwardTableIdType struct { |
| 24 |
ForwardTableId []string |
| 25 |
} |
| 26 |
|
| 27 |
type SnatTableIdType struct { |
| 28 |
SnatTableId []string |
| 29 |
} |
| 30 |
|
| 31 |
type IpListsType struct { |
| 32 |
IpList []IpListItem |
| 33 |
} |
| 34 |
|
| 35 |
type IpListItem struct { |
| 36 |
IpAddress string |
| 37 |
AllocationId string |
| 38 |
UsingStatus string |
| 39 |
} |
| 40 |
|
| 41 |
type BandwidthPackageIdType struct { |
| 42 |
BandwidthPackageId []string |
| 43 |
} |
| 44 |
|
| 45 |
type CreateNatGatewayResponse struct { |
| 46 |
common.Response |
| 47 |
NatGatewayId string |
| 48 |
ForwardTableIds ForwardTableIdType |
| 49 |
BandwidthPackageIds BandwidthPackageIdType |
| 50 |
} |
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
func (client *Client) CreateNatGateway(args *CreateNatGatewayArgs) (resp *CreateNatGatewayResponse, err error) { |
| 56 |
response := CreateNatGatewayResponse{} |
| 57 |
err = client.Invoke("CreateNatGateway", args, &response) |
| 58 |
if err != nil { |
| 59 |
return nil, err |
| 60 |
} |
| 61 |
return &response, err |
| 62 |
} |
| 63 |
|
| 64 |
type NatGatewaySetType struct { |
| 65 |
BusinessStatus string |
| 66 |
Description string |
| 67 |
BandwidthPackageIds BandwidthPackageIdType |
| 68 |
ForwardTableIds ForwardTableIdType |
| 69 |
SnatTableIds SnatTableIdType |
| 70 |
IpLists IpListsType |
| 71 |
InstanceChargeType string |
| 72 |
Name string |
| 73 |
NatGatewayId string |
| 74 |
RegionId common.Region |
| 75 |
Spec string |
| 76 |
Status string |
| 77 |
VpcId string |
| 78 |
} |
| 79 |
|
| 80 |
type DescribeNatGatewayResponse struct { |
| 81 |
common.Response |
| 82 |
common.PaginationResult |
| 83 |
NatGateways struct { |
| 84 |
NatGateway []NatGatewaySetType |
| 85 |
} |
| 86 |
} |
| 87 |
|
| 88 |
type DescribeNatGatewaysArgs struct { |
| 89 |
RegionId common.Region |
| 90 |
NatGatewayId string |
| 91 |
VpcId string |
| 92 |
common.Pagination |
| 93 |
} |
| 94 |
|
| 95 |
func (client *Client) DescribeNatGateways(args *DescribeNatGatewaysArgs) (natGateways []NatGatewaySetType, |
| 96 |
pagination *common.PaginationResult, err error) { |
| 97 |
response, err := client.DescribeNatGatewaysWithRaw(args) |
| 98 |
if err == nil { |
| 99 |
return response.NatGateways.NatGateway, &response.PaginationResult, nil |
| 100 |
} |
| 101 |
|
| 102 |
return nil, nil, err |
| 103 |
} |
| 104 |
|
| 105 |
func (client *Client) DescribeNatGatewaysWithRaw(args *DescribeNatGatewaysArgs) (response *DescribeNatGatewayResponse, err error) { |
| 106 |
args.Validate() |
| 107 |
response = &DescribeNatGatewayResponse{} |
| 108 |
|
| 109 |
err = client.Invoke("DescribeNatGateways", args, response) |
| 110 |
|
| 111 |
if err == nil { |
| 112 |
return response, nil |
| 113 |
} |
| 114 |
|
| 115 |
return nil, err |
| 116 |
} |
| 117 |
|
| 118 |
type ModifyNatGatewayAttributeArgs struct { |
| 119 |
RegionId common.Region |
| 120 |
NatGatewayId string |
| 121 |
Name string |
| 122 |
Description string |
| 123 |
} |
| 124 |
|
| 125 |
type ModifyNatGatewayAttributeResponse struct { |
| 126 |
common.Response |
| 127 |
} |
| 128 |
|
| 129 |
func (client *Client) ModifyNatGatewayAttribute(args *ModifyNatGatewayAttributeArgs) error { |
| 130 |
response := ModifyNatGatewayAttributeResponse{} |
| 131 |
return client.Invoke("ModifyNatGatewayAttribute", args, &response) |
| 132 |
} |
| 133 |
|
| 134 |
type ModifyNatGatewaySpecArgs struct { |
| 135 |
RegionId common.Region |
| 136 |
NatGatewayId string |
| 137 |
Spec NatGatewaySpec |
| 138 |
} |
| 139 |
|
| 140 |
func (client *Client) ModifyNatGatewaySpec(args *ModifyNatGatewaySpecArgs) error { |
| 141 |
response := ModifyNatGatewayAttributeResponse{} |
| 142 |
return client.Invoke("ModifyNatGatewaySpec", args, &response) |
| 143 |
} |
| 144 |
|
| 145 |
type DeleteNatGatewayArgs struct { |
| 146 |
RegionId common.Region |
| 147 |
NatGatewayId string |
| 148 |
} |
| 149 |
|
| 150 |
type DeleteNatGatewayResponse struct { |
| 151 |
common.Response |
| 152 |
} |
| 153 |
|
| 154 |
func (client *Client) DeleteNatGateway(args *DeleteNatGatewayArgs) error { |
| 155 |
response := DeleteNatGatewayResponse{} |
| 156 |
err := client.Invoke("DeleteNatGateway", args, &response) |
| 157 |
return err |
| 158 |
} |
| 159 |
|
| 160 |
type DescribeBandwidthPackagesArgs struct { |
| 161 |
RegionId common.Region |
| 162 |
common.Pagination |
| 163 |
BandwidthPackageId string |
| 164 |
NatGatewayId string |
| 165 |
} |
| 166 |
|
| 167 |
type PublicIpAddresseType struct { |
| 168 |
AllocationId string |
| 169 |
IpAddress string |
| 170 |
} |
| 171 |
|
| 172 |
type DescribeBandwidthPackageType struct { |
| 173 |
Bandwidth string |
| 174 |
BandwidthPackageId string |
| 175 |
IpCount string |
| 176 |
PublicIpAddresses struct { |
| 177 |
PublicIpAddresse []PublicIpAddresseType |
| 178 |
} |
| 179 |
|
| 180 |
ZoneId string |
| 181 |
} |
| 182 |
|
| 183 |
type DescribeBandwidthPackagesResponse struct { |
| 184 |
common.Response |
| 185 |
common.PaginationResult |
| 186 |
BandwidthPackages struct { |
| 187 |
BandwidthPackage []DescribeBandwidthPackageType |
| 188 |
} |
| 189 |
} |
| 190 |
|
| 191 |
func (client *Client) DescribeBandwidthPackages(args *DescribeBandwidthPackagesArgs) (*DescribeBandwidthPackagesResponse, error) { |
| 192 |
response := &DescribeBandwidthPackagesResponse{} |
| 193 |
|
| 194 |
err := client.Invoke("DescribeBandwidthPackages", args, response) |
| 195 |
if err != nil { |
| 196 |
return nil, err |
| 197 |
} |
| 198 |
|
| 199 |
return response, err |
| 200 |
} |
| 201 |
|
| 202 |
type DeleteBandwidthPackageArgs struct { |
| 203 |
RegionId common.Region |
| 204 |
BandwidthPackageId string |
| 205 |
} |
| 206 |
|
| 207 |
type DeleteBandwidthPackageResponse struct { |
| 208 |
common.Response |
| 209 |
} |
| 210 |
|
| 211 |
func (client *Client) DeleteBandwidthPackage(args *DeleteBandwidthPackageArgs) error { |
| 212 |
response := DeleteBandwidthPackageResponse{} |
| 213 |
err := client.Invoke("DeleteBandwidthPackage", args, &response) |
| 214 |
return err |
| 215 |
} |
| 216 |
|
| 217 |
type NatGatewaySpec string |
| 218 |
|
| 219 |
const ( |
| 220 |
NatGatewaySmallSpec = NatGatewaySpec("Small") |
| 221 |
NatGatewayMiddleSpec = NatGatewaySpec("Middle") |
| 222 |
NatGatewayLargeSpec = NatGatewaySpec("Large") |
| 223 |
) |