Documentation ¶
Overview ¶
Package conch provides access to the Conch API
Index ¶
- Constants
- Variables
- type Conch
- func (c *Conch) AddRackToWorkspace(workspaceUUID fmt.Stringer, rackUUID fmt.Stringer) error
- func (c *Conch) AddUserToWorkspace(workspaceUUID fmt.Stringer, user string, role string) error
- func (c *Conch) ChangePassword(password string) error
- func (c *Conch) CreateSubWorkspace(parent Workspace, sub Workspace) (Workspace, error)
- func (c *Conch) CreateUser(email string, password string, name string) error
- func (c *Conch) DeleteDeviceSetting(deviceID string, key string) error
- func (c *Conch) DeleteDeviceTag(deviceID string, key string) error
- func (c *Conch) DeleteGlobalDatacenter(id fmt.Stringer) error
- func (c *Conch) DeleteGlobalRack(id fmt.Stringer) error
- func (c *Conch) DeleteGlobalRackLayoutSlot(id fmt.Stringer) error
- func (c *Conch) DeleteGlobalRackRole(id fmt.Stringer) error
- func (c *Conch) DeleteGlobalRoom(id fmt.Stringer) error
- func (c *Conch) DeleteHardwareProduct(hwUUID fmt.Stringer) error
- func (c *Conch) DeleteHardwareVendor(name string) error
- func (c *Conch) DeleteRackFromWorkspace(workspaceUUID fmt.Stringer, rackUUID fmt.Stringer) error
- func (c *Conch) DeleteUser(emailAddress string, clearTokens bool) error
- func (c *Conch) DeleteUserSetting(name string) error
- func (c *Conch) DeviceTritonReboot(serial string) error
- func (c *Conch) DeviceValidationStates(deviceSerial string) ([]ValidationState, error)
- func (c *Conch) FillInDevice(d Device) (Device, error)
- func (c *Conch) GetActiveWorkspaceRelays(workspaceUUID fmt.Stringer, minutes int) ([]WorkspaceRelay, error)
- func (c *Conch) GetAllRelays() ([]WorkspaceRelay, error)
- func (c *Conch) GetAllUsers() ([]UserDetailed, error)
- func (c *Conch) GetDevice(serial string) (d Device, err error)
- func (c *Conch) GetDeviceIPMI(serial string) (string, error)
- func (c *Conch) GetDeviceLocation(serial string) (loc DeviceLocation, err error)
- func (c *Conch) GetDeviceSetting(serial string, key string) (string, error)
- func (c *Conch) GetDeviceSettings(serial string) (map[string]string, error)
- func (c *Conch) GetDeviceTag(serial string, key string) (string, error)
- func (c *Conch) GetDeviceTags(serial string) (map[string]string, error)
- func (c *Conch) GetExtendedDevice(serial string) (ed ExtendedDevice, err error)
- func (c *Conch) GetGlobalDatacenter(id fmt.Stringer) (d GlobalDatacenter, err error)
- func (c *Conch) GetGlobalDatacenterRooms(d GlobalDatacenter) ([]GlobalRoom, error)
- func (c *Conch) GetGlobalDatacenters() ([]GlobalDatacenter, error)
- func (c *Conch) GetGlobalRack(id fmt.Stringer) (r GlobalRack, err error)
- func (c *Conch) GetGlobalRackLayout(r GlobalRack) ([]GlobalRackLayoutSlot, error)
- func (c *Conch) GetGlobalRackLayoutSlot(id fmt.Stringer) (*GlobalRackLayoutSlot, error)
- func (c *Conch) GetGlobalRackLayoutSlots() ([]GlobalRackLayoutSlot, error)
- func (c *Conch) GetGlobalRackRole(id fmt.Stringer) (r GlobalRackRole, err error)
- func (c *Conch) GetGlobalRackRoles() ([]GlobalRackRole, error)
- func (c *Conch) GetGlobalRacks() ([]GlobalRack, error)
- func (c *Conch) GetGlobalRoom(id fmt.Stringer) (r GlobalRoom, err error)
- func (c *Conch) GetGlobalRoomRacks(r GlobalRoom) ([]GlobalRack, error)
- func (c *Conch) GetGlobalRooms() ([]GlobalRoom, error)
- func (c *Conch) GetHardwareProduct(hardwareProductUUID fmt.Stringer) (hp HardwareProduct, err error)
- func (c *Conch) GetHardwareProducts() ([]HardwareProduct, error)
- func (c *Conch) GetHardwareVendor(name string) (v HardwareVendor, err error)
- func (c *Conch) GetHardwareVendorByID(id fmt.Stringer) (v HardwareVendor, err error)
- func (c *Conch) GetHardwareVendors() ([]HardwareVendor, error)
- func (c *Conch) GetSubWorkspaces(workspaceUUID fmt.Stringer) (Workspaces, error)
- func (c *Conch) GetUserSetting(key string) (setting interface{}, err error)
- func (c *Conch) GetUserSettings() (map[string]interface{}, error)
- func (c *Conch) GetValidationPlan(validationPlanUUID fmt.Stringer) (vp ValidationPlan, err error)
- func (c *Conch) GetValidationPlanValidations(validationPlanUUID fmt.Stringer) ([]Validation, error)
- func (c *Conch) GetValidationPlans() ([]ValidationPlan, error)
- func (c *Conch) GetValidations() ([]Validation, error)
- func (c *Conch) GetVersion() (string, error)
- func (c *Conch) GetWorkspace(workspaceUUID fmt.Stringer) (w Workspace, e error)
- func (c *Conch) GetWorkspaceDevices(workspaceUUID fmt.Stringer, idsOnly bool, graduated string, health string) ([]Device, error)
- func (c *Conch) GetWorkspaceRack(workspaceUUID fmt.Stringer, rackUUID fmt.Stringer) (rack Rack, err error)
- func (c *Conch) GetWorkspaceRacks(workspaceUUID fmt.Stringer) ([]Rack, error)
- func (c *Conch) GetWorkspaceRelayDevices(workspaceUUID fmt.Stringer, relayName string) ([]Device, error)
- func (c *Conch) GetWorkspaceRelays(workspaceUUID fmt.Stringer) ([]WorkspaceRelay, error)
- func (c *Conch) GetWorkspaceRooms(workspaceUUID fmt.Stringer) ([]Room, error)
- func (c *Conch) GetWorkspaceUsers(workspaceUUID fmt.Stringer) ([]WorkspaceUser, error)
- func (c *Conch) GetWorkspaces() (Workspaces, error)
- func (c *Conch) GraduateDevice(serial string) error
- func (c *Conch) Login(user string, password string) error
- func (c *Conch) MarkDeviceTritonSetup(serial string) error
- func (c *Conch) ParseJWT(token string, signature string) (ConchJWT, error)
- func (c *Conch) RawDelete(url string) (*http.Response, error)
- func (c *Conch) RawGet(url string) (*http.Response, error)
- func (c *Conch) RawPost(url string, body io.Reader) (*http.Response, error)
- func (c *Conch) RegisterRelay(r WorkspaceRelay) error
- func (c *Conch) RemoveUserFromWorkspace(workspaceUUID fmt.Stringer, email string) error
- func (c *Conch) ResetUserPassword(email string) error
- func (c *Conch) RevokeOwnTokens() error
- func (c *Conch) RevokeUserTokens(user string) error
- func (c *Conch) RunDeviceValidation(deviceSerial string, validationUUID fmt.Stringer, body string) ([]ValidationResult, error)
- func (c *Conch) RunDeviceValidationPlan(deviceSerial string, validationPlanUUID fmt.Stringer, body string) ([]ValidationResult, error)
- func (c *Conch) SaveGlobalDatacenter(d *GlobalDatacenter) error
- func (c *Conch) SaveGlobalRack(r *GlobalRack) error
- func (c *Conch) SaveGlobalRackLayoutSlot(r *GlobalRackLayoutSlot) error
- func (c *Conch) SaveGlobalRackRole(r *GlobalRackRole) error
- func (c *Conch) SaveGlobalRoom(r *GlobalRoom) error
- func (c *Conch) SaveHardwareProduct(h *HardwareProduct) error
- func (c *Conch) SaveHardwareVendor(v *HardwareVendor) error
- func (c *Conch) SetDeviceAssetTag(serial string, tag string) error
- func (c *Conch) SetDeviceSetting(deviceID string, key string, value string) error
- func (c *Conch) SetDeviceTag(deviceID string, key string, value string) error
- func (c *Conch) SetDeviceTritonUUID(serial string, id uuid.UUID) error
- func (c *Conch) SetUserSetting(name string, value interface{}) error
- func (c *Conch) SetUserSettings(settings map[string]interface{}) error
- func (c *Conch) VerifyLogin(refreshTime int, forceJWT bool) error
- func (c *Conch) WorkspaceValidationStates(workspaceUUID fmt.Stringer) ([]ValidationState, error)
- type ConchJWT
- type Datacenter
- type Device
- type DeviceLocation
- type Disk
- type ExtendedDevice
- type GlobalDatacenter
- type GlobalRack
- type GlobalRackLayoutSlot
- type GlobalRackRole
- type GlobalRoom
- type HardwareProduct
- type HardwareProductTarget
- type HardwareProfile
- type HardwareProfileZpool
- type HardwareVendor
- type Nic
- type Rack
- type RackSlot
- type Room
- type User
- type UserDetailed
- type Validation
- type ValidationPlan
- type ValidationPlanExecution
- type ValidationReport
- type ValidationResult
- type ValidationRun
- type ValidationRuns
- type ValidationState
- type Workspace
- type WorkspaceAndRole
- type WorkspaceRelay
- type WorkspaceRelayLocation
- type WorkspaceRelays
- type WorkspaceUser
- type Workspaces
- Bugs
Constants ¶
const ( ValidationReportStatusFail = 0 ValidationReportStatusOK = 1 )
ValidationReport vars provide an abstraction to make sense of the 'status' field in ValidationReports
const (
// MinimumAPIVersion sets the earliest API version that we support.
MinimumAPIVersion = "2.23.0"
)
Variables ¶
var ( // ErrLoginFailed indicates that the login process failed for unspecified // reasons ErrLoginFailed = errors.New("login failed") // 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("server 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") // 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 401 ErrNotAuthorized = errors.New("invalid or expired auth credentials") // ErrForbidden indicates that the API server returned a 403 ErrForbidden = errors.New("access to this data is forbidden") // ErrMustChangePassword is used to signal that the user must change their // password before proceeding. Typically, the existing auth credentials // will continue to work for a few minutes. ErrMustChangePassword = errors.New("user must change their password") ErrMalformedJWT = errors.New("server sent a malformed auth token") )
Functions ¶
This section is empty.
Types ¶
type Conch ¶
type Conch struct { BaseURL string UA string Debug bool Trace bool JWT ConchJWT HTTPClient *http.Client CookieJar *cookiejar.Jar }
Conch contains auth and configuration data
func (*Conch) AddRackToWorkspace ¶
AddRackToWorkspace adds an existing rack to an existing workspace, via /workspace/:uuid/rack
func (*Conch) AddUserToWorkspace ¶ added in v1.7.0
AddUserToWorkspace adds a user to a workspace via /workspace/:uuid/user
func (*Conch) ChangePassword ¶ added in v1.4.0
ChangePassword changes the password for the currently active profile
func (*Conch) CreateSubWorkspace ¶
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) CreateUser ¶ added in v1.4.0
CreateUser creates a new user. They are *not* added to a workspace. The 'name' argument is optional and will be omitted if set to "" The 'password' argument is optional and will be omitted if set to ""
func (*Conch) DeleteDeviceSetting ¶ added in v1.4.0
DeleteDeviceSetting deletes a single setting for a device via /device/:deviceID/settings/:key Settings that begin with "tag." cannot be processed by this routine and will always return ErrDataNotFound
func (*Conch) DeleteDeviceTag ¶ added in v1.4.0
DeleteDeviceTag deletes a single tag for a device via /device/:deviceID/settings/:key Settings that do NOT begin with "tag." cannot be processed by this routine and will always return ErrDataNotFound
func (*Conch) DeleteGlobalDatacenter ¶
DeleteGlobalDatacenter deletes a datacenter
func (*Conch) DeleteGlobalRack ¶
DeleteGlobalRack deletes a rack
func (*Conch) DeleteGlobalRackLayoutSlot ¶
DeleteGlobalRackLayoutSlot deletes a rack layout
func (*Conch) DeleteGlobalRackRole ¶
DeleteGlobalRackRole deletes a rack role
func (*Conch) DeleteGlobalRoom ¶
DeleteGlobalRoom deletes a room
func (*Conch) DeleteHardwareProduct ¶ added in v1.8.0
DeleteHardwareProduct deletes a hardware product by marking it as deactivated
func (*Conch) DeleteHardwareVendor ¶ added in v1.5.0
DeleteHardwareVendor ...
func (*Conch) DeleteRackFromWorkspace ¶
DeleteRackFromWorkspace removes an existing rack from an existing workplace, via /workspace/:uuid/rack/:uuid
func (*Conch) DeleteUser ¶ added in v1.4.0
DeleteUser deletes a user and, optionally, clears their JWT credentials
func (*Conch) DeleteUserSetting ¶
DeleteUserSetting deletes a user setting via /user/me/settings/:name
func (*Conch) DeviceTritonReboot ¶
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 ¶
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) GetActiveWorkspaceRelays ¶ added in v1.8.0
func (c *Conch) GetActiveWorkspaceRelays( workspaceUUID fmt.Stringer, minutes int, ) ([]WorkspaceRelay, error)
GetActiveWorkspaceRelays ...
func (*Conch) GetAllRelays ¶
func (c *Conch) GetAllRelays() ([]WorkspaceRelay, error)
GetAllRelays uses the /relay endpoint to get a list of all relays, but without their assigned devices.
func (*Conch) GetAllUsers ¶ added in v1.7.0
func (c *Conch) GetAllUsers() ([]UserDetailed, error)
GetAllUsers retrieves a list of all users, if the user has the right permissions, in the system. Returns UserDetailed structs
func (*Conch) GetDeviceIPMI ¶ added in v1.5.0
GetDeviceIPMI retrieves "/device/:serial/interface/impi1/ipaddr"
func (*Conch) GetDeviceLocation ¶
func (c *Conch) GetDeviceLocation(serial string) (loc DeviceLocation, err error)
GetDeviceLocation fetches the location for a device, via /device/:serial/location
func (*Conch) GetDeviceSetting ¶
GetDeviceSetting fetches a single setting for a device, via /device/:serial/settings/:key Device settings that begin with 'tag.' are filtered out.
func (*Conch) GetDeviceSettings ¶
GetDeviceSettings fetches settings for a device, via /device/:serial/settings Device settings that begin with 'tag.' are filtered out.
func (*Conch) GetDeviceTag ¶ added in v1.4.0
GetDeviceTag fetches a single tag for a device, via /device/:serial/settings/:key The key must either begin with 'tag.' or it will be prepended
func (*Conch) GetDeviceTags ¶ added in v1.4.0
GetDeviceTags fetches tags for a device, via /device/:serial/settings Device settings that do NOT begin with 'tag.' are filtered out.
func (*Conch) GetExtendedDevice ¶ added in v1.8.0
func (c *Conch) GetExtendedDevice(serial string) (ed ExtendedDevice, err error)
func (*Conch) GetGlobalDatacenter ¶
func (c *Conch) GetGlobalDatacenter(id fmt.Stringer) (d GlobalDatacenter, err 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) (r GlobalRack, err 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) (r GlobalRackRole, err 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) (r GlobalRoom, err 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, ) (hp HardwareProduct, err 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) GetHardwareVendor ¶ added in v1.5.0
func (c *Conch) GetHardwareVendor(name string) (v HardwareVendor, err error)
GetHardwareVendor ...
func (*Conch) GetHardwareVendorByID ¶ added in v1.8.0
func (c *Conch) GetHardwareVendorByID(id fmt.Stringer) (v HardwareVendor, err error)
func (*Conch) GetHardwareVendors ¶ added in v1.5.0
func (c *Conch) GetHardwareVendors() ([]HardwareVendor, error)
GetHardwareVendors ...
func (*Conch) GetSubWorkspaces ¶
func (c *Conch) GetSubWorkspaces(workspaceUUID fmt.Stringer) (Workspaces, error)
GetSubWorkspaces returns the contents of /workspace/:uuid/child, getting a list of subworkspaces for the given workspace id
func (*Conch) GetUserSetting ¶
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 ¶
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, ) (vp ValidationPlan, err 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) GetVersion ¶ added in v1.8.0
GetVersion returns the API's version string, via /version
func (*Conch) GetWorkspace ¶
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 Rack, err error)
GetWorkspaceRack fetches a single rack for a workspace, via /workspace/:uuid/rack/:id
func (*Conch) GetWorkspaceRacks ¶
GetWorkspaceRacks fetchest the list of racks for a workspace, via /workspace/:uuid/rack NOTE: The API currently returns a hash of arrays where the key is the datacenter/az. This routine copies that key into the Datacenter field in the Rack struct.
func (*Conch) GetWorkspaceRelayDevices ¶ added in v1.8.0
func (c *Conch) GetWorkspaceRelayDevices( workspaceUUID fmt.Stringer, relayName string, ) ([]Device, error)
GetWorkspaceRelayDevices ...
func (*Conch) GetWorkspaceRelays ¶
func (c *Conch) GetWorkspaceRelays(workspaceUUID fmt.Stringer) ([]WorkspaceRelay, error)
GetWorkspaceRelays returns all Relays associated with the given workspace
func (*Conch) GetWorkspaceRooms ¶
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) ([]WorkspaceUser, 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() (Workspaces, error)
GetWorkspaces returns the contents of /workspace, getting the list of all workspaces that the user has access to
func (*Conch) GraduateDevice ¶
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) Login ¶
Login uses the User, as listed in the Conch struct, and the provided password to log into the Conch API and populate the JWT entry in the Conch struct
func (*Conch) MarkDeviceTritonSetup ¶
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 ¶
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 ¶
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 ¶
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 WorkspaceRelay) 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) RemoveUserFromWorkspace ¶ added in v1.7.0
RemoveUserFromWorkspace ...
func (*Conch) ResetUserPassword ¶ added in v1.4.0
ResetUserPassword resets the password for the provided user, causing an email to be sent
func (*Conch) RevokeOwnTokens ¶
RevokeOwnTokens revokes all auth tokens for the current user. Login() is required after to generate new tokens. Clears the JWT, and Expires attributes
func (*Conch) RevokeUserTokens ¶
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 string, ) ([]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 string, ) ([]ValidationResult, error)
RunDeviceValidationPlan runs a validation plan against a given device and returns the results
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) SaveHardwareProduct ¶ added in v1.8.0
func (c *Conch) SaveHardwareProduct(h *HardwareProduct) error
SaveHardwareProduct creates or saves s hardware product, based on the presence of an ID
func (*Conch) SaveHardwareVendor ¶ added in v1.5.0
func (c *Conch) SaveHardwareVendor(v *HardwareVendor) error
SaveHardwareVendor ...
func (*Conch) SetDeviceAssetTag ¶
SetDeviceAssetTag sets the asset tag for the provided serial
func (*Conch) SetDeviceSetting ¶ added in v1.4.0
SetDeviceSetting sets a single setting for a device via /device/:deviceID/settings/:key Settings that begin with "tag." cannot be processed by this routine and will always return ErrDataNotFound
func (*Conch) SetDeviceTag ¶ added in v1.4.0
SetDeviceTag sets a single tag for a device via /device/:deviceID/settings/:key The key must either begin with 'tag.' or it will be prepended
func (*Conch) SetDeviceTritonUUID ¶
SetDeviceTritonUUID sets the triton UUID via /device/:serial/triton_uuid
func (*Conch) SetUserSetting ¶
SetUserSetting sets the value of a user setting via /user/me/settings/:name
func (*Conch) SetUserSettings ¶
SetUserSettings sets the value of *all* user settings via /user/me/settings
func (*Conch) VerifyLogin ¶
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 parameter is true, a JWT refresh is forced, regardless of any other parameters.
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 ConchJWT ¶ added in v1.9.0
type Datacenter ¶
type Datacenter struct { ID uuid.UUID `json:"id"` Name string `json:"name"` VendorName string `json:"vendor_name"` }
Datacenter represents a conch datacenter, aka an AZ
type Device ¶
type Device struct { AssetTag string `json:"asset_tag"` 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"` Hostname string `json:"hostname"` ID string `json:"id"` LastSeen pgtime.PgTime `json:"last_seen"` Location DeviceLocation `json:"location"` Nics []Nic `json:"nics"` 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 interface{} `json:"latest_report"` LatestReportIsInvalid bool `json:"latest_report_is_invalid"` InvalidReport string `json:"invalid_report"` Disks []Disk `json:"disks"` }
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 Disk ¶ added in v1.8.0
type Disk struct { ID uuid.UUID `json:"id"` Created pgtime.PgTime `json:"created"` Updated pgtime.PgTime `json:"updated"` DriveType string `json:"drive_type"` Enclosure string `json:"enclosure"` Firmware string `json:"firmware"` HBA string `json:"hba"` Health string `json:"health"` Model string `json:"model"` SerialNumber string `json:"serial_number"` Size int `json:"size"` Slot int `json:"slot"` Temp int `json:"temp"` Transport string `json:"transport"` Vendor string `json:"vendor"` }
DeviceDisk ...
type ExtendedDevice ¶ added in v1.8.0
type ExtendedDevice struct { Device IPMI string `json:"ipmi"` HardwareName string `json:"hardware_name"` SKU string `json:"sku"` Enclosures map[string]map[int]Disk `json:"enclosures"` IsGraduated bool `json:"is_graduated"` IsTritonSetup bool `json:"is_triton_setup"` IsValidated bool `json:"is_validated"` Validations []ValidationPlanExecution `json:"validations"` }
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"` SerialNumber string `json:"serial_number"` AssetTag string `json:"asset_tag"` }
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"` HardwareVendorID uuid.UUID `json:"hardware_vendor_id"` GenerationName string `json:"generation_name"` LegacyProductName string `json:"legacy_product_name"` SKU string `json:"sku"` Specification interface{} `json:"specification"` Profile HardwareProfile `json:"hardware_product_profile"` Created pgtime.PgTime `json:"created"` Updated pgtime.PgTime `json:"updated"` }
HardwareProduct is a type of Device. For instance, "Hallasan C"
func (*HardwareProduct) UnmarshalJSON ¶ added in v1.9.0
func (h *HardwareProduct) UnmarshalJSON(data []byte) error
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"` BiosFirmware string `json:"bios_firmware"` CPUType string `json:"cpu_type"` HbaFirmware string `json:"hba_firmware"` NumCPU int `json:"cpu_num"` NumDimms int `json:"dimms_num"` NumNics int `json:"nics_num"` NumUSB int `json:"usb_num"` Purpose string `json:"purpose"` SasHddNum int `json:"sas_hdd_num"` SasHddSize int `json:"sas_hdd_size"` SasHddSlots string `json:"sas_hdd_slots"` SataHddNum int `json:"sata_hdd_num"` SataHddSize int `json:"sata_hdd_size"` SataHddSlots string `json:"sata_hdd_slots"` SataSsdNum int `json:"sata_ssd_num"` SataSsdSize int `json:"sata_ssd_size"` SataSsdSlots string `json:"sata_ssd_slots"` NvmeSsdNum int `json:"nvme_ssd_num"` NvmeSsdSize int `json:"nvme_ssd_size"` NvmeSsdSlots int `json:"nvme_ssd_slots"` RaidLunNum int `json:"raid_lun_num"` TotalPSU int `json:"psu_total"` TotalRAM int `json:"ram_total"` RackUnit int `json:"rack_unit"` 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"` Name string `json:"name"` 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 HardwareVendor ¶ added in v1.5.0
type HardwareVendor struct { ID uuid.UUID `json:"id"` Name string `json:"name"` Created pgtime.PgTime `json:"created"` Updated pgtime.PgTime `json:"updated"` }
HardwareVendor ...
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"` // BUG(sungo): This exists because device locations provide rack info, but also slot info. This is a sloppy combination of data streams Size int `json:"size"` Datacenter string `json:"datacenter"` Slots []RackSlot `json:"slots,omitempty"` SerialNumber string `json:"serial_number"` AssetTag string `json:"asset_tag"` }
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"` RackUnitStart int `json:"rack_unit_start"` }
RackSlot represents a physical slot in a physical Rack
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 User ¶
type User struct { ID string `json:"id,omitempty"` Email string `json:"email"` Name string `json:"name"` Role string `json:"role"` RoleVia uuid.UUID `json:"role_via,omitempty"` }
User represents a person able to access the Conch API or UI
type UserDetailed ¶ added in v1.7.0
type UserDetailed struct { ID uuid.UUID `json:"id"` Name string `json:"name"` Email string `json:"email"` Created pgtime.PgTime `json:"created"` LastLogin pgtime.PgTime `json:"last_login"` RefuseSessionAuth bool `json:"refuse_session_auth"` ForcePasswordChange bool `json:"force_password_change"` Workspaces []WorkspaceAndRole `json:"workspaces,omitempty"` IsAdmin bool `json:"is_admin"` }
UserDetailed ...
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 ValidationPlanExecution ¶ added in v1.8.0
type ValidationPlanExecution struct { ID uuid.UUID `json:"id"` Name string `json:"name"` Validations ValidationRuns `json:"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 ValidationRun ¶ added in v1.8.0
type ValidationRun struct { ID uuid.UUID `json:"id"` Name string `json:"name"` Passed bool `json:"passed"` Results []ValidationResult `json:"results"` }
type ValidationRuns ¶ added in v1.8.0
type ValidationRuns []ValidationRun
func (ValidationRuns) Len ¶ added in v1.8.0
func (v ValidationRuns) Len() int
func (ValidationRuns) Less ¶ added in v1.8.0
func (v ValidationRuns) Less(i, j int) bool
func (ValidationRuns) Swap ¶ added in v1.8.0
func (v ValidationRuns) Swap(i, j int)
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,omitempty"` Role string `json:"role"` ParentID uuid.UUID `json:"parent_id,omitempty"` }
Workspace represents a Conch data partition which allows users to create custom lists of hardware
type WorkspaceAndRole ¶ added in v1.7.0
WorkspaceAndRole ...
type WorkspaceRelay ¶ added in v1.8.0
type WorkspaceRelay struct { ID string `json:"id"` // *not* a UUID Created pgtime.PgTime `json:"created"` Updated pgtime.PgTime `json:"updated"` Alias string `json:"alias"` IPAddr string `json:"ipaddr"` SSHPort int `json:"ssh_port"` Version string `json:"version"` LastSeen pgtime.PgTime `json:"last_seen"` NumDevices int `json:"num_devices"` Location WorkspaceRelayLocation `json:"location"` }
WorkspaceRelay represents a Conch Relay unit, a physical piece of hardware that mediates Livesys interactions in the field
type WorkspaceRelayLocation ¶ added in v1.8.0
type WorkspaceRelayLocation struct { Az string `json:"az"` RackID uuid.UUID `json:"rack_id"` RackName string `json:"rack_name"` RackUnitStart int `json:"rack_unit_start"` RoleName string `json:"role_name"` }
WorkspaceRelayLocation ...
type WorkspaceUser ¶ added in v1.7.0
WorkspaceUser ...
type Workspaces ¶ added in v1.8.0
type Workspaces []Workspace
func (Workspaces) Len ¶ added in v1.8.0
func (w Workspaces) Len() int
func (Workspaces) Less ¶ added in v1.8.0
func (w Workspaces) Less(i, j int) bool
func (Workspaces) Swap ¶ added in v1.8.0
func (w Workspaces) Swap(i, j int)
Notes ¶
Bugs ¶
This is mostly for the config back compat code. Once that's gone, we can probably just check the expires value
an awfully simplistic view of the world
do we really want to throw away parse errors?
This exists because device locations provide rack info, but also slot info. This is a sloppy combination of data streams