metadata

package
v3.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

This package provides functions to interact with the Exoscale metadata server and retrieve user-data (Cloudinit or Ignition data).

Index

Constants

View Source
const (
	URL         = "http://metadata.exoscale.com/latest/"
	MetaDataURL = URL + "meta-data"
	UserDataURL = URL + "user-data"

	CdRomPath = "/dev/disk/by-label/cidata"
)

Variables

This section is empty.

Functions

func FromCdRom

func FromCdRom(endpoint Endpoint) (string, error)

FromCdRom retrieves metadata for Exoscale Private Instance, from the attached CD-ROM(iso9660) device file system. Important note: Run this code as privileged user. Not Windows compatible.

func Get

func Get(ctx context.Context, endpoint Endpoint) (string, error)

Get retrieves the value for a specific type of Exoscale metadata. Provide the desired Endpoint constant as an argument.

func UserData

func UserData(ctx context.Context) (string, error)

UserData retrieves the user-data associated with the current instance from the Exoscale server. This data is typically used for Cloudinit/Ignition configuration.

Types

type Endpoint

type Endpoint string

Endpoint represents different types of metadata available on the Exoscale server.

const (
	AvailabilityZone Endpoint = "availability-zone"
	CloudIdentifier  Endpoint = "cloud-identifier"
	InstanceID       Endpoint = "instance-id"
	LocalHostname    Endpoint = "local-hostname"
	LocalIpv4        Endpoint = "local-ipv4"
	PublicHostname   Endpoint = "public-hostname"
	PublicIpv4       Endpoint = "public-ipv4"
	ServiceOffering  Endpoint = "service-offering"
	VMID             Endpoint = "vm-id"
)

These constants define the various types of Exoscale metadata you can retrieve. Use the Get function to access specific metadata.

Jump to

Keyboard shortcuts

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