package metadata
import "github.com/google/cadvisor/Godeps/_workspace/src/google.golang.org/cloud/compute/metadata"
Package metadata provides access to Google Compute Engine (GCE) metadata and API service accounts.
This package is a wrapper around the GCE metadata service, as documented at https://developers.google.com/compute/docs/metadata.
Index ¶
- func ExternalIP() (string, error)
- func Get(suffix string) (string, error)
- func Hostname() (string, error)
- func InstanceAttributeValue(attr string) (string, error)
- func InstanceAttributes() ([]string, error)
- func InstanceID() (string, error)
- func InstanceTags() ([]string, error)
- func InternalIP() (string, error)
- func NumericProjectID() (string, error)
- func OnGCE() bool
- func ProjectAttributeValue(attr string) (string, error)
- func ProjectAttributes() ([]string, error)
- func ProjectID() (string, error)
- func Scopes(serviceAccount string) ([]string, error)
Functions ¶
func ExternalIP ¶
ExternalIP returns the instance's primary external (public) IP address.
func Get ¶
Get returns a value from the metadata service. The suffix is appended to "http://metadata/computeMetadata/v1/".
func Hostname ¶
Hostname returns the instance's hostname. This will probably be of the form "INSTANCENAME.c.PROJECT.internal" but that isn't guaranteed.
TODO: what is this defined to be? Docs say "The host name of the instance."
func InstanceAttributeValue ¶
InstanceAttributeValue returns the value of the provided VM instance attribute.
func InstanceAttributes ¶
InstanceAttributes returns the list of user-defined attributes, assigned when initially creating a GCE VM instance. The value of an attribute can be obtained with InstanceAttributeValue.
func InstanceID ¶
InstanceID returns the current VM's numeric instance ID.
func InstanceTags ¶
InstanceTags returns the list of user-defined instance tags, assigned when initially creating a GCE instance.
func InternalIP ¶
InternalIP returns the instance's primary internal IP address.
func NumericProjectID ¶
NumericProjectID returns the current instance's numeric project ID.
func OnGCE ¶
func OnGCE() bool
OnGCE reports whether this process is running on Google Compute Engine.
func ProjectAttributeValue ¶
ProjectAttributeValue returns the value of the provided project attribute.
func ProjectAttributes ¶
ProjectAttributes returns the list of user-defined attributes applying to the project as a whole, not just this VM. The value of an attribute can be obtained with ProjectAttributeValue.
func ProjectID ¶
ProjectID returns the current instance's project ID string.
func Scopes ¶
Scopes returns the service account scopes for the given account. The account may be empty or the string "default" to use the instance's main account.
Source Files ¶
- Version
- v0.23.0
- Published
- Apr 21, 2016
- Platform
- linux/amd64
- Imports
- 9 packages
- Last checked
- 6 minutes ago –
Tools for package owners.