| 142 | } |
| 143 | |
| 144 | func (c *Client) RetrieveSecurityGroups(securityGroupIDs []string) ([]*_ec2.SecurityGroup, error) { |
| 145 | // NOTE: used Filter instead of GroupIds attribute because GroupIds |
| 146 | // returns error when it cannot find the matching security groups. |
| 147 | params := &_ec2.DescribeSecurityGroupsInput{ |
| 148 | Filters: []*_ec2.Filter{ |
| 149 | { |
| 150 | Name: _aws.String("group-id"), |
| 151 | Values: _aws.StringSlice(securityGroupIDs), |
| 152 | }, |
| 153 | }, |
| 154 | } |
| 155 | |
| 156 | res, err := c.svc.DescribeSecurityGroups(params) |
| 157 | if err != nil { |
| 158 | return nil, err |
| 159 | } |
| 160 | |
| 161 | return res.SecurityGroups, nil |
| 162 | } |
| 163 | |
| 164 | func (c *Client) RetrieveSecurityGroupByName(name string) (*_ec2.SecurityGroup, error) { |
| 165 | // NOTE: used Filter instead of GroupNames attribute because GroupNames |