OLD | NEW |
1 // | 1 // |
2 // goamz - Go packages to interact with the Amazon Web Services. | 2 // goamz - Go packages to interact with the Amazon Web Services. |
3 // | 3 // |
4 // https://wiki.ubuntu.com/goamz | 4 // https://wiki.ubuntu.com/goamz |
5 // | 5 // |
6 // Copyright (c) 2011 Canonical Ltd. | 6 // Copyright (c) 2011 Canonical Ltd. |
7 // | 7 // |
8 | 8 |
9 package ec2 | 9 package ec2 |
10 | 10 |
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 XMLName xml.Name | 629 XMLName xml.Name |
630 RequestId string `xml:"requestId"` | 630 RequestId string `xml:"requestId"` |
631 } | 631 } |
632 | 632 |
633 // CreateSecurityGroupResp represents a response to a CreateSecurityGroup reques
t. | 633 // CreateSecurityGroupResp represents a response to a CreateSecurityGroup reques
t. |
634 type CreateSecurityGroupResp struct { | 634 type CreateSecurityGroupResp struct { |
635 SecurityGroup | 635 SecurityGroup |
636 RequestId string `xml:"requestId"` | 636 RequestId string `xml:"requestId"` |
637 } | 637 } |
638 | 638 |
639 // CreateSecurityGroup run a CreateSecurityGroup request in EC2, with the provid
ed | 639 // CreateSecurityGroup creates a security group with the provided name |
640 // name and description. | 640 // and description. |
641 // | 641 // |
642 // See http://goo.gl/Eo7Yl for more details. | 642 // See http://goo.gl/Eo7Yl for more details. |
643 func (ec2 *EC2) CreateSecurityGroup(name, description string) (resp *CreateSecur
ityGroupResp, err error) { | 643 func (ec2 *EC2) CreateSecurityGroup(name, description string) (resp *CreateSecur
ityGroupResp, err error) { |
644 » params := makeParams("CreateSecurityGroup") | 644 » return ec2.CreateSecurityGroupVPC("", name, description) |
| 645 } |
| 646 |
| 647 // CreateSecurityGroupVPC creates a security group in EC2, associated |
| 648 // with the given VPC ID. If vpcId is empty, this call is equivalent |
| 649 // to CreateSecurityGroup. |
| 650 // |
| 651 // See http://goo.gl/Eo7Yl for more details. |
| 652 func (ec2 *EC2) CreateSecurityGroupVPC(vpcId, name, description string) (resp *C
reateSecurityGroupResp, err error) { |
| 653 » params := makeParamsVPC("CreateSecurityGroup") |
645 params["GroupName"] = name | 654 params["GroupName"] = name |
646 params["GroupDescription"] = description | 655 params["GroupDescription"] = description |
| 656 if vpcId != "" { |
| 657 params["VpcId"] = vpcId |
| 658 } |
647 | 659 |
648 resp = &CreateSecurityGroupResp{} | 660 resp = &CreateSecurityGroupResp{} |
649 err = ec2.query(params, resp) | 661 err = ec2.query(params, resp) |
650 if err != nil { | 662 if err != nil { |
651 return nil, err | 663 return nil, err |
652 } | 664 } |
653 resp.Name = name | 665 resp.Name = name |
654 return resp, nil | 666 return resp, nil |
655 } | 667 } |
656 | 668 |
657 // SecurityGroupsResp represents a response to a DescribeSecurityGroups | 669 // SecurityGroupsResp represents a response to a DescribeSecurityGroups |
658 // request in EC2. | 670 // request in EC2. |
659 // | 671 // |
660 // See http://goo.gl/k12Uy for more details. | 672 // See http://goo.gl/k12Uy for more details. |
661 type SecurityGroupsResp struct { | 673 type SecurityGroupsResp struct { |
662 RequestId string `xml:"requestId"` | 674 RequestId string `xml:"requestId"` |
663 Groups []SecurityGroupInfo `xml:"securityGroupInfo>item"` | 675 Groups []SecurityGroupInfo `xml:"securityGroupInfo>item"` |
664 } | 676 } |
665 | 677 |
666 // SecurityGroup encapsulates details for a security group in EC2. | 678 // SecurityGroup encapsulates details for a security group in EC2. |
667 // | 679 // |
668 // See http://goo.gl/CIdyP for more details. | 680 // See http://goo.gl/CIdyP for more details. |
669 type SecurityGroupInfo struct { | 681 type SecurityGroupInfo struct { |
670 SecurityGroup | 682 SecurityGroup |
| 683 VPCId string `xml:"vpcId"` |
671 OwnerId string `xml:"ownerId"` | 684 OwnerId string `xml:"ownerId"` |
672 Description string `xml:"groupDescription"` | 685 Description string `xml:"groupDescription"` |
673 IPPerms []IPPerm `xml:"ipPermissions>item"` | 686 IPPerms []IPPerm `xml:"ipPermissions>item"` |
674 } | 687 } |
675 | 688 |
676 // IPPerm represents an allowance within an EC2 security group. | 689 // IPPerm represents an allowance within an EC2 security group. |
677 // | 690 // |
678 // See http://goo.gl/4oTxv for more details. | 691 // See http://goo.gl/4oTxv for more details. |
679 type IPPerm struct { | 692 type IPPerm struct { |
680 Protocol string `xml:"ipProtocol"` | 693 Protocol string `xml:"ipProtocol"` |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
901 func (ec2 *EC2) RebootInstances(ids ...string) (resp *SimpleResp, err error) { | 914 func (ec2 *EC2) RebootInstances(ids ...string) (resp *SimpleResp, err error) { |
902 params := makeParams("RebootInstances") | 915 params := makeParams("RebootInstances") |
903 addParamsList(params, "InstanceId", ids) | 916 addParamsList(params, "InstanceId", ids) |
904 resp = &SimpleResp{} | 917 resp = &SimpleResp{} |
905 err = ec2.query(params, resp) | 918 err = ec2.query(params, resp) |
906 if err != nil { | 919 if err != nil { |
907 return nil, err | 920 return nil, err |
908 } | 921 } |
909 return resp, nil | 922 return resp, nil |
910 } | 923 } |
OLD | NEW |