Documentation ¶
Overview ¶
Package metadata holds the "cloud.google.com/go/compute/metadata@v1.6.1" functions and types aliases.
Follow are original package documentation:
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://cloud.google.com/compute/docs/metadata/overview.
Index ¶
- func Email(serviceAccount string) (string, error)
- func ExternalIP() (string, error)
- func Get(suffix string) (string, error)
- func Hostname() (string, error)
- func InstanceAttributeValue(attr string) (string, error)
- func InstanceID() (string, error)
- func InstanceName() (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)
- func Subscribe(suffix string, fn func(v string, ok bool) error) error
- func Zone() (string, error)
- type Client
- type Error
- type NotDefinedError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExternalIP ¶
ExternalIP returns the instance's primary external (public) IP address.
func Hostname ¶
Hostname returns the instance's hostname. This will be of the form "<instanceID>.c.<projID>.internal".
func InstanceAttributeValue ¶
InstanceAttributeValue calls Client.InstanceAttributeValue on the default client.
func InstanceID ¶
InstanceID returns the current VM's numeric instance ID.
func InstanceName ¶
InstanceName returns the current VM's instance ID string.
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 calls Client.ProjectAttributeValue on the default client.
func ProjectAttributes ¶
ProjectAttributes calls Client.ProjectAttributes on the default client.
Types ¶
type NotDefinedError ¶
type NotDefinedError = metadata.NotDefinedError
NotDefinedError is returned when requested metadata is not defined.
The underlying string is the suffix after "/computeMetadata/v1/".
This error is not returned if the value is defined to be the empty string.