Documentation ¶
Index ¶
- Variables
- func IsNotExist(err error) bool
- type BondingMode
- type Client
- func (c *Client) DiscoverHardwareFromDHCP(mac net.HardwareAddr, giaddr net.IP, circuitID string) (*Discovery, error)
- func (c *Client) DiscoverHardwareFromIP(ip net.IP) (*Discovery, error)
- func (c *Client) Do(req *http.Request, v interface{}) error
- func (c *Client) Get(ref string, v interface{}) error
- func (c *Client) GetInstanceIDFromIP(dip net.IP) (string, error)
- func (c *Client) Patch(ref, mime string, body io.Reader, v interface{}) error
- func (c *Client) Post(ref, mime string, body io.Reader, v interface{}) error
- func (c *Client) PostHardwareComponent(hardwareID string, body io.Reader) (*ComponentsResponse, error)
- func (c *Client) PostHardwareEvent(id string, body io.Reader) (string, error)
- func (c *Client) PostHardwareFail(id string, body io.Reader) error
- func (c *Client) PostHardwarePhoneHome(id string) error
- func (c *Client) PostHardwareProblem(id string, body io.Reader) (string, error)
- func (c *Client) PostInstanceEvent(id string, body io.Reader) (string, error)
- func (c *Client) PostInstanceFail(id string, body io.Reader) error
- func (c *Client) PostInstancePassword(id, pass string) error
- func (c *Client) PostInstancePhoneHome(id string) error
- func (c *Client) UpdateInstance(id string, body io.Reader) error
- type Component
- type ComponentsResponse
- type Device
- type Discovery
- func (d Discovery) DiscoveredIP(mac string) *IP
- func (d Discovery) HardwareIP(mac string) *IP
- func (d Discovery) InstanceIP(mac string) *IP
- func (d Discovery) ManagementIP(mac string) *IP
- func (d Discovery) ManagementMAC() MACAddr
- func (d Discovery) Mode(mac net.HardwareAddr) string
- func (d Discovery) NetConfig(mac net.HardwareAddr) IP
- func (d Discovery) PrimaryDataMAC() MACAddr
- type Event
- type Getter
- type Hardware
- type HardwareState
- type IP
- type Instance
- type InstanceState
- type MACAddr
- type Manufacturer
- type NetworkPorts
- type OperatingSystem
- type Port
- type PortType
- type ServicesVersion
- type UserEvent
Constants ¶
This section is empty.
Variables ¶
var ( ZeroMAC = MACAddr{} OnesMAC = MACAddr{0xff, 0xff, 0xff, 0xff, 0xff, 0xff} )
Functions ¶
func IsNotExist ¶
Types ¶
type BondingMode ¶
type BondingMode int
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewMockClient ¶
func (*Client) DiscoverHardwareFromDHCP ¶
func (*Client) DiscoverHardwareFromIP ¶
func (*Client) GetInstanceIDFromIP ¶
GetDeviceIDFromIP Looks up a device (instance) in cacher via ByIP
func (*Client) PostHardwareComponent ¶
func (c *Client) PostHardwareComponent(hardwareID string, body io.Reader) (*ComponentsResponse, error)
PostHardwareComponent - POSTs a HardwareComponent to the API
func (*Client) PostHardwareEvent ¶
func (*Client) PostHardwareFail ¶
func (*Client) PostHardwarePhoneHome ¶
func (*Client) PostHardwareProblem ¶
func (*Client) PostInstanceEvent ¶
func (*Client) PostInstanceFail ¶
func (*Client) PostInstancePassword ¶
func (*Client) PostInstancePhoneHome ¶
type ComponentsResponse ¶
type ComponentsResponse struct {
Components []Component `json:"components"`
}
type Device ¶
type Device struct {
ID string `json:"id"`
}
Device Full device result from /devices endpoint
type Discovery ¶
type Discovery struct {
*Hardware
}
func NewDiscovery ¶
New instantiates a Discovery struct from the json argument
func (Discovery) DiscoveredIP ¶
DiscoveredIP returns the IP configuration that should be offered to a newly discovered BMC, if the MAC is a BMC MAC
func (Discovery) HardwareIP ¶
HardwareIP returns the IP configuration that should be offered to the hardware if there is no instance
func (Discovery) InstanceIP ¶
InstanceIP returns the IP configuration that should be Offered to the instance if there is one; if it's prov/deprov'ing, it's the hardware IP
func (Discovery) ManagementIP ¶
ManagementIP returns the IP configuration that should be Offered to the BMC, if the MAC is a BMC MAC
func (Discovery) ManagementMAC ¶
ManagementMAC returns the mac address of the BMC interface
func (Discovery) Mode ¶
func (d Discovery) Mode(mac net.HardwareAddr) string
Mode returns whether the mac belongs to the instance, hardware, bmc, discovered, or unknown
func (Discovery) NetConfig ¶
func (d Discovery) NetConfig(mac net.HardwareAddr) IP
NetConfig returns the network configuration that corresponds to the interface whose MAC address is mac.
func (Discovery) PrimaryDataMAC ¶
PrimaryDataMAC returns the mac associated with eth0, or as a fallback the lowest numbered non-bmc MAC address
type Hardware ¶
type Hardware struct { ID string `json:"id"` Name string `json:"name"` State HardwareState `json:"state"` BondingMode BondingMode `json:"bonding_mode"` NetworkPorts []Port `json:"network_ports"` Manufacturer Manufacturer `json:"manufacturer"` PlanSlug string `json:"plan_slug"` PlanVersionSlug string `json:"plan_version_slug"` Arch string `json:"arch"` FacilityCode string `json:"facility_code"` IPMI IP `json:"management"` IPs []IP `json:"ip_addresses"` PreinstallOS OperatingSystem `json:"preinstalled_operating_system_version"` PrivateSubnets []string `json:"private_subnets,omitempty"` UEFI bool `json:"efi_boot"` AllowPXE bool `json:"allow_pxe"` ServicesVersion ServicesVersion `json:"services"` Instance *Instance `json:"instance"` }
func (*Hardware) Interfaces ¶
func (*Hardware) Management ¶
type HardwareState ¶
type HardwareState string
type Instance ¶
type Instance struct { ID string `json:"id"` State InstanceState `json:"state"` Hostname string `json:"hostname"` AllowPXE bool `json:"allow_pxe"` Rescue bool `json:"rescue"` OS OperatingSystem `json:"operating_system_version"` AlwaysPXE bool `json:"always_pxe,omitempty"` IPXEScriptURL string `json:"ipxe_script_url,omitempty"` IPs []IP `json:"ip_addresses"` UserData string `json:"userdata,omitempty"` // Only returned in the first 24 hours CryptedRootPassword string `json:"crypted_root_password,omitempty"` }
Instance models the instance data as returned by the API
type InstanceState ¶
type InstanceState string
type MACAddr ¶
type MACAddr [6]byte
MACAddr is an IEEE 802 MAC-48 hardware address.
func (MACAddr) HardwareAddr ¶
func (m MACAddr) HardwareAddr() net.HardwareAddr
func (*MACAddr) UnmarshalText ¶
type Manufacturer ¶
type NetworkPorts ¶
type OperatingSystem ¶
type Port ¶
type Port struct { ID string `json:"id"` Type PortType `json:"type"` Name string `json:"name"` Data struct { MAC *MACAddr `json:"mac"` Bond string `json:"bond"` } `json:"data"` }
func (*Port) MAC ¶
func (p *Port) MAC() net.HardwareAddr
type ServicesVersion ¶
type ServicesVersion struct {
Osie string `json:"osie"`
}