Skip to content

Commit

Permalink
Merge remote-tracking branch 'crowdmob/master'
Browse files Browse the repository at this point in the history
Conflicts:
	ec2/ec2.go
	ec2/ec2_test.go
  • Loading branch information
mattheath committed Mar 31, 2014
2 parents 344af86 + 2dcceab commit 862ba58
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 16 deletions.
30 changes: 17 additions & 13 deletions ec2/ec2.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ type xmlErrors struct {
var timeNow = time.Now

func (ec2 *EC2) query(params map[string]string, resp interface{}) error {
params["Version"] = "2013-07-15"
params["Version"] = "2014-02-01"
params["Timestamp"] = timeNow().In(time.UTC).Format(time.RFC3339)
endpoint, err := url.Parse(ec2.Region.EC2Endpoint)
if err != nil {
Expand Down Expand Up @@ -243,15 +243,15 @@ type RunInstancesOptions struct {
UserData []byte
AvailabilityZone string
PlacementGroupName string
Tenancy string
Monitoring bool
SubnetId string
DisableAPITermination bool
ShutdownBehavior string
PrivateIPAddress string
IamInstanceProfileArn string
IamInstanceProfileName string
IamInstanceProfile string
IamInstanceProfile IamInstanceProfile
BlockDevices []BlockDeviceMapping
EbsOptimized bool
AssociatePublicIpAddress bool
}

Expand Down Expand Up @@ -398,8 +398,9 @@ type InstancePrivateIpAddress struct {
// IamInstanceProfile
// See http://goo.gl/PjyijL for more details
type IamInstanceProfile struct {
ARN string `xml:"arn"`
Id string `xml:"id"`
ARN string `xml:"arn"`
Id string `xml:"id"`
Name string `xml:"name"`
}

// RunInstances starts new instances in EC2.
Expand Down Expand Up @@ -451,6 +452,9 @@ func (ec2 *EC2) RunInstances(options *RunInstancesOptions) (resp *RunInstancesRe
if options.PlacementGroupName != "" {
params["Placement.GroupName"] = options.PlacementGroupName
}
if options.Tenancy != "" {
params["Placement.Tenancy"] = options.Tenancy
}
if options.Monitoring {
params["Monitoring.Enabled"] = "true"
}
Expand Down Expand Up @@ -490,14 +494,11 @@ func (ec2 *EC2) RunInstances(options *RunInstancesOptions) (resp *RunInstancesRe
}
}
}
if options.IamInstanceProfile != "" {
params["IamInstanceProfile.Name"] = options.IamInstanceProfile
}
if options.IamInstanceProfileArn != "" {
params["IamInstanceProfile.Arn"] = options.IamInstanceProfileArn
if options.IamInstanceProfile.ARN != "" {
params["IamInstanceProfile.Arn"] = options.IamInstanceProfile.ARN
}
if options.IamInstanceProfileName != "" {
params["IamInstanceProfile.Name"] = options.IamInstanceProfileName
if options.IamInstanceProfile.Name != "" {
params["IamInstanceProfile.Name"] = options.IamInstanceProfile.Name
}
if options.DisableAPITermination {
params["DisableApiTermination"] = "true"
Expand All @@ -508,6 +509,9 @@ func (ec2 *EC2) RunInstances(options *RunInstancesOptions) (resp *RunInstancesRe
if options.PrivateIPAddress != "" {
params["PrivateIpAddress"] = options.PrivateIPAddress
}
if options.EbsOptimized {
params["EbsOptimized"] = "true"
}

addBlockDeviceParams(params, options.BlockDevices)

Expand Down
2 changes: 1 addition & 1 deletion ec2/ec2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -959,7 +959,7 @@ func (s *S) TestSignatureWithEndpointPath(c *gocheck.C) {
c.Assert(err, gocheck.IsNil)

req := testServer.WaitRequest()
c.Assert(req.Form["Signature"], gocheck.DeepEquals, []string{"WaKDWBipeZzpFeqg5PpHw8ayfiqPqB2SX5HsH8+b6+k="})
c.Assert(req.Form["Signature"], gocheck.DeepEquals, []string{"VVoC6Y6xfES+KvZo+789thP8+tye4F6fOKBiKmXk4S4="})
}

func (s *S) TestAllocateAddressExample(c *gocheck.C) {
Expand Down
4 changes: 2 additions & 2 deletions elb/elb.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,8 @@ func (elb *ELB) DescribeInstanceHealth(lbName string, instanceIds ...string) (*D
"Action": "DescribeInstanceHealth",
"LoadBalancerName": lbName,
}
for _, iId := range instanceIds {
key := fmt.Sprintf("Instances.member.1.InstanceId")
for i, iId := range instanceIds {
key := fmt.Sprintf("Instances.member.%d.InstanceId", i+1)
params[key] = iId
}
resp := new(DescribeInstanceHealthResp)
Expand Down

0 comments on commit 862ba58

Please sign in to comment.