instanceinfo

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: May 8, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package instanceinfo provides functionality for interfacing with the compute API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NetworkInterfaceAddressMap

func NetworkInterfaceAddressMap() (map[InterfaceName][]NetworkAddress, error)

NetworkInterfaceAddressMap is an implementation of a NetworkInterfaceAddressMapper which uses the net package as a reference for the list of a system's network interfaces.

Types

type DiskMapper

type DiskMapper interface {
	ForDeviceName(string) (string, error)
}

The DiskMapper interface is a wrapper which allows for ease of testing.

type InterfaceName

type InterfaceName string

InterfaceName is the name of a network interface, e.g. "lo"

type NetworkAddress

type NetworkAddress string

NetworkAddress is a string representation of a network address, e.g. "127.0.0.1/32"

type NetworkInterfaceAddressMapper

type NetworkInterfaceAddressMapper func() (map[InterfaceName][]NetworkAddress, error)

NetworkInterfaceAddressMapper describes a function which generates the association between interface names and network addresses.

type PhysicalPathReader

type PhysicalPathReader struct {
	OS string
}

A PhysicalPathReader reads disk mapping information from the OS.

func (*PhysicalPathReader) ForDeviceName

func (r *PhysicalPathReader) ForDeviceName(deviceName string) (string, error)

ForDeviceName returns the phsyical device name of the disk mapped to "deviceName".

type Reader

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

Reader handles the retrieval of instance properties from a compute client instance.

func New

func New(dm DiskMapper, gceService gceInterface) *Reader

New instantiates a Reader with default instance properties.

func (*Reader) InstanceProperties

func (r *Reader) InstanceProperties() *instancepb.InstanceProperties

InstanceProperties returns the currently set instance property information.

func (*Reader) Read

Read queries instance information using the compute API and stores the result as instanceProperties.

Jump to

Keyboard shortcuts

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