gce

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package gce provides functionality for reading GCE instance metadata.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Metadata

type Metadata struct {
	InstanceID []byte
	ProjectID  []byte
	Zone       []byte

	// Unattended joins
	Audience string
	Identity []byte
}

Metadata holds GCE instance metadata.

func (*Metadata) Read

func (m *Metadata) Read() error

Read loads metadata from the instance.

func (*Metadata) ShortZone

func (m *Metadata) ShortZone() string

ShortZone returns the short version of the GCE Zone.

The metadata zone value is of the form 'projects/324016238535/zones/us-west1-a'; however, only the last part, i.e. us-west1-a, is required for Splice (b/34588301).

func (*Metadata) UniqueID

func (m *Metadata) UniqueID() string

UniqueID constructs the unique version of the GCE ID, consisting of the short zone name, project ID and instance ID, all separated by '/' characters.

Jump to

Keyboard shortcuts

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