|
|
@@ -2,7 +2,6 @@ package cloud
|
|
|
|
|
|
import (
|
|
|
"encoding/json"
|
|
|
- "errors"
|
|
|
"fmt"
|
|
|
"io"
|
|
|
"io/ioutil"
|
|
|
@@ -181,7 +180,7 @@ func (aws *AWS) DownloadPricingData() error {
|
|
|
for {
|
|
|
t, err := dec.Token()
|
|
|
if err == io.EOF {
|
|
|
- fmt.Printf("done \n")
|
|
|
+ log.Printf("done loading \"%s\"\n", pricingURL)
|
|
|
break
|
|
|
}
|
|
|
if t == "products" {
|
|
|
@@ -192,7 +191,7 @@ func (aws *AWS) DownloadPricingData() error {
|
|
|
err := dec.Decode(&product)
|
|
|
|
|
|
if err != nil {
|
|
|
- fmt.Printf("Error: " + err.Error())
|
|
|
+ log.Printf("Error parsing response from \"%s\": %v", pricingURL, err.Error())
|
|
|
break
|
|
|
}
|
|
|
if product.Attributes.PreInstalledSw == "NA" &&
|
|
|
@@ -225,7 +224,7 @@ func (aws *AWS) DownloadPricingData() error {
|
|
|
offerTerm := &AWSOfferTerm{}
|
|
|
err := dec.Decode(&offerTerm)
|
|
|
if err != nil {
|
|
|
- fmt.Printf("Error: " + err.Error())
|
|
|
+ log.Printf("Error decoding AWS Offer Term: " + err.Error())
|
|
|
}
|
|
|
if sku.(string)+OnDemandRateCode == skuOnDemand {
|
|
|
key, ok := skusToKeys[sku.(string)]
|
|
|
@@ -314,7 +313,7 @@ func (aws *AWS) NodePricing(key string) (*Node, error) {
|
|
|
UsageType: usageType,
|
|
|
}, nil
|
|
|
} else {
|
|
|
- return nil, errors.New("Invalid Pricing Key: " + key + "\n")
|
|
|
+ return nil, fmt.Errorf("Invalid Pricing Key \"%s\"", key)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -353,7 +352,7 @@ func (*AWS) GetDisks() ([]byte, error) {
|
|
|
os.Setenv("AWS_ACCESS_KEY_ID", result["access_key_ID"])
|
|
|
os.Setenv("AWS_SECRET_ACCESS_KEY", result["secret_access_key"])
|
|
|
} else if os.IsNotExist(err) {
|
|
|
- log.Printf("Using Default Credentials")
|
|
|
+ log.Print("Using Default Credentials")
|
|
|
} else {
|
|
|
return nil, err
|
|
|
}
|
|
|
@@ -401,7 +400,7 @@ func (*AWS) QuerySQL(query string) ([]byte, error) {
|
|
|
os.Setenv("AWS_ACCESS_KEY_ID", result["access_key_ID"])
|
|
|
os.Setenv("AWS_SECRET_ACCESS_KEY", result["secret_access_key"])
|
|
|
} else if os.IsNotExist(err) {
|
|
|
- log.Printf("Using Default Credentials")
|
|
|
+ log.Print("Using Default Credentials")
|
|
|
} else {
|
|
|
return nil, err
|
|
|
}
|
|
|
@@ -441,8 +440,8 @@ func (*AWS) QuerySQL(query string) ([]byte, error) {
|
|
|
return nil, err
|
|
|
}
|
|
|
|
|
|
- fmt.Println("StartQueryExecution result:")
|
|
|
- fmt.Println(res.GoString())
|
|
|
+ log.Println("StartQueryExecution result:")
|
|
|
+ log.Println(res.GoString())
|
|
|
|
|
|
var qri athena.GetQueryExecutionInput
|
|
|
qri.SetQueryExecutionId(*res.QueryExecutionId)
|