~nskaggs/+junk/xenial-test

« back to all changes in this revision

Viewing changes to src/gopkg.in/amz.v3/ec2/route_tables.go

  • Committer: Nicholas Skaggs
  • Date: 2016-10-24 20:56:05 UTC
  • Revision ID: nicholas.skaggs@canonical.com-20161024205605-z8lta0uvuhtxwzwl
Initi with beta15

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//
 
2
// goamz - Go packages to interact with the Amazon Web Services.
 
3
//
 
4
//   https://wiki.ubuntu.com/goamz
 
5
//
 
6
// Copyright (c) 2015 Canonical Ltd.
 
7
//
 
8
 
 
9
package ec2
 
10
 
 
11
import (
 
12
        "strconv"
 
13
)
 
14
 
 
15
// RouteTableAssociation describes an association between a route table and a subnet.
 
16
//
 
17
// See http://goo.gl/ZgrG5j for more details.
 
18
type RouteTableAssociation struct {
 
19
        // Id is the route table association id.
 
20
        Id string `xml:"routeTableAssociationId"`
 
21
 
 
22
        // TableId is the route table id for this association.
 
23
        TableId string `xml:"routeTableId"`
 
24
 
 
25
        // SubnetId is the subnet id (only when explicitly associated).
 
26
        SubnetId string `xml:"subnetId"`
 
27
 
 
28
        // IsMain indicates whether this is the main route table.
 
29
        IsMain bool `xml:"main"`
 
30
}
 
31
 
 
32
// Route describes a single route in a route table.
 
33
//
 
34
// See http://goo.gl/GlW6ii for more details.
 
35
type Route struct {
 
36
        // DestinationCIDRBlock is used for destination matching.
 
37
        DestinationCIDRBlock string `xml:"destinationCidrBlock"`
 
38
 
 
39
        // DestinationPrefixListId is the prefix of the AWS service.
 
40
        DestinationPrefixListId string `xml:"destinationPrefixListId"`
 
41
 
 
42
        // GatewayId is the id of an Internet Gateway attached to the VPC.
 
43
        GatewayId string `xml:"gatewayId"`
 
44
 
 
45
        // InstanceId is the id of a NAT instance in the VPC.
 
46
        InstanceId string `xml:"instanceId"`
 
47
 
 
48
        // InstanceOwnerId is the AWS account id of the NAT instance
 
49
        // owner.
 
50
        InstanceOwnerId string `xml:"instanceOwnerId"`
 
51
 
 
52
        // InterfaceId is the id of the used Network Interface.
 
53
        InterfaceId string `xml:"networkInterfaceId"`
 
54
 
 
55
        // Origin describes how the route was created.
 
56
        // Values: CreateRouteTable | CreateRoute | EnableVgwRoutePropagation
 
57
        Origin string `xml:"origin"`
 
58
 
 
59
        // State is the state of the route. The blackhole state indicates
 
60
        // the route target isn't available (e.g. IGW isn't attached or
 
61
        // NAT instance not found).
 
62
        State string `xml:"state"`
 
63
 
 
64
        // VPCPeeringConnectionId is the id of the VPC peering connection.
 
65
        VPCPeeringConnectionId string `xml:"vpcPeeringConnectionId"`
 
66
}
 
67
 
 
68
// RouteTable describes a VPC route table.
 
69
//
 
70
// See http://goo.gl/h0bwYw  for more details.
 
71
type RouteTable struct {
 
72
        // Id is the id of the Internet Gateway (IGW).
 
73
        Id string `xml:"routeTableId"`
 
74
 
 
75
        // VPCId is the id of the VPC this route table is attached to.
 
76
        VPCId string `xml:"vpcId"`
 
77
 
 
78
        // Associations holds associations between the route table and one
 
79
        // or more subnets.
 
80
        Associations []RouteTableAssociation `xml:"associationSet>item"`
 
81
 
 
82
        // Routes holds all route table routes.
 
83
        Routes []Route `xml:"routeSet>item"`
 
84
 
 
85
        // Tags holds any tags associated with the IGW.
 
86
        Tags []Tag `xml:"tagSet>item"`
 
87
 
 
88
        // PropagatingVGWIds holds a list of ids of propagating virtual
 
89
        // private gateways.
 
90
        PropagatingVGWIds []string `xml:"propagatingVgws>gatewayId"`
 
91
}
 
92
 
 
93
// RouteTablesResp is the response to a RouteTables request.
 
94
//
 
95
// See http://goo.gl/1JZIfO for more details.
 
96
type RouteTablesResp struct {
 
97
        RequestId string       `xml:"requestId"`
 
98
        Tables    []RouteTable `xml:"routeTableSet>item"`
 
99
}
 
100
 
 
101
// RouteTables describes one or more route tables.
 
102
// Both parameters are optional, and if specified will limit the
 
103
// returned tables to the matching ids or filtering rules.
 
104
//
 
105
// See http://goo.gl/1JZIfO for more details.
 
106
func (ec2 *EC2) RouteTables(ids []string, filter *Filter) (resp *RouteTablesResp, err error) {
 
107
        params := makeParams("DescribeRouteTables")
 
108
        for i, id := range ids {
 
109
                params["RouteTableId."+strconv.Itoa(i+1)] = id
 
110
        }
 
111
        filter.addParams(params)
 
112
 
 
113
        resp = &RouteTablesResp{}
 
114
        err = ec2.query(params, resp)
 
115
        if err != nil {
 
116
                return nil, err
 
117
        }
 
118
        return resp, nil
 
119
}