2014-03-18 20:00:41 +04:00
|
|
|
package datasource
|
2014-03-05 04:36:05 +04:00
|
|
|
|
2014-05-22 22:37:19 +04:00
|
|
|
import "github.com/coreos/coreos-cloudinit/pkg"
|
2014-05-21 21:13:20 +04:00
|
|
|
|
2014-03-05 04:36:05 +04:00
|
|
|
type metadataService struct {
|
2014-04-23 02:36:07 +04:00
|
|
|
url string
|
2014-03-05 04:36:05 +04:00
|
|
|
}
|
|
|
|
|
2014-03-05 05:06:52 +04:00
|
|
|
func NewMetadataService(url string) *metadataService {
|
2014-04-23 02:36:07 +04:00
|
|
|
return &metadataService{url}
|
2014-03-05 04:36:05 +04:00
|
|
|
}
|
|
|
|
|
2014-03-18 20:00:41 +04:00
|
|
|
func (ms *metadataService) Fetch() ([]byte, error) {
|
2014-05-22 22:37:19 +04:00
|
|
|
client := pkg.NewHttpClient()
|
2014-05-21 21:13:20 +04:00
|
|
|
return client.Get(ms.url)
|
2014-03-05 04:36:05 +04:00
|
|
|
}
|
|
|
|
|
2014-03-18 20:00:41 +04:00
|
|
|
func (ms *metadataService) Type() string {
|
|
|
|
return "metadata-service"
|
|
|
|
}
|