Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(24)

Delta Between Two Patch Sets: ec2/vpc.go

Issue 49930045: ec2: Add support for AWS VPCs (Closed)
Left Patch Set: Created 11 years, 2 months ago
Right Patch Set: ec2: Add support for AWS VPCs Created 11 years, 1 month ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « ec2/responses_test.go ('k') | ec2/vpc_test.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 //
2 // goamz - Go packages to interact with the Amazon Web Services.
3 //
4 // https://wiki.ubuntu.com/goamz
5 //
6 // Copyright (c) 2014 Canonical Ltd.
7 //
8
9 package ec2
10
11 import (
12 "strconv"
13 )
14
15 // VPC describes a Virtual Private Cloud (VPC).
16 //
17 // See http://goo.gl/Uy6ZLL for more details.
18 type VPC struct {
19 Id string `xml:"vpcId"`
20 State string `xml:"state"`
21 CIDRBlock string `xml:"cidrBlock"`
22 DHCPOptionsId string `xml:"dhcpOptionsId"`
23 Tags []Tag `xml:"tagSet>item"`
24 InstanceTenancy string `xml:"instanceTenancy"`
25 IsDefault bool `xml:"isDefault"`
26 }
27
28 // CreateVPCResp is the response to a CreateVPC request.
29 //
30 // See http://goo.gl/nkwjvN for more details.
31 type CreateVPCResp struct {
32 RequestId string `xml:"requestId"`
33 VPC VPC `xml:"vpc"`
34 }
35
36 // CreateVPC creates a VPC with the specified CIDR block.
37 //
38 // The smallest VPC that can be created uses a /28 netmask (16 IP
39 // addresses), and the largest uses a /16 netmask (65,536 IP
40 // addresses).
41 //
42 // The instanceTenancy value holds the tenancy options for instances
43 // launched into the VPC - either "default" or "dedicated".
44 //
45 // See http://goo.gl/nkwjvN for more details.
46 func (ec2 *EC2) CreateVPC(CIDRBlock, instanceTenancy string) (resp *CreateVPCRes p, err error) {
47 params := makeParamsVPC("CreateVpc")
48 params["CidrBlock"] = CIDRBlock
49 if instanceTenancy == "" {
50 instanceTenancy = "default"
51 }
52 params["InstanceTenancy"] = instanceTenancy
53 resp = &CreateVPCResp{}
54 err = ec2.query(params, resp)
55 if err != nil {
56 return nil, err
57 }
58 return resp, nil
59 }
60
61 // DeleteVPC deletes the VPC with the specified id. All gateways and
62 // resources that are associated with the VPC must have been
63 // previously deleted, including instances running in the VPC, and
64 // non-default security groups and route tables associated with the
65 // VPC.
66 //
67 // See http://goo.gl/bcxtbf for more details.
68 func (ec2 *EC2) DeleteVPC(id string) (resp *SimpleResp, err error) {
69 params := makeParamsVPC("DeleteVpc")
70 params["VpcId"] = id
71 resp = &SimpleResp{}
72 err = ec2.query(params, resp)
73 if err != nil {
74 return nil, err
75 }
76 return resp, nil
77 }
78
79 // VPCsResp is the response to a VPCs request.
80 //
81 // See http://goo.gl/Y5kHqG for more details.
82 type VPCsResp struct {
83 RequestId string `xml:"requestId"`
84 VPCs []VPC `xml:"vpcSet>item"`
85 }
86
87 // VPCs describes one or more VPCs. Both parameters are optional, and
88 // if specified will limit the returned VPCs to the matching ids or
89 // filtering rules.
90 //
91 // See http://goo.gl/Y5kHqG for more details.
92 func (ec2 *EC2) VPCs(ids []string, filter *Filter) (resp *VPCsResp, err error) {
93 params := makeParamsVPC("DescribeVpcs")
94 for i, id := range ids {
95 params["VpcId."+strconv.Itoa(i+1)] = id
96 }
97 filter.addParams(params)
98
99 resp = &VPCsResp{}
100 err = ec2.query(params, resp)
101 if err != nil {
102 return nil, err
103 }
104 return resp, nil
105 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b