Skip to content

io.systemd.InstanceMetadata

APIs for acquiring cloud IMDS information.

Property Value
Go package github.com/rossedman/sdvarlink/systemd/latest/instancemetadata
Socket /run/systemd/io.systemd.InstanceMetadata
Available since systemd v262
Methods · types · errors 2 · 1 · 6

Methods

Get

Acquire data.

func (c *Client) Get(ctx context.Context, in GetIn) (*GetOut, error)

Parameters

Field Type Description
key ?string The key to retrieve
wellKnown ?WellKnown Start with a well-known key
interface ?int The network interface to use
refreshUSec ?int Refresh cached data if older (CLOCK_BOOTTIME, µs)
cache ?bool Whether to accept cached data
firewallMark ?int The firewall mark value to use
wait ?bool Controls whether to wait for connectivity
allowInteractiveAuthentication ?bool Controls whether interactive authentication (via polkit) shall be allowed. If unspecified defaults to false.

Reply

Field Type Description
data string The data in Base64 encoding.
interface ?int The interface the data was found on.

GetVendorInfo

Get information about cloud vendor and IMDS connectivity.

func (c *Client) GetVendorInfo(ctx context.Context) (*GetVendorInfoOut, error)

Reply

Field Type Description
vendor ?string The detected cloud vendor
tokenUrl ?string The URL to acquire the token from
refreshHeaderName ?string The HTTP header to configure the refresh timeout for the token in
dataUrl ?string The base URL to acquire the data from
dataUrlSuffix ?string A suffix to append to the data URL
tokenHeaderName ?string The HTTP header to pass the token in when requesting data
extraHeader ?[]string Additional HTTP headers to pass when acquiring data
addressIPv4 ?[]int IPv4 address of IMDS server
addressIPv6 ?[]int IPv6 address of IMDS server
wellKnown ?object Well-known fields

Types

WellKnown

Well known data fields

Value Description
base
hostname
region
zone
ipv4_public
ipv6_public
ssh_key
userdata
userdata_base
userdata_base64

Errors

Error Go type Description
KeyNotFound KeyNotFoundError The requested key is not found on the IMDS server.
NotAvailable NotAvailableError IMDS is disabled or otherwise not available.
NotSupported NotSupportedError IMDS is not supported.
WellKnownKeyUnset WellKnownKeyUnsetError Well-known key is not set.
CommunicationFailure CommunicationFailureError Communication with IMDS failed.
Timeout TimeoutError Timeout reached