utils

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2017 License: Apache-2.0 Imports: 9 Imported by: 0

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