google

package
v0.16.1 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a private struct containing internal state for the Google Metadata service connection.

func NewGoogleClient

func NewGoogleClient(host string) (*Client, error)

NewGoogleClient returns a client object to query the Google Metadata service.

func (*Client) GetValues

func (c *Client) GetValues(keys []string) (map[string]string, error)

GetValues returns a map of the provided keys to their associated values in the Google Metadata service. Recursive lookups are done by default. For keys that map to a simple file or string value a simple string is returned. For keys that reference a directory entry or other complex data type a string containing raw JSON encoded data is returned. For a directory this will be a map of sub-keys to values or other maps. For the instance/tags key this will be a JSON list of tags. On error or key not found a non-nil error is returned with a partially populated map.

func (*Client) WatchPrefix

func (c *Client) WatchPrefix(prefix string, keys []string, waitIndex uint64, stopChan chan bool) (uint64, error)

WatchPrefix watches a set of Google Metadata rooted at the prefix string for changes. The slice of keys is ignored for simplicity. The waitIndex is the uint64 encoded ETag number expressing the hash of the metadata object and must be 0 on the first call. The stopChan channel causes this function to cancel and return the last known waitIndex.

When changes are detected this function returns the uint64 version of the ETag and a nil error object. On error the last waitIndex is returned and err is non-nil.

Jump to

Keyboard shortcuts

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