imds

package
v1.7.13 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 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 added in v1.7.3

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 added in v1.7.3

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

func (*Client) GetNetworkInterfaces added in v1.7.3

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 added in v1.7.3

type HardwareAddr net.HardwareAddr

Required for marshaling/unmarshaling of mac address

func (*HardwareAddr) MarshalJSON added in v1.7.3

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

func (*HardwareAddr) String added in v1.7.3

func (h *HardwareAddr) String() string

func (*HardwareAddr) UnmarshalJSON added in v1.7.3

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

type NetworkInterface added in v1.7.3

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 added in v1.7.3

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