forked from dynport/gocloud
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsubnets.go
38 lines (33 loc) · 936 Bytes
/
subnets.go
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
package ec2
import (
"fmt"
"net/url"
)
type Subnet struct {
SubnetId string `xml:"subnetId"`
State string `xml:"state"`
VpcId string `xml:"vpcId"`
CidrBlock string `xml:"cidrBlock"`
AvailableIpAddressCount int `xml:"availableIpAddressCount"`
AvailabilityZone string `xml:"availabilityZone"`
DefaultForAz bool `xml:"defaultForAz"`
MapPublicIpOnLaunch bool `xml:"mapPublicIpOnLaunch"`
}
type Filter struct {
Name string
Values []string
}
func applyFilters(values url.Values, filters []*Filter) {
for n, filter := range filters {
key := fmt.Sprintf("Filter.%d.Name", n+1)
for m, value := range filter.Values {
valueKey := fmt.Sprintf("Filter.%d.Value.%d", n+1, m+1)
values.Add(key, filter.Name)
values.Add(valueKey, value)
}
}
}
type DescribeSubnetsOptions struct {
SubnetIds []string
Filters []*Filter
}