utils

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2017 License: Apache-2.0 Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (

	// DiskNameRX contains the regex pattern for matching a valid GCE disk
	// name the first character must be a lowercase letter, and all following
	// characters must be a dash, lowercase letter, or digit, except the
	// last character, which cannot be a dash.
	DiskNameRX = `[a-z](?:[-a-z0-9]*[a-z0-9])?$`
)

Variables

This section is empty.

Functions

func GetDisks

func GetDisks(ctx types.Context) (map[string]string, error)

GetDisks returns a string slice containing the names of all the disks attached to the local instance

func GetIndex

func GetIndex(href string) string

GetIndex returns the trailing "document" in a URL

func InstanceID

func InstanceID(ctx types.Context) (*types.InstanceID, error)

InstanceID returns the instance ID for the local host.

func IsGCEInstance

func IsGCEInstance(ctx types.Context) (bool, error)

IsGCEInstance returns a flag indicating whether the executing host is a GCE instance based on whether or not the metadata URL can be accessed.

func IsValidDiskName

func IsValidDiskName(name *string) bool

IsValidDiskName returns a boolean of whether the given name is valid for a GCE disk

Types

type Disk

type Disk struct {
	DeviceName string `json:"deviceName"`
	Index      uint32 `json:"index"`
	Mode       string `json:"mode"`
	Type       string `json:"type"`
}

Disk holds the data returned in the disks metadata

Jump to

Keyboard shortcuts

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