conch

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2018 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package conch provides access to the Conch API

Index

Constants

View Source
const (
	ValidationReportStatusFail = 0
	ValidationReportStatusOK   = 1
)

ValidationReport vars provide an abstraction to make sense of the 'status' field in ValidationReports

View Source
const (
	// MinimumAPIVersion sets the earliest API version that we support.
	MinimumAPIVersion = "2.6.0"
)

Variables

View Source
var (
	// ErrLoginFailed indicates that the login process failed for unspecified
	// reasons
	ErrLoginFailed = errors.New("Login Failed")

	// ErrNoSessionData indicates that an auth related error occurred where
	// either the user did not provide session data or no data was returned
	// from the API
	ErrNoSessionData = errors.New("No Session Data Provided")

	// ErrHTTPNotOk indicates that the API returned a non-200 status code that
	// we don't know how to handle
	ErrHTTPNotOk = errors.New("Non-200 HTTP status code returned")

	// ErrDataNotFound inidicates that the API returned a status code
	// inidicating that the requested data does not exist or is not available.
	// NOTE: The API will also return this error if the user is not allowed to
	// access the data in question.
	ErrDataNotFound = errors.New("API could not find the data requested")

	// ErrBadInput indicates that the user passed incomplete or bad data to a
	// routine. This typicallly only occurs when a struct parameter isn't
	// filled out with enough data.
	ErrBadInput = errors.New("Incomplete data passed to the routine")

	// ErrSemVerParse indicates that a semantic version string could not be
	// parsed
	ErrSemVerParse = errors.New("Could not parse semantic version string")

	// ErrNotSupported indicates that the API server does not support this
	// command. This is typically determined via checks on conch.apiVersion
	ErrNotSupported = errors.New("This function is not supported")

	// ErrNotAuthorized indicates that the API server returned a 403
	ErrNotAuthorized = errors.New("Not authorized for this endpoint")
)

Functions

This section is empty.

Types

type APIError

type APIError struct {
	ErrorMsg string `json:"error"`
}

APIError matches the structure of request errors reported by the Conch API

func (*APIError) Error

func (ai *APIError) Error() error

Return a new error with Conch Error message as the text

type Conch

type Conch struct {
	Session string // DEPRECATED
	BaseURL string
	UA      string
	JWToken string
	Expires int // This will be overwritten by JWT claims

	HTTPClient *http.Client
	CookieJar  *cookiejar.Jar
	// contains filtered or unexported fields
}

Conch contains auth and configuration data

func (*Conch) AddRackToWorkspace

func (c *Conch) AddRackToWorkspace(workspaceUUID fmt.Stringer, rackUUID fmt.Stringer) error

AddRackToWorkspace adds an existing rack to an existing workspace, via /workspace/:uuid/rack

func (*Conch) AddServiceToDeviceRole

func (c *Conch) AddServiceToDeviceRole(d DeviceRole, ds DeviceService) error

AddServiceToDeviceRole removes the given service from the given device role

func (*Conch) AddValidationToPlan

func (c *Conch) AddValidationToPlan(validationPlanUUID fmt.Stringer, validationUUID fmt.Stringer) error

AddValidationToPlan associates a validation with a validation plan

func (*Conch) CreateSubWorkspace

func (c *Conch) CreateSubWorkspace(parent Workspace, sub Workspace) (Workspace, error)

CreateSubWorkspace creates a sub workspace under the parent, via /workspace/:uuid/child If the provided parent lacks an ID, ErrBadInput is returned Currently, if an attempt to create a workspace with a conflicting name happens, the API returns a 500 rather than something useful. The routine will return ErrHTTPNotOk in that case.

func (*Conch) CreateValidationPlan

func (c *Conch) CreateValidationPlan(newValidationPlan ValidationPlan) (ValidationPlan, error)

CreateValidationPlan creates a new validation plan in Conch

func (*Conch) DeleteDeviceRole

func (c *Conch) DeleteDeviceRole(id fmt.Stringer) error

DeleteDeviceRole deletes the device role for the given uuid

func (*Conch) DeleteDeviceService

func (c *Conch) DeleteDeviceService(id fmt.Stringer) error

DeleteDeviceService deletes a device service, given a UUID

func (*Conch) DeleteGlobalDatacenter

func (c *Conch) DeleteGlobalDatacenter(id fmt.Stringer) error

DeleteGlobalDatacenter deletes a datacenter

func (*Conch) DeleteGlobalRack

func (c *Conch) DeleteGlobalRack(id fmt.Stringer) error

DeleteGlobalRack deletes a rack

func (*Conch) DeleteGlobalRackLayoutSlot

func (c *Conch) DeleteGlobalRackLayoutSlot(id fmt.Stringer) error

DeleteGlobalRackLayoutSlot deletes a rack layout

func (*Conch) DeleteGlobalRackRole

func (c *Conch) DeleteGlobalRackRole(id fmt.Stringer) error

DeleteGlobalRackRole deletes a rack role

func (*Conch) DeleteGlobalRoom

func (c *Conch) DeleteGlobalRoom(id fmt.Stringer) error

DeleteGlobalRoom deletes a room

func (*Conch) DeleteRackFromWorkspace

func (c *Conch) DeleteRackFromWorkspace(workspaceUUID fmt.Stringer, rackUUID fmt.Stringer) error

DeleteRackFromWorkspace removes an existing rack from an existing workplace, via /workspace/:uuid/rack/:uuid

func (*Conch) DeleteUserSetting

func (c *Conch) DeleteUserSetting(name string) error

DeleteUserSetting deletes a user setting via /user/me/settings/:name

func (*Conch) DeviceTritonReboot

func (c *Conch) DeviceTritonReboot(serial string) error

DeviceTritonReboot sets the 'triton_reboot' field for the given device, via /device/:serial/triton_reboot WARNING: This is a one way operation and cannot currently be undone via the API

func (*Conch) DeviceValidationStates

func (c *Conch) DeviceValidationStates(deviceSerial string) ([]ValidationState, error)

DeviceValidationStates returns the stored validation states for a device

func (*Conch) FillInDevice

func (c *Conch) FillInDevice(d Device) (Device, error)

FillInDevice takes an existing device and fills in its data using "/device"

This exists because the API hands back partial devices in most cases. It's likely, though, that any client utility will eventually want all the data about a device and not just bits

func (*Conch) GetAllRelays

func (c *Conch) GetAllRelays() ([]Relay, error)

GetAllRelays uses the /relay endpoint to get a list of all relays devices known in the system. This endpoint is only supported in API versions >=2.1.0 and will return ErrNotSupported if the API version is not compliant. This endpoint is also limited to Administrators on the GLOBAL workspace. If permissions are not met, ErrNotAuthorized will be returned

func (*Conch) GetAllRelaysWithoutDevices

func (c *Conch) GetAllRelaysWithoutDevices() ([]Relay, error)

GetAllRelaysWithoutDevices uses the /relay endpoint to get a list of all relays, but without their assigned devices.

func (*Conch) GetDevice

func (c *Conch) GetDevice(serial string) (Device, error)

GetDevice returns a Device given a specific serial/id

func (*Conch) GetDeviceLocation

func (c *Conch) GetDeviceLocation(serial string) (DeviceLocation, error)

GetDeviceLocation fetches the location for a device, via /device/:serial/location

func (*Conch) GetDeviceRole

func (c *Conch) GetDeviceRole(id fmt.Stringer) (DeviceRole, error)

GetDeviceRole gets a single device role, given its uuid

func (*Conch) GetDeviceRoles

func (c *Conch) GetDeviceRoles() ([]DeviceRole, error)

GetDeviceRoles returns a list of all active device roles

func (*Conch) GetDeviceService

func (c *Conch) GetDeviceService(id fmt.Stringer) (DeviceService, error)

GetDeviceService gets a single device service

func (*Conch) GetDeviceServiceByName

func (c *Conch) GetDeviceServiceByName(name string) (DeviceService, error)

GetDeviceServiceByName gets a single device service by its name

func (*Conch) GetDeviceServices

func (c *Conch) GetDeviceServices() ([]DeviceService, error)

GetDeviceServices gets a list of all active device services

func (*Conch) GetDeviceSetting

func (c *Conch) GetDeviceSetting(serial string, key string) (string, error)

GetDeviceSetting fetches a single setting for a device, via /device/:serial/settings/:key

func (*Conch) GetDeviceSettings

func (c *Conch) GetDeviceSettings(serial string) (map[string]string, error)

GetDeviceSettings fetches settings for a device, via /device/:serial/settings

func (*Conch) GetGlobalDatacenter

func (c *Conch) GetGlobalDatacenter(id fmt.Stringer) (GlobalDatacenter, error)

GetGlobalDatacenter fetches a single datacenter in the global domain, by its UUID

func (*Conch) GetGlobalDatacenterRooms

func (c *Conch) GetGlobalDatacenterRooms(d GlobalDatacenter) ([]GlobalRoom, error)

GetGlobalDatacenterRooms gets the global rooms assigned to a global datacenter

func (*Conch) GetGlobalDatacenters

func (c *Conch) GetGlobalDatacenters() ([]GlobalDatacenter, error)

GetGlobalDatacenters fetches a list of all datacenters in the global domain

func (*Conch) GetGlobalRack

func (c *Conch) GetGlobalRack(id fmt.Stringer) (GlobalRack, error)

GetGlobalRack fetches a single rack in the global domain, by its UUID

func (*Conch) GetGlobalRackLayout

func (c *Conch) GetGlobalRackLayout(r GlobalRack) ([]GlobalRackLayoutSlot, error)

GetGlobalRackLayout fetches the layout entries for a rack in the global domain

func (*Conch) GetGlobalRackLayoutSlot

func (c *Conch) GetGlobalRackLayoutSlot(id fmt.Stringer) (*GlobalRackLayoutSlot, error)

GetGlobalRackLayoutSlot fetches a single rack layout in the global domain, by its UUID

func (*Conch) GetGlobalRackLayoutSlots

func (c *Conch) GetGlobalRackLayoutSlots() ([]GlobalRackLayoutSlot, error)

GetGlobalRackLayoutSlots fetches a list of all rack layouts in the global domain

func (*Conch) GetGlobalRackRole

func (c *Conch) GetGlobalRackRole(id fmt.Stringer) (*GlobalRackRole, error)

GetGlobalRackRole fetches a single rack role in the global domain, by its UUID

func (*Conch) GetGlobalRackRoles

func (c *Conch) GetGlobalRackRoles() ([]GlobalRackRole, error)

GetGlobalRackRoles fetches a list of all rack roles in the global domain

func (*Conch) GetGlobalRacks

func (c *Conch) GetGlobalRacks() ([]GlobalRack, error)

GetGlobalRacks fetches a list of all racks in the global domain

func (*Conch) GetGlobalRoom

func (c *Conch) GetGlobalRoom(id fmt.Stringer) (GlobalRoom, error)

GetGlobalRoom fetches a single room in the global domain, by its UUID

func (*Conch) GetGlobalRoomRacks

func (c *Conch) GetGlobalRoomRacks(r GlobalRoom) ([]GlobalRack, error)

GetGlobalRoomRacks retrieves the racks assigned to a room in the global domain

func (*Conch) GetGlobalRooms

func (c *Conch) GetGlobalRooms() ([]GlobalRoom, error)

GetGlobalRooms fetches a list of all rooms in the global domain

func (*Conch) GetHardwareProduct

func (c *Conch) GetHardwareProduct(hardwareProductUUID fmt.Stringer) (HardwareProduct, error)

GetHardwareProduct fetches a single hardware product via /hardware/product/:uuid

func (*Conch) GetHardwareProducts

func (c *Conch) GetHardwareProducts() ([]HardwareProduct, error)

GetHardwareProducts fetches a single hardware product via /hardware_product

func (*Conch) GetSubWorkspaces

func (c *Conch) GetSubWorkspaces(workspaceUUID fmt.Stringer) ([]Workspace, error)

GetSubWorkspaces returns the contents of /workspace/:uuid/child, getting a list of subworkspaces for the given workspace id

func (*Conch) GetUserSetting

func (c *Conch) GetUserSetting(key string) (interface{}, error)

GetUserSetting returns the results of /user/me/settings/:key The return is an interface{} because the database structure is a string name and a jsonb data field. There is no way for this library to know in advanace what's in that data so here there be dragons.

func (*Conch) GetUserSettings

func (c *Conch) GetUserSettings() (map[string]interface{}, error)

GetUserSettings returns the results of /user/me/settings The return is a map[string]interface{} because the database structure is a string name and a jsonb data field. There is no way for this library to know in advanace what's in that data so here there be dragons.

func (*Conch) GetValidationPlan

func (c *Conch) GetValidationPlan(validationPlanUUID fmt.Stringer) (*ValidationPlan, error)

GetValidationPlan returns the contents of /validation_plan/:uuid, getting information about a single validation plan

func (*Conch) GetValidationPlanValidations

func (c *Conch) GetValidationPlanValidations(validationPlanUUID fmt.Stringer) ([]Validation, error)

GetValidationPlanValidations gets the list of validations associated with a validation plan

func (*Conch) GetValidationPlans

func (c *Conch) GetValidationPlans() ([]ValidationPlan, error)

GetValidationPlans returns the contents of /validation_plan, getting the list of all validations plans loaded in the system

func (*Conch) GetValidations

func (c *Conch) GetValidations() ([]Validation, error)

GetValidations returns the contents of /validation, getting the list of all validations loaded in the system

func (*Conch) GetWorkspace

func (c *Conch) GetWorkspace(workspaceUUID fmt.Stringer) (*Workspace, error)

GetWorkspace returns the contents of /workspace/:uuid, getting information about a single workspace

func (*Conch) GetWorkspaceDevices

func (c *Conch) GetWorkspaceDevices(workspaceUUID fmt.Stringer, idsOnly bool, graduated string, health string) ([]Device, error)

GetWorkspaceDevices retrieves a list of Devices for the given workspace. Pass true for 'IDsOnly' to get Devices with only the ID field populated Pass a string for 'graduated' to filter devices by graduated value, as per https://conch.joyent.us/doc#getdevices Pass a string for 'health' to filter devices by health value, as per https://conch.joyent.us/doc#getdevices

func (*Conch) GetWorkspaceRack

func (c *Conch) GetWorkspaceRack(workspaceUUID fmt.Stringer, rackUUID fmt.Stringer) (Rack, error)

GetWorkspaceRack fetches a single rack for a workspace, via /workspace/:uuid/rack/:id

func (*Conch) GetWorkspaceRacks

func (c *Conch) GetWorkspaceRacks(workspaceUUID fmt.Stringer) ([]Rack, error)

GetWorkspaceRacks fetchest the list of racks for a workspace, via /workspace/:uuid/rack

NOTE: The API currently returns the AZ name. This routine throws that out and only returns the list of racks.

func (*Conch) GetWorkspaceRelays

func (c *Conch) GetWorkspaceRelays(workspaceUUID fmt.Stringer, activeOnly bool) ([]Relay, error)

GetWorkspaceRelays returns all Relays associated with the given workspace

func (*Conch) GetWorkspaceRooms

func (c *Conch) GetWorkspaceRooms(workspaceUUID fmt.Stringer) ([]Room, error)

GetWorkspaceRooms returns the contents of /workspace/:uuid/room, getting a list of rooms for the given workspace id

func (*Conch) GetWorkspaceUsers

func (c *Conch) GetWorkspaceUsers(workspaceUUID fmt.Stringer) ([]User, error)

GetWorkspaceUsers returns the contents of /workspace/:uuid/users, getting a list of users for the given workspace id

func (*Conch) GetWorkspaces

func (c *Conch) GetWorkspaces() ([]Workspace, error)

GetWorkspaces returns the contents of /workspace, getting the list of all workspaces that the user has access to

func (*Conch) GraduateDevice

func (c *Conch) GraduateDevice(serial string) error

GraduateDevice sets the 'graduated' field for the given device, via /device/:serial/graduate WARNING: This is a one way operation and cannot currently be undone via the API

func (*Conch) InviteUser

func (c *Conch) InviteUser(workspaceUUID fmt.Stringer, user string, role string) error

InviteUser invites a user to a workspace via /workspace/:uuid/user

func (*Conch) Login

func (c *Conch) Login(user string, password string) error

Login uses the User, as listed in the Conch struct, and the provided password to log into the Conch API and populate the Session entry in the Conch struct

func (*Conch) MarkDeviceTritonSetup

func (c *Conch) MarkDeviceTritonSetup(serial string) error

MarkDeviceTritonSetup marks the device as setup for Triton For this action to succeed, the device must have its Triton UUID set and marked as rebooted into Triton. If these conditions are not met, this function will return ErrBadInput

func (*Conch) RawDelete

func (c *Conch) RawDelete(url string) (*http.Response, error)

RawDelete allows the user to perform an HTTP DELETE against the API, with the library handling all auth but *not* processing the response.

func (*Conch) RawGet

func (c *Conch) RawGet(url string) (*http.Response, error)

RawGet allows the user to perform an HTTP GET against the API, with the library handling all auth but *not* processing the response.

func (*Conch) RawPost

func (c *Conch) RawPost(url string, body io.Reader) (*http.Response, error)

RawPost allows the user to perform an HTTP POST against the API, with the library handling all auth but *not* processing the response. The provided body *must* be JSON for the server to accept it.

func (*Conch) RegisterRelay

func (c *Conch) RegisterRelay(r Relay) error

RegisterRelay registers/updates a Relay via /relay/:serial/register If the provided relay does not have an IP, SSHPort, and Version, ErrBadInput will be returned

func (*Conch) RemoveServiceFromDeviceRole

func (c *Conch) RemoveServiceFromDeviceRole(d DeviceRole, ds DeviceService) error

RemoveServiceFromDeviceRole removes the given service from the given role

func (*Conch) RemoveValidationFromPlan

func (c *Conch) RemoveValidationFromPlan(validationPlanUUID fmt.Stringer, validationUUID fmt.Stringer) error

RemoveValidationFromPlan removes a validation from a validation plan

func (*Conch) RevokeOwnTokens

func (c *Conch) RevokeOwnTokens() error

RevokeOwnTokens revokes all auth tokens for the current user. Login() is required after to generate new tokens. Clears the Session, JWToken, and Expires attributes

func (*Conch) RevokeUserTokens

func (c *Conch) RevokeUserTokens(user string) error

RevokeUserTokens revokes all auth tokens for a the given user. This action is typically limited server-side to admins.

func (*Conch) RunDeviceValidation

func (c *Conch) RunDeviceValidation(deviceSerial string, validationUUID fmt.Stringer, body io.Reader) ([]ValidationResult, error)

RunDeviceValidation runs a validation against given a device and returns the results

func (*Conch) RunDeviceValidationPlan

func (c *Conch) RunDeviceValidationPlan(deviceSerial string, validationPlanUUID fmt.Stringer, body io.Reader) ([]ValidationResult, error)

RunDeviceValidationPlan runs a validation plan against a given device and returns the results

func (*Conch) SaveDeviceRole

func (c *Conch) SaveDeviceRole(r *DeviceRole) error

SaveDeviceRole creates or updates a device role. A new role is created if the structure lacks an ID. Otherwise, an update is attempted.

func (*Conch) SaveDeviceService

func (c *Conch) SaveDeviceService(s *DeviceService) error

SaveDeviceService creates or updates a device service. A new service is created if the structure lacks an ID. Otherwise, an update is attempted.

func (*Conch) SaveGlobalDatacenter

func (c *Conch) SaveGlobalDatacenter(d *GlobalDatacenter) error

SaveGlobalDatacenter creates or updates a datacenter in the global domain, based on the presence of an ID

func (*Conch) SaveGlobalRack

func (c *Conch) SaveGlobalRack(r *GlobalRack) error

SaveGlobalRack creates or updates a rack in the global domain, based on the presence of an ID

func (*Conch) SaveGlobalRackLayoutSlot

func (c *Conch) SaveGlobalRackLayoutSlot(r *GlobalRackLayoutSlot) error

SaveGlobalRackLayoutSlot creates or updates a rack layout in the global domain, based on the presence of an ID

func (*Conch) SaveGlobalRackRole

func (c *Conch) SaveGlobalRackRole(r *GlobalRackRole) error

SaveGlobalRackRole creates or updates a rack role in the global domain, based on the presence of an ID

func (*Conch) SaveGlobalRoom

func (c *Conch) SaveGlobalRoom(r *GlobalRoom) error

SaveGlobalRoom creates or updates a room in the global domain, based on the presence of an ID

func (*Conch) SetDeviceAssetTag

func (c *Conch) SetDeviceAssetTag(serial string, tag string) error

SetDeviceAssetTag sets the asset tag for the provided serial

func (*Conch) SetDeviceTritonUUID

func (c *Conch) SetDeviceTritonUUID(serial string, id uuid.UUID) error

SetDeviceTritonUUID sets the triton UUID via /device/:serial/triton_uuid

func (*Conch) SetUserSetting

func (c *Conch) SetUserSetting(name string, value interface{}) error

SetUserSetting sets the value of a user setting via /user/me/settings/:name

func (*Conch) SetUserSettings

func (c *Conch) SetUserSettings(settings map[string]interface{}) error

SetUserSettings sets the value of *all* user settings via /user/me/settings

func (*Conch) VerifyLogin

func (c *Conch) VerifyLogin(refreshTime int, forceJWT bool) error

VerifyLogin determines if the user's session data is still valid. If available, it uses the refresh API, falling back to plain cookie auth.

One can pass in an integer value, representing when to force a token refresh, based on the number of seconds left until expiry. Pass in 0 to prevent refreshing

If the second paramter is true, a JWT refresh is forced, regardless of any other parameters.

NOTE: If the Conch struct contains cookie session data, it will be automatically upgraded to JWT and the Session data will no longer function

func (*Conch) WorkspaceValidationStates

func (c *Conch) WorkspaceValidationStates(workspaceUUID fmt.Stringer) ([]ValidationState, error)

WorkspaceValidationStates returns the stored validation states for all devices in a workspace

type Datacenter

type Datacenter struct {
	ID   uuid.UUID `json:"id"`
	Name string    `json:"name"`
}

Datacenter represents a conch datacenter, aka an AZ

type Device

type Device struct {
	AssetTag        string             `json:"asset_tag"`
	BootPhase       string             `json:"boot_phase"`
	Created         pgtime.PgTime      `json:"created"`
	Deactivated     pgtime.PgTime      `json:"deactivated"`
	Graduated       pgtime.PgTime      `json:"graduated"`
	HardwareProduct uuid.UUID          `json:"hardware_product"`
	Health          string             `json:"health"`
	ID              string             `json:"id"`
	LastSeen        pgtime.PgTime      `json:"last_seen"`
	Location        DeviceLocation     `json:"location"`
	Nics            []Nic              `json:"nics"`
	Role            uuid.UUID          `json:"role"`
	State           string             `json:"state"`
	SystemUUID      uuid.UUID          `json:"system_uuid"`
	TritonUUID      uuid.UUID          `json:"triton_uuid"`
	TritonSetup     pgtime.PgTime      `json:"triton_setup"`
	Updated         pgtime.PgTime      `json:"updated"`
	UptimeSince     pgtime.PgTime      `json:"uptime_since"`
	Validated       pgtime.PgTime      `json:"validated"`
	Validations     []ValidationReport `json:"validations"`
	LatestReport    ServerReport       `json:"latest_report"`
}

Device represents what the API docs call a "DetailedDevice"

Instead of having multiple structs representing partial datasets, like the API chooses to do, this library will always hand back Devices. In the case that the API does not provide all the data, those fields will be null or zero values.

type DeviceLocation

type DeviceLocation struct {
	Datacenter            Datacenter            `json:"datacenter"`
	Rack                  Rack                  `json:"rack"`
	TargetHardwareProduct HardwareProductTarget `json:"target_hardware_product"`
}

DeviceLocation represents the location of a device, including its datacenter and rack

type DeviceRole

type DeviceRole struct {
	ID                uuid.UUID   `json:"id"`
	Created           time.Time   `json:"created"`
	Updated           time.Time   `json:"updated"`
	Description       string      `json:"description"`
	HardwareProductID uuid.UUID   `json:"hardware_product_id"`
	Services          []uuid.UUID `json:"services"`
}

DeviceRole represents a device role, a combination of a hardware product and a list of services

type DeviceService

type DeviceService struct {
	ID      uuid.UUID `json:"id"`
	Created time.Time `json:"created"`
	Updated time.Time `json:"updated"`
	Name    string    `json:"name"`
}

DeviceService represents a single device service, usually a piece of software like Manta

type GlobalDatacenter

type GlobalDatacenter struct {
	ID         uuid.UUID `json:"id"`
	Vendor     string    `json:"vendor"`
	VendorName string    `json:"vendor_name"`
	Region     string    `json:"region"`
	Location   string    `json:"location"`
	Created    time.Time `json:"created"`
	Updated    time.Time `json:"updated"`
}

GlobalDatacenter represents a datacenter in the global domain

type GlobalRack

type GlobalRack struct {
	ID               uuid.UUID `json:"id"`
	Created          time.Time `json:"created"`
	Updated          time.Time `json:"updated"`
	DatacenterRoomID uuid.UUID `json:"datacenter_room_id"`
	Name             string    `json:"name"`
	RoleID           uuid.UUID `json:"role"`
}

GlobalRack represents a datacenter rack in the global domain

type GlobalRackLayoutSlot

type GlobalRackLayoutSlot struct {
	ID        uuid.UUID `json:"id"`
	Created   time.Time `json:"created"`
	Updated   time.Time `json:"updated"`
	RackID    uuid.UUID `json:"rack_id"`
	ProductID uuid.UUID `json:"product_id"`
	RUStart   int       `json:"ru_start"`
}

GlobalRackLayoutSlot represents an individual rack layout entry

type GlobalRackRole

type GlobalRackRole struct {
	ID       uuid.UUID `json:"id"`
	Created  time.Time `json:"created"`
	Updated  time.Time `json:"updated"`
	Name     string    `json:"name"`
	RackSize int       `json:"rack_size"`
}

GlobalRackRole represents a rack role in the global domain

type GlobalRoom

type GlobalRoom struct {
	ID           uuid.UUID `json:"id"`
	Created      time.Time `json:"created"`
	Updated      time.Time `json:"updated"`
	DatacenterID uuid.UUID `json:"datacenter"`
	AZ           string    `json:"az"`
	Alias        string    `json:"alias"`
	VendorName   string    `json:"vendor_name"`
}

GlobalRoom represents a datacenter room in the global domain

type HardwareProduct

type HardwareProduct struct {
	ID      uuid.UUID       `json:"id"`
	Name    string          `json:"name"`
	Alias   string          `json:"alias"`
	Prefix  string          `json:"prefix"`
	Profile HardwareProfile `json:"profile"`
	Vendor  string          `json:"vendor"`
}

HardwareProduct is a type of Device. For instance, "Hallasan C"

type HardwareProductTarget

type HardwareProductTarget struct {
	ID    uuid.UUID `json:"id"`
	Name  string    `json:"name"`
	Alias string    `json:"alias"`
}

HardwareProductTarget represents the HardwareProduct that a device should have based on its location

type HardwareProfile

type HardwareProfile struct {
	ID           uuid.UUID            `json:"id"`
	NumNics      int                  `json:"nics_num"`
	BiosFirmware string               `json:"bios_firmware"`
	NumCPU       int                  `json:"cpu_num"`
	CPUType      string               `json:"cpu_type"`
	NumDimms     int                  `json:"dimms_num"`
	TotalPSU     int                  `json:"psu_total"`
	Purpose      string               `json:"purpose"`
	TotalRAM     int                  `json:"ram_total"`
	SASNum       int                  `json:"sas_num"`
	SizeSAS      int                  `json:"sas_size"`
	SlotsSAS     string               `json:"saas_slots"`
	NumSATA      int                  `json:"sata_num"`
	SizeSATA     int                  `json:"sata_size"`
	SlotsSATA    string               `json:"sata_slots"`
	NumSSD       int                  `json:"ssd_num"`
	SizeSSD      int                  `json:"ssd_size"`
	SlotsSSD     string               `json:"ssd_slots"`
	NumUSB       int                  `json:"usb_num"`
	Zpool        HardwareProfileZpool `json:"zpool"`
}

HardwareProfile is a detailed accounting of either the actual hardware or intended hardware configuration of a Device, depending on the API endpoint in question

type HardwareProfileZpool

type HardwareProfileZpool struct {
	ID       uuid.UUID `json:"id"`
	Cache    int       `json:"cache"`
	Log      int       `json:"log"`
	DisksPer int       `json:"disks_per"`
	Spare    int       `json:"spare"`
	VdevN    int       `json:"vdev_n"`
	VdevT    string    `json:"vdev_t"`
}

HardwareProfileZpool represents the layout of the target device's ZFS zpools

type Nic

type Nic struct {
	MAC         string `json:"mac"`
	IfaceName   string `json:"iface_name"`
	IfaceVendor string `json:"iface_vendor"`
	IfaceType   string `json:"iface_type"`
	PeerMac     string `json:"peer_mac"`
	PeerPort    string `json:"peer_port"`
	PeerSwitch  string `json:"peer_switch"`
}

Nic is a network interface card, including its peer switch info

type Rack

type Rack struct {
	ID         uuid.UUID `json:"id"`
	Name       string    `json:"name"`
	Role       string    `json:"role"`
	Unit       int       `json:"unit"`
	Size       int       `json:"size"`
	Datacenter string    `json:"datacenter"`
	// The key of the Slots map is the RU slot number
	Slots map[int]RackSlot `json:"slots"`
}

Rack represents a physical rack

type RackSlot

type RackSlot struct {
	ID       uuid.UUID `json:"id"`
	Size     int       `json:"size"`
	Name     string    `json:"name"`
	Alias    string    `json:"alias"`
	Vendor   string    `json:"vendor"`
	Occupant Device    `json:"occupant"`
}

RackSlot represents a physical slot in a physical Rack

type Relay

type Relay struct {
	Alias   string    `json:"alias"`
	Created time.Time `json:"created"`
	Devices []Device  `json:"devices"`
	ID      string    `json:"id"`
	IPAddr  string    `json:"ipaddr"`
	SSHPort int       `json:"ssh_port"`
	Updated time.Time `json:"updated"`
	Version string    `json:"version"`
}

Relay represents a Conch Relay unit, a physical piece of hardware that mediates Livesys interactions in the field

type Room

type Room struct {
	ID         string `json:"id"`
	AZ         string `json:"az"`
	Alias      string `json:"alias"`
	VendorName string `json:"vendor_name"`
}

Room represents a physical area in a datacenter/AZ

type ServerReport

type ServerReport struct {
	BiosVersion  string                            `json:"bios_version"`
	Disks        map[string]map[string]interface{} `json:"disks"`
	Interfaces   map[string]map[string]interface{} `json:"interfaces"`
	Memory       map[string]interface{}            `json:"memory"`
	Processor    map[string]interface{}            `json:"processor"`
	ProductName  string                            `json:"product_name"`
	Relay        map[string]interface{}            `json:"relay"` // "Only key in hash is currently 'serial"
	SerialNumber string                            `json:"serial_number"`
	State        string                            `json:"state"`
	SystemUUID   uuid.UUID                         `json:"system_uuid"`
	Temp         map[string]interface{}            `json:"temp"`
	UptimeSince  string                            `json:"uptime_since"`
	Aux          interface{}                       `json:"aux"`
}

ServerReport represents data obtained in the field about the current state of a Device

type User

type User struct {
	Email string `json:"email"`
	Name  string `json:"name"`
	Role  string `json:"role"`
}

User represents a person able to access the Conch API or UI

type Validation

type Validation struct {
	ID          uuid.UUID `json:"id"`
	Name        string    `json:"name"`
	Version     int       `json:"version"`
	Description string    `json:"description"`
	Created     time.Time `json:"created"`
	Updated     time.Time `json:"updated"`
}

Validation represents device validations loaded into Conch

type ValidationPlan

type ValidationPlan struct {
	ID          uuid.UUID `json:"id"`
	Name        string    `json:"name"`
	Description string    `json:"description"`
	Created     time.Time `json:"created"`
}

ValidationPlan represents an organized association of Validations

type ValidationReport

type ValidationReport struct {
	ComponentID   uuid.UUID   `json:"component_id"`
	ComponentName string      `json:"component_name"`
	ComponentType string      `json:"component_type"`
	CriteriaID    uuid.UUID   `json:"criteria_id"`
	Log           string      `json:"log"`
	Metric        interface{} `json:"metric"`
	Status        int         `json:"status"` // Can use the ValidationReportStatus consts to understand status
}

ValidationReport represents the result from the validation engine, comparing field data to expectations.

type ValidationResult

type ValidationResult struct {
	ID              uuid.UUID `json:"id"`
	Category        string    `json:"category"`
	ComponentID     string    `json:"component_id"`
	DeviceID        string    `json:"device_id"`
	HardwareProduct uuid.UUID `json:"hardware_product_id"`
	Hint            string    `json:"hint"`
	Message         string    `json:"message"`
	Status          string    `json:"status"`
	ValidationID    uuid.UUID `json:"validation_id"`
}

ValidationResult is a result of running a validation on a device

type ValidationState

type ValidationState struct {
	ID               uuid.UUID          `json:"id"`
	Created          time.Time          `json:"created"`
	Completed        time.Time          `json:"completed"`
	DeviceID         string             `json:"device_id"`
	Results          []ValidationResult `json:"results"`
	Status           string             `json:"status"`
	ValidationPlanID uuid.UUID          `json:"validation_plan_id"`
}

ValidationState is the result of running a validation plan on a device

type Workspace

type Workspace struct {
	ID          uuid.UUID `json:"id"`
	Name        string    `json:"name"`
	Description string    `json:"description"`
	Role        string    `json:"role"`
	ParentID    uuid.UUID `json:"parent_id"`
}

Workspace represents a Conch data partition which allows users to create custom lists of hardware

Jump to

Keyboard shortcuts

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