feat(metadata): Add --from-url flag

This commit is contained in:
Brian Waldon
2014-03-04 17:06:52 -08:00
parent 20df7b6a19
commit 85f151011c
2 changed files with 18 additions and 6 deletions

View File

@@ -6,15 +6,16 @@ import (
)
type metadataService struct {
url string
client http.Client
}
func NewMetadataService() *metadataService {
return &metadataService{http.Client{}}
func NewMetadataService(url string) *metadataService {
return &metadataService{url, http.Client{}}
}
func (ms *metadataService) UserData() ([]byte, error) {
resp, err := ms.client.Get("http://169.254.169.254/2012-01-12/user-data")
resp, err := ms.client.Get(ms.url)
if err != nil {
return []byte{}, err
}