Help us shape the future of Go! Take the 2026 Go Developer Survey

imds

package
v1.7.21 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrVMUniqueIDNotFound   = errors.New("vm unique ID not found")
	ErrUnexpectedStatusCode = errors.New("imds returned an unexpected status code")
)

Functions

This section is empty.

Types

type APIVersionsResponse

type APIVersionsResponse struct {
	APIVersions []string `json:"apiVersions"`
}

APIVersionsResponse represents versions form IMDS

type Client

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

Client returns metadata about the VM by querying IMDS

func NewClient

func NewClient(opts ...ClientOption) *Client

NewClient creates a new imds client

func (*Client) GetIMDSVersions

func (c *Client) GetIMDSVersions(ctx context.Context) (*APIVersionsResponse, error)

func (*Client) GetNetworkInterfaces

func (c *Client) GetNetworkInterfaces(ctx context.Context) ([]NetworkInterface, error)

func (*Client) GetVMUniqueID

func (c *Client) GetVMUniqueID(ctx context.Context) (string, error)

type ClientOption

type ClientOption func(*clientConfig)

func Endpoint

func Endpoint(endpoint string) ClientOption

Endpoint overrides the default endpoint for a Client

func RetryAttempts

func RetryAttempts(attempts uint) ClientOption

RetryAttempts overrides the default retry attempts for the client

type HardwareAddr

type HardwareAddr net.HardwareAddr

Required for marshaling/unmarshaling of mac address

func (*HardwareAddr) MarshalJSON

func (h *HardwareAddr) MarshalJSON() ([]byte, error)

func (*HardwareAddr) String

func (h *HardwareAddr) String() string

func (*HardwareAddr) UnmarshalJSON

func (h *HardwareAddr) UnmarshalJSON(data []byte) error

type NetworkInterface

type NetworkInterface struct {
	// IMDS returns compartment fields - these are mapped to NC ID and NC version
	MacAddress             HardwareAddr `json:"macAddress"`
	InterfaceCompartmentID string       `json:"interfaceCompartmentID,omitempty"`
}

NetworkInterface represents a network interface from IMDS

type NetworkInterfaces

type NetworkInterfaces struct {
	Interface []NetworkInterface `json:"interface"`
}

NetworkInterfaces represents the network interfaces from IMDS

Jump to

Keyboard shortcuts

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