Documentation ¶
Index ¶
- Variables
- func GetServer(r *http.Request) net.IP
- func Register(t config.SourceType, source Source)
- type CloudInitEventType
- type CloudInitReport
- type CloudInitResultType
- type InterfaceType
- type Metadata
- type MetadataInterface
- type MetadataRoute
- type MetadataSubnet
- type MetadataSubnetType
- type ReportMessage
- type ReportMessageLevelType
- type Routes
- type Source
- type SourceConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrFailedGetRemoteAddress = errors.New("failed to parse remote address")
View Source
var ErrNoDatasourceFound = errors.New("no datasource found")
View Source
var ErrNoMatchingMetadata = errors.New("no matching metadata found")
Functions ¶
func Register ¶
func Register(t config.SourceType, source Source)
Types ¶
type CloudInitEventType ¶
type CloudInitEventType string
const ( CloudInitEventTypeStart CloudInitEventType = "start" CloudInitEventTypeEnd CloudInitEventType = "finish" )
type CloudInitReport ¶
type CloudInitReport struct { Name string `json:"name"` Description string `json:"description"` EventType CloudInitEventType `json:"event_type"` Origin string `json:"origin"` Timestamp float64 `json:"timestamp"` Result CloudInitResultType `json:"result"` }
func (*CloudInitReport) ToReportMessage ¶
func (c *CloudInitReport) ToReportMessage() ReportMessage
type CloudInitResultType ¶
type CloudInitResultType string
const ( CloudInitResultTypeSuccess CloudInitResultType = "SUCCESS" CloudInitResultTypeWarn CloudInitResultType = "WARN" CloudInitResultTypeFail CloudInitResultType = "FAIL" )
type InterfaceType ¶
type InterfaceType string
const ( InterfaceTypePhysical InterfaceType = "physical" InterfaceTypeBond InterfaceType = "bond" InterfaceTypeBridge InterfaceType = "bridge" InterfaceTypeVLAN InterfaceType = "vlan" )
type Metadata ¶
type Metadata struct { InstanceID string `json:"id"` ProjectID *string `json:"project_id"` InstanceType string `json:"instance_type"` LocalHostname string `json:"local_hostname"` PublicHostname string `json:"public_hostname"` AvailabilityZone *string `json:"availability_zone"` UserData []byte `json:"user_data"` VendorData []byte `json:"vendor_data"` VendorData2 []byte `json:"vendor_data_2"` PublicKeys map[string]ssh.PublicKey `json:"public_keys"` Username *string `json:"username,omitempty"` Password *string `json:"password,omitempty"` Interfaces []MetadataInterface `json:"interfaces"` Routes []MetadataRoute `json:"routes"` }
func GetMetadata ¶
GetMetadata Try to find a valid metadata response by the registered sources.
func (Metadata) GetRoutes ¶
GetRoutes returns a map of all routes that are available for the given metadata.
func (Metadata) OpenStackMetaData ¶
func (Metadata) OpenStackNetworkData ¶
type MetadataInterface ¶
type MetadataInterface struct { MacAddress string `json:"mac_address"` Name string `json:"name"` Type InterfaceType `json:"type"` Subnets []MetadataSubnet `json:"subnets"` AcceptRA *bool `json:"accept-ra,omitempty"` //nolint:tagliatelle // cloud-init metadata requirement }
type MetadataRoute ¶
type MetadataSubnet ¶
type MetadataSubnet struct { IPv4 bool `json:"ipv4"` IPv6 bool `json:"ipv6"` Type MetadataSubnetType `json:"type"` Address *net.IP `json:"address,omitempty"` Network *net.IPNet `json:"network,omitempty"` Gateway *net.IP `json:"gateway,omitempty"` DNSServers []string `json:"dns_nameservers,omitempty"` }
type MetadataSubnetType ¶
type MetadataSubnetType string
const ( MetadataSubnetTypeDHCP MetadataSubnetType = "dhcp" MetadataSubnetTypeStatic MetadataSubnetType = "static" )
type ReportMessage ¶
type ReportMessageLevelType ¶
type ReportMessageLevelType string
const ( ReportMessageLevelTypeInfo ReportMessageLevelType = "INFO" ReportMessageLevelTypeWarning ReportMessageLevelType = "WARNING" ReportMessageLevelTypeError ReportMessageLevelType = "ERROR" )
type Source ¶
type Source interface { Type() string Initialize(cfg SourceConfig) error GetMetadata(ip net.IP) (*Metadata, error) ReportLog(log ReportMessage) error }
Source defines the interface for a metadata source, each source needs to implement this.
type SourceConfig ¶
type SourceConfig map[string]interface{}
func (SourceConfig) GetString ¶
func (s SourceConfig) GetString(key string) string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.