mirror of https://github.com/docker/docs.git
Clean up unused function
Signed-off-by: Nathan LeClaire <nathan.leclaire@gmail.com>
This commit is contained in:
parent
7bf67e41c9
commit
3a030c9ccb
|
@ -8,9 +8,7 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/docker/machine/state"
|
|
||||||
awsauth "github.com/smartystreets/go-aws-auth"
|
awsauth "github.com/smartystreets/go-aws-auth"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -486,40 +484,6 @@ func (e *EC2) GetKeyPair(name string) (*KeyPair, error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *EC2) GetInstanceState(instanceId string) (state.State, error) {
|
|
||||||
resp, err := e.performInstanceAction(instanceId, "DescribeInstances", nil)
|
|
||||||
if err != nil {
|
|
||||||
return state.Error, err
|
|
||||||
}
|
|
||||||
defer resp.Body.Close()
|
|
||||||
contents, err := ioutil.ReadAll(resp.Body)
|
|
||||||
if err != nil {
|
|
||||||
return state.Error, fmt.Errorf("Error reading AWS response body: %s", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
unmarshalledResponse := DescribeInstancesResponse{}
|
|
||||||
if err = xml.Unmarshal(contents, &unmarshalledResponse); err != nil {
|
|
||||||
return state.Error, fmt.Errorf("Error unmarshalling AWS response XML: %s", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
reservationSet := unmarshalledResponse.ReservationSet[0]
|
|
||||||
instanceState := reservationSet.InstancesSet[0].InstanceState
|
|
||||||
|
|
||||||
shortState := strings.TrimSpace(instanceState.Name)
|
|
||||||
switch shortState {
|
|
||||||
case "pending":
|
|
||||||
return state.Starting, nil
|
|
||||||
case "running":
|
|
||||||
return state.Running, nil
|
|
||||||
case "stopped":
|
|
||||||
return state.Stopped, nil
|
|
||||||
case "stopping":
|
|
||||||
return state.Stopped, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
return state.Error, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (e *EC2) GetInstance(instanceId string) (EC2Instance, error) {
|
func (e *EC2) GetInstance(instanceId string) (EC2Instance, error) {
|
||||||
ec2Instance := EC2Instance{}
|
ec2Instance := EC2Instance{}
|
||||||
resp, err := e.performInstanceAction(instanceId, "DescribeInstances", nil)
|
resp, err := e.performInstanceAction(instanceId, "DescribeInstances", nil)
|
||||||
|
|
Loading…
Reference in New Issue