agentcontext

package
v0.0.0-...-2c15bd8 Latest Latest
Warning

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

Go to latest
Published: May 9, 2016 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Overview

The agentcontext package provides functionality to obtain information about the system a given agent or loader is running on. This includes information unrelated to MIG itself, such as the hostname of the system, IP addresses, and so on.

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

Contributor: - Aaron Meihm ameihm@mozilla.com [:alm]

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

Contributor: - Julien Vehent jvehent@mozilla.com [:ulfr]

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

Contributor: - Julien Vehent jvehent@mozilla.com [:ulfr]

Index

Constants

View Source
const AWSMETAIP string = "169.254.169.254"
View Source
const AWSMETAPORT int = 80
View Source
const FETCHBODYMAX int64 = 10240

The maximum number of bytes we will fetch in a response from the metadata service

Variables

This section is empty.

Functions

func GetRunDir

func GetRunDir() string

Types

type AWSContext

type AWSContext struct {
	InstanceID   string // AWS instance ID
	LocalIPV4    string // AWS Local IPV4 address
	AMIID        string // AWS AMI ID
	InstanceType string // AWS instance type
}

Information used for agents running in AWS environments

type AgentContext

type AgentContext struct {
	Hostname     string   // Hostname
	BinPath      string   // Path to invoked binary
	RunDir       string   // Agent runtime directory
	OS           string   // Operating System
	OSIdent      string   // OS release identifier
	Init         string   // OS Init
	Architecture string   // System architecture
	Addresses    []string // IP addresses
	PublicIP     string   // Systems public IP from perspective of API

	AWS AWSContext // AWS specific information
}

Information from the system the agent is running on

func NewAgentContext

func NewAgentContext(lch chan mig.Log, hints AgentContextHints) (ret AgentContext, err error)

func (*AgentContext) Differs

func (ctx *AgentContext) Differs(comp AgentContext) bool

Check of any values in the AgentContext differ from those in comp

func (*AgentContext) IsZero

func (ctx *AgentContext) IsZero() bool

func (*AgentContext) ToAgent

func (ctx *AgentContext) ToAgent() (ret mig.Agent)

type AgentContextHints

type AgentContextHints struct {
	APIUrl           string   // MIG API URL
	Proxies          []string // Proxies avialable for use in discovery
	DiscoverPublicIP bool     // Attempt to discover public IP
	DiscoverAWSMeta  bool     // Attempt to discover AWS metadata
}

Passed to NewAgentContext() to inform environment discovery

Jump to

Keyboard shortcuts

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