metadata

package
v0.0.0-...-072ffd2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 30, 2022 License: BSD-3-Clause Imports: 3 Imported by: 1

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func Email

func Email(serviceAccount string) (string, error)

Email calls Client.Email on the default client.

func ExternalIP

func ExternalIP() (string, error)

ExternalIP returns the instance's primary external (public) IP address.

func Get

func Get(suffix string) (string, error)

Get calls Client.Get on the default client.

func Hostname

func Hostname() (string, error)

Hostname returns the instance's hostname. This will be of the form "<instanceID>.c.<projID>.internal".

func InstanceAttributeValue

func InstanceAttributeValue(attr string) (string, error)

InstanceAttributeValue calls Client.InstanceAttributeValue on the default client.

func InstanceID

func InstanceID() (string, error)

InstanceID returns the current VM's numeric instance ID.

func InstanceName

func InstanceName() (string, error)

InstanceName returns the current VM's instance ID string.

func InstanceTags

func InstanceTags() ([]string, error)

InstanceTags returns the list of user-defined instance tags, assigned when initially creating a GCE instance.

func InternalIP

func InternalIP() (string, error)

InternalIP returns the instance's primary internal IP address.

func NumericProjectID

func NumericProjectID() (string, error)

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

func ProjectAttributeValue(attr string) (string, error)

ProjectAttributeValue calls Client.ProjectAttributeValue on the default client.

func ProjectAttributes

func ProjectAttributes() ([]string, error)

ProjectAttributes calls Client.ProjectAttributes on the default client.

func ProjectID

func ProjectID() (string, error)

ProjectID returns the current instance's project ID string.

func Scopes

func Scopes(serviceAccount string) ([]string, error)

Scopes calls Client.Scopes on the default client.

func Subscribe

func Subscribe(suffix string, fn func(v string, ok bool) error) error

Subscribe calls Client.Subscribe on the default client.

func Zone

func Zone() (string, error)

Zone returns the current VM's zone, such as "us-central1-b".

Types

type Client

type Client = metadata.Client

A Client provides metadata.

func NewClient

func NewClient(c *http.Client) *Client

NewClient returns a Client that can be used to fetch metadata. Returns the client that uses the specified http.Client for HTTP requests. If nil is Scopes calls Client.Scopes on the default client.

type Error

type Error = metadata.Error

Error contains an error response from the server.

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.

Directories

Path Synopsis
fake module

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL