Documentation
¶
Overview ¶
Package fleetdbapi provides the v1 api for the fleetdb service
Index ¶
- Constants
- Variables
- func ComponentKey(slug, serial string) string
- func OperatorURLQueryDecoder(s string) (reflect.Value, error)
- func OperatorURLQueryEncoder(rv reflect.Value) string
- type AttributeListParams
- type Attributes
- type BiosConfigComponent
- type BiosConfigComponentQuery
- type BiosConfigSet
- type BiosConfigSetListParams
- type BiosConfigSetQuery
- type BiosConfigSetQueryParams
- type BiosConfigSetting
- type BiosConfigSettingQuery
- type Client
- func (c *Client) AcceptComponentChanges(ctx context.Context, serverID string, changeIDs []string) (*ServerResponse, error)
- func (c *Client) Create(ctx context.Context, srv Server) (*uuid.UUID, *ServerResponse, error)
- func (c *Client) CreateHardwareModel(ctx context.Context, hardwareModel *HardwareModel) (*ServerResponse, error)
- func (c *Client) CreateHardwareVendor(ctx context.Context, hardwareVendor *HardwareVendor) (*ServerResponse, error)
- func (c *Client) CreateServerBMC(ctx context.Context, serverBMC *ServerBMC) (*ServerResponse, error)
- func (c *Client) CreateServerBiosConfigSet(ctx context.Context, set BiosConfigSet) (*ServerResponse, error)
- func (c *Client) CreateServerComponentFirmware(ctx context.Context, firmware ComponentFirmwareVersion) (*uuid.UUID, *ServerResponse, error)
- func (c *Client) CreateServerComponentFirmwareSet(ctx context.Context, set ComponentFirmwareSetRequest) (*uuid.UUID, *ServerResponse, error)
- func (c *Client) CreateServerComponentType(ctx context.Context, t ServerComponentType) (*ServerResponse, error)
- func (c *Client) CreateServerCredentialType(ctx context.Context, sType *ServerCredentialType) (*ServerResponse, error)
- func (c *Client) Delete(ctx context.Context, srv Server) (*ServerResponse, error)
- func (c *Client) DeleteComponentCapability(ctx context.Context, componentID uuid.UUID) (*ServerResponse, error)
- func (c *Client) DeleteComponentMetadata(ctx context.Context, componentID uuid.UUID, namespace string) (*ServerResponse, error)
- func (c *Client) DeleteComponentStatus(ctx context.Context, componentID uuid.UUID) (*ServerResponse, error)
- func (c *Client) DeleteCredential(ctx context.Context, srvUUID uuid.UUID, secretSlug string) (*ServerResponse, error)
- func (c *Client) DeleteHardwareModel(ctx context.Context, name string) (*ServerResponse, error)
- func (c *Client) DeleteHardwareVendor(ctx context.Context, name string) (*ServerResponse, error)
- func (c *Client) DeleteInstalledFirmware(ctx context.Context, componentID uuid.UUID) (*ServerResponse, error)
- func (c *Client) DeleteServerBMC(ctx context.Context, serverID uuid.UUID) (*ServerResponse, error)
- func (c *Client) DeleteServerBiosConfigSet(ctx context.Context, id uuid.UUID) (*ServerResponse, error)
- func (c *Client) DeleteServerComponentFirmware(ctx context.Context, firmware ComponentFirmwareVersion) (*ServerResponse, error)
- func (c *Client) DeleteServerComponentFirmwareSet(ctx context.Context, firmwareSetID uuid.UUID) (*ServerResponse, error)
- func (c *Client) DeleteServerComponents(ctx context.Context, srvUUID uuid.UUID) (*ServerResponse, error)
- func (c *Client) DeleteServerStatus(ctx context.Context, serverID uuid.UUID) (*ServerResponse, error)
- func (c *Client) GetComponentCapability(ctx context.Context, componentID uuid.UUID) (*ComponentCapability, *ServerResponse, error)
- func (c *Client) GetComponentMetadata(ctx context.Context, componentID uuid.UUID, namespace string) (*ComponentMetadata, *ServerResponse, error)
- func (c *Client) GetComponentStatus(ctx context.Context, componentID uuid.UUID) (*ComponentStatus, *ServerResponse, error)
- func (c *Client) GetComponents(ctx context.Context, srvUUID uuid.UUID, params *ServerComponentGetParams) (ServerComponentSlice, *ServerResponse, error)
- func (c *Client) GetCredential(ctx context.Context, srvUUID uuid.UUID, secretSlug string) (*ServerCredential, *ServerResponse, error)
- func (c *Client) GetHardwareModel(ctx context.Context, name string) (*HardwareModel, *ServerResponse, error)
- func (c *Client) GetHardwareVendor(ctx context.Context, name string) (*HardwareVendor, *ServerResponse, error)
- func (c *Client) GetHistoryByID(ctx context.Context, evtID uuid.UUID) ([]*Event, *ServerResponse, error)
- func (c *Client) GetInstalledFirmware(ctx context.Context, componentID uuid.UUID) (*InstalledFirmware, *ServerResponse, error)
- func (c *Client) GetServer(ctx context.Context, srvUUID uuid.UUID, params *ServerQueryParams) (*Server, *ServerResponse, error)
- func (c *Client) GetServerBMC(ctx context.Context, serverID uuid.UUID) (*ServerBMC, *ServerResponse, error)
- func (c *Client) GetServerBiosConfigSet(ctx context.Context, id uuid.UUID) (*ServerResponse, error)
- func (c *Client) GetServerComponentFirmware(ctx context.Context, fwUUID uuid.UUID) (*ComponentFirmwareVersion, *ServerResponse, error)
- func (c *Client) GetServerComponentFirmwareSet(ctx context.Context, fwSetUUID uuid.UUID) (*ComponentFirmwareSet, *ServerResponse, error)
- func (c *Client) GetServerEvents(ctx context.Context, srvID uuid.UUID, params *PaginationParams) ([]*Event, *ServerResponse, error)
- func (c *Client) GetServerStatus(ctx context.Context, serverID uuid.UUID) (*ServerStatus, *ServerResponse, error)
- func (c *Client) InitComponentCollection(ctx context.Context, srvUUID uuid.UUID, components ServerComponentSlice, ...) (*ServerResponse, error)
- func (c *Client) ListComponentMetadata(ctx context.Context, componentID uuid.UUID, namespace string) ([]*ComponentMetadata, *ServerResponse, error)
- func (c *Client) ListComponentStatus(ctx context.Context) ([]*ComponentStatus, *ServerResponse, error)
- func (c *Client) ListComponents(ctx context.Context, params *ServerComponentListParams) (ServerComponentSlice, *ServerResponse, error)
- func (c *Client) ListHardwareModels(ctx context.Context) ([]*HardwareModel, *ServerResponse, error)
- func (c *Client) ListHardwareVendors(ctx context.Context) ([]*HardwareVendor, *ServerResponse, error)
- func (c *Client) ListInstalledFirmware(ctx context.Context) ([]*InstalledFirmware, *ServerResponse, error)
- func (c *Client) ListServerBiosConfigSet(ctx context.Context, params *BiosConfigSetListParams) (*ServerResponse, error)
- func (c *Client) ListServerComponentFirmware(ctx context.Context, params *ComponentFirmwareVersionListParams) ([]ComponentFirmwareVersion, *ServerResponse, error)
- func (c *Client) ListServerComponentFirmwareSet(ctx context.Context, params *ComponentFirmwareSetListParams) ([]ComponentFirmwareSet, *ServerResponse, error)
- func (c *Client) ListServerComponentTypes(ctx context.Context, params *ServerComponentTypeListParams) (ServerComponentTypeSlice, *ServerResponse, error)
- func (c *Client) ListServerCredentialTypes(ctx context.Context, params *PaginationParams) ([]ServerCredentialType, *ServerResponse, error)
- func (c *Client) ListServerStatus(ctx context.Context) ([]*ServerStatus, *ServerResponse, error)
- func (c *Client) ListServers(ctx context.Context, params *ServerQueryParams) ([]Server, *ServerResponse, error)
- func (c *Client) NextPage(ctx context.Context, resp ServerResponse, recs interface{}) (*ServerResponse, error)
- func (c *Client) RemoveServerComponentFirmwareSetFirmware(ctx context.Context, fwSetUUID uuid.UUID, ...) (*ServerResponse, error)
- func (c *Client) ReportComponentChanges(ctx context.Context, serverID string, change *ComponentChangeReport) (*ComponentChangeReportResponse, *ServerResponse, error)
- func (c *Client) SetComponentCapability(ctx context.Context, capability []*ComponentCapability) (*ServerResponse, error)
- func (c *Client) SetComponentMetadata(ctx context.Context, metadata []*ComponentMetadata) (*ServerResponse, error)
- func (c *Client) SetComponentStatus(ctx context.Context, componentStatus *ComponentStatus) (*ServerResponse, error)
- func (c *Client) SetCredential(ctx context.Context, srvUUID uuid.UUID, secretSlug, username, password string) (*ServerResponse, error)
- func (c *Client) SetDumper(w io.Writer)
- func (c *Client) SetInstalledFirmware(ctx context.Context, installedFirmware *InstalledFirmware) (*ServerResponse, error)
- func (c *Client) SetServerStatus(ctx context.Context, serverStatus *ServerStatus) (*ServerResponse, error)
- func (c *Client) SetToken(token string)
- func (c *Client) Update(ctx context.Context, srvUUID uuid.UUID, srv Server) (*ServerResponse, error)
- func (c *Client) UpdateComponentCollection(ctx context.Context, srvUUID uuid.UUID, components ServerComponentSlice, ...) (*ServerResponse, error)
- func (c *Client) UpdateComponentFirmwareSetRequest(ctx context.Context, fwSetUUID uuid.UUID, ...) (*ServerResponse, error)
- func (c *Client) UpdateEvent(ctx context.Context, evt *Event) (*ServerResponse, error)
- func (c *Client) UpdateServerBiosConfigSet(ctx context.Context, id uuid.UUID, set BiosConfigSet) (*ServerResponse, error)
- func (c *Client) UpdateServerComponentFirmware(ctx context.Context, fwUUID uuid.UUID, firmware ComponentFirmwareVersion) (*ServerResponse, error)
- func (c *Client) ValidateFirmwareSet(ctx context.Context, srvID, fwSetID uuid.UUID, on time.Time) error
- type ClientError
- type ClientInterface
- type CollectionMethod
- type ComparisonOperator
- type ComponentCapability
- type ComponentChangeAccept
- type ComponentChangeReport
- type ComponentChangeReportResponse
- type ComponentFirmwareSet
- type ComponentFirmwareSetListParams
- type ComponentFirmwareSetRequest
- type ComponentFirmwareVersion
- type ComponentFirmwareVersionListParams
- type ComponentMetadata
- type ComponentSlugMap
- type ComponentStatus
- type Converter
- type Doer
- type Event
- type Filter
- type FilterParams
- type FilterTarget
- type FirmwareSetValidation
- type HardwareModel
- type HardwareVendor
- type InstalledFirmware
- type Link
- type LogicalOperator
- type Modifier
- type OperatorComparitorType
- type OperatorLogicalType
- type PaginationParams
- type Router
- type Server
- type ServerBMC
- type ServerComponent
- type ServerComponentGetParams
- type ServerComponentListParams
- type ServerComponentSlice
- type ServerComponentType
- type ServerComponentTypeListParams
- type ServerComponentTypeSlice
- type ServerCredential
- type ServerCredentialType
- type ServerError
- type ServerQueryParams
- type ServerResponse
- type ServerResponseLinks
- type ServerStatus
Constants ¶
const ( // comparison operators ComparisonOpEqual ComparisonOperator = "eq" ComparisonOpNotEqual ComparisonOperator = "ne" ComparisonOpGreaterThan ComparisonOperator = "gt" ComparisonOpLessThan ComparisonOperator = "lt" ComparisonOpStartsWith ComparisonOperator = "sw" ComparisonOpEndsWith ComparisonOperator = "ew" ComparisonOpContains ComparisonOperator = "contains" // logical operators LogicalOperation = "op" LogicalOpAnd LogicalOperator = "and" LogicalOpNot LogicalOperator = "not" LogicalOpOr LogicalOperator = "or" // modifiers ModifierCaseInsensitive Modifier = "cin" )
const ( // OperatorComparitorEqual means the value has to match the keys exactly OperatorComparitorEqual OperatorComparitorType = "eq" // OperatorComparitorNotEqual means the value has to match the keys exactly, but then exclude those matches OperatorComparitorNotEqual = "!=" // OperatorComparitorLike allows you to pass in a value with % in it and match anything like it. If your string has no % in it one will be added to the end automatically OperatorComparitorLike = "like" // OperatorComparitorGreaterThan will convert the value at the given key to an int and return results that are greater than Value OperatorComparitorGreaterThan = "gt" // OperatorComparitorLessThan will convert the value at the given key to an int and return results that are less than Value OperatorComparitorLessThan = "lt" )
TODO; We really should just make these the same values as qm.operators, or they should just be ints (preferrable option being UINTS)
const (
ComponentMetadataGenericNS = "metadata.generic"
)
const ( // ServerCredentialTypeBMC returns the slug for the builtin ServerCredentialType used // to store BMC passwords ServerCredentialTypeBMC = "bmc" )
Variables ¶
var ( // ErrNoNextPage is the error returned when there is not an additional page of resources ErrNoNextPage = errors.New("no next page found") // ErrUUIDParse is returned when the UUID is invalid. ErrUUIDParse = errors.New("UUID parse error") // ErrValidatePayload is returned when the received payload failed validation ErrValidatePayload = errors.New("payload validation error") // ErrDBQuery indicates a DB query returned an error ErrDBQuery = errors.New("DB query returned error") // ErrComponentType indicates the component type is not supported ErrComponentType = errors.New("component type error") // ErrCredentialEncrypt is returned when theres an internal error encrypting the secret. ErrCredentialEncrypt = errors.New("error encrypting secret value") )
var ( // MaxPaginationSize represents the maximum number of records that can be returned per page MaxPaginationSize = 1000 // DefaultPaginationSize represents the default number of records that are returned per page DefaultPaginationSize = 100 )
var ( ErrFwSetByVendorModel = errors.New("error identifying firmware set by server vendor, model") // FleetDB attribute namespace for firmware set labels. FirmwareSetAttributeNS = "sh.hollow.firmware_set.labels" )
var (
ErrHardwareModelNotFound = errors.New("hardware model not found")
)
var (
ErrHardwareVendorNotFound = errors.New("hardware vendor not found")
)
Functions ¶
func ComponentKey ¶ added in v1.20.5
Returns identifier for the component based on the slug and serial values
func OperatorURLQueryDecoder ¶
OperatorURLQueryDecoder will be passed to a urlquery decoder to escape Operator types from query strings TODO; If we swap OperatorComparitorType and OperatorLogicalType to ints, this function will not be needed. reflect.Set() doesnt convert custom string types back and forth like it is able to with custom int types So we have escaped them and to get the values back we parse out the escape value and see if the strings are operator constants
func OperatorURLQueryEncoder ¶
OperatorURLQueryEncoder will be passed to a urlquery encoder to escape Operator types from query strings TODO; If we swap OperatorComparitorType and OperatorLogicalType to ints, this function will not be needed. NOTE: reflect.Set() doesnt convert custom string types back and forth like it is able to with custom int types So we have to escape and workaround these custom string types by escaping them when we parse the query.
Types ¶
type AttributeListParams ¶
type AttributeListParams struct {
Namespace string
Keys []string
Operator OperatorComparitorType
Value string
// OperatorLogicalType is used to define how this AttributeListParam value should be SQL queried
// this value defaults to OperatorLogicalAND.
AttributeOperator OperatorLogicalType
}
AttributeListParams allow you to filter the results based on attributes
type Attributes ¶
type Attributes struct {
Namespace string `json:"namespace"`
Data json.RawMessage `json:"data"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Attributes provide the ability to apply namespaced settings to an entity. For example servers could have attributes in the `com.equinixmetal.api` namespace that represents equinix metal specific attributes that are stored in the API. The namespace is meant to define who owns the schema and values.
type BiosConfigComponent ¶
type BiosConfigComponent struct {
ID string `json:"id"`
Name string `json:"name" binding:"required"`
Vendor string `json:"vendor"`
Model string `json:"model"`
Settings []BiosConfigSetting `json:"settings" binding:"required"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
BiosConfigComponent represents a BIOS Configuration Component
type BiosConfigComponentQuery ¶
type BiosConfigComponentQuery struct {
Name string `query:"name"`
Vendor string `query:"vendor"`
Model string `query:"model"`
Settings []BiosConfigSettingQuery `query:"settings"`
}
BiosConfigComponentQuery defines values you can query BiosConfigComponents with. Empty strings are ignored.
type BiosConfigSet ¶
type BiosConfigSet struct {
ID string `json:"id"`
Name string `json:"name" binding:"required"`
Version string `json:"version" binding:"required"`
Components []BiosConfigComponent `json:"components" binding:"required"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
BiosConfigSet represents a BIOS Configuration Set
type BiosConfigSetListParams ¶
type BiosConfigSetListParams struct {
Params []BiosConfigSetQueryParams `query:"params"`
Pagination PaginationParams `query:"page"`
}
BiosConfigSetListParams params is an array of potential expressions when querying. Each one will have a Set. This Set will define values you want to search on, empty strings will be ignored. The ComparitorOperator will define how you want to compare those values. All values within a single BiosConfigSetQueryParams item will be grouped together and "AND"'ed. The LogicalOperator will define how that BiosConfigSetQueryParams item will be grouped with other BiosConfigSetQueryParams items. Note: You must set PaginationParams.Preload to load BiosConfigComponents and BiosConfigSettings.
type BiosConfigSetQuery ¶
type BiosConfigSetQuery struct {
Name string `query:"name"`
Version string `query:"version"`
Components []BiosConfigComponentQuery `query:"components"`
}
BiosConfigSetQuery defines values you can query BiosConfigSets with. Empty strings are ignored.
type BiosConfigSetQueryParams ¶
type BiosConfigSetQueryParams struct {
Set BiosConfigSetQuery `query:"set"`
LogicalOperator OperatorLogicalType `query:"logical"`
ComparitorOperator OperatorComparitorType `query:"comparitor"`
}
BiosConfigSetQueryParams defines a BiosConfigSetQuery struct and operators you can use to query BiosConfigSets with. If LogicalOperator is an empty string, it will default to OperatorLogicalAND. If ComparitorOperator is an empty string, it will default to OperatorComparitorEqual
type BiosConfigSetting ¶
type BiosConfigSetting struct {
ID string `json:"id"`
Key string `json:"key" binding:"required"`
Value string `json:"value" binding:"required"`
Raw []byte `json:"raw,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
BiosConfigSetting represents a BIOS Configuration Component Setting
type BiosConfigSettingQuery ¶
BiosConfigSettingQuery defines values you can query BiosConfigSettings with. Empty strings are ignored.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client has the ability to talk to a fleetdb api server running at the given URI
func NewClient ¶
NewClient will return a fleetdb client configured to talk to the given URL. This client will not set the authorization header for you automatically and is left to be handled by the Doer that is provided.
Example:
ctx := context.TODO()
provider, _ := oidc.NewProvider(ctx, "https://OIDC_ISSUER.COM")
oauthConfig := clientcredentials.Config{
ClientID: "CLIENT_ID",
ClientSecret: "CLIENT_SECRET",
TokenURL: provider.Endpoint().TokenURL,
Scopes: []string{"SCOPE", "SCOPE2"},
EndpointParams: url.Values{"audience": []string{"HOLLOW_AUDIENCE_VALUE"}},
}
c, _ := fleetdbapi.NewClient("HOLLOW_URI", oauthConfig.Client(ctx))
func NewClientWithToken ¶
NewClientWithToken will initialize a new hollow client with the given auth token and URL
func (*Client) AcceptComponentChanges ¶ added in v1.20.2
func (c *Client) AcceptComponentChanges(ctx context.Context, serverID string, changeIDs []string) (*ServerResponse, error)
AcceptComponentChanges accepts and merges the specified changeIDs which reference component addition/deletion component change reports
func (*Client) Create ¶
Create will attempt to create a server in Hollow and return the new server's UUID
func (*Client) CreateHardwareModel ¶ added in v1.20.1
func (c *Client) CreateHardwareModel(ctx context.Context, hardwareModel *HardwareModel) (*ServerResponse, error)
CreateHardwareModel creates a hardware model record - requires the hardware vendor relation
func (*Client) CreateHardwareVendor ¶ added in v1.20.1
func (c *Client) CreateHardwareVendor(ctx context.Context, hardwareVendor *HardwareVendor) (*ServerResponse, error)
CreateHardwareVendor creates a hardware vendor record
func (*Client) CreateServerBMC ¶ added in v1.20.1
func (c *Client) CreateServerBMC(ctx context.Context, serverBMC *ServerBMC) (*ServerResponse, error)
CreateServerBMC creates a server BMC record - requires the server relation
func (*Client) CreateServerBiosConfigSet ¶
func (c *Client) CreateServerBiosConfigSet(ctx context.Context, set BiosConfigSet) (*ServerResponse, error)
CreateServerBiosConfigSet will store the BiosConfigSet, and return the generated UUID of the BiosConfigSet
func (*Client) CreateServerComponentFirmware ¶
func (c *Client) CreateServerComponentFirmware(ctx context.Context, firmware ComponentFirmwareVersion) (*uuid.UUID, *ServerResponse, error)
CreateServerComponentFirmware will attempt to create a firmware in Hollow and return the firmware UUID
func (*Client) CreateServerComponentFirmwareSet ¶
func (c *Client) CreateServerComponentFirmwareSet(ctx context.Context, set ComponentFirmwareSetRequest) (*uuid.UUID, *ServerResponse, error)
CreateServerComponentFirmwareSet will attempt to create a firmware set in Hollow and return the firmware UUID
func (*Client) CreateServerComponentType ¶
func (c *Client) CreateServerComponentType(ctx context.Context, t ServerComponentType) (*ServerResponse, error)
CreateServerComponentType will attempt to create a server component type in Hollow
func (*Client) CreateServerCredentialType ¶
func (c *Client) CreateServerCredentialType(ctx context.Context, sType *ServerCredentialType) (*ServerResponse, error)
CreateServerCredentialType will create a new server secret type
func (*Client) Delete ¶
Delete will attempt to delete a server in Hollow and return an error on failure
func (*Client) DeleteComponentCapability ¶ added in v1.20.2
func (c *Client) DeleteComponentCapability(ctx context.Context, componentID uuid.UUID) (*ServerResponse, error)
DeleteComponentCapability deletes a component capability record
func (*Client) DeleteComponentMetadata ¶ added in v1.20.2
func (c *Client) DeleteComponentMetadata(ctx context.Context, componentID uuid.UUID, namespace string) (*ServerResponse, error)
DeleteComponentMetadata deletes a component metadata record
func (*Client) DeleteComponentStatus ¶ added in v1.20.2
func (c *Client) DeleteComponentStatus(ctx context.Context, componentID uuid.UUID) (*ServerResponse, error)
DeleteComponentStatus deletes a component status record
func (*Client) DeleteCredential ¶
func (c *Client) DeleteCredential(ctx context.Context, srvUUID uuid.UUID, secretSlug string) (*ServerResponse, error)
DeleteCredential will remove the secret for a given server UUID and secret type.
func (*Client) DeleteHardwareModel ¶ added in v1.20.1
DeleteHardwareModel purges a hardware model record
func (*Client) DeleteHardwareVendor ¶ added in v1.20.1
DeleteHardwareVendor purges a hardware vendor record by its name
func (*Client) DeleteInstalledFirmware ¶ added in v1.20.1
func (c *Client) DeleteInstalledFirmware(ctx context.Context, componentID uuid.UUID) (*ServerResponse, error)
DeleteInstalledFirmware purges a installed firmware record (soft delete)
func (*Client) DeleteServerBMC ¶ added in v1.20.1
DeleteServerBMC purges a server's BMC record
func (*Client) DeleteServerBiosConfigSet ¶
func (c *Client) DeleteServerBiosConfigSet(ctx context.Context, id uuid.UUID) (*ServerResponse, error)
DeleteServerBiosConfigSet will delete the BiosConfigSet referred to by the given ID if found
func (*Client) DeleteServerComponentFirmware ¶
func (c *Client) DeleteServerComponentFirmware(ctx context.Context, firmware ComponentFirmwareVersion) (*ServerResponse, error)
DeleteServerComponentFirmware will attempt to delete firmware and return an error on failure
func (*Client) DeleteServerComponentFirmwareSet ¶
func (c *Client) DeleteServerComponentFirmwareSet(ctx context.Context, firmwareSetID uuid.UUID) (*ServerResponse, error)
DeleteServerComponentFirmwareSet will attempt to delete a firmware set and return an error on failure
func (*Client) DeleteServerComponents ¶
func (c *Client) DeleteServerComponents(ctx context.Context, srvUUID uuid.UUID) (*ServerResponse, error)
DeleteServerComponents will delete all components for the given server identifier.
func (*Client) DeleteServerStatus ¶ added in v1.20.2
func (c *Client) DeleteServerStatus(ctx context.Context, serverID uuid.UUID) (*ServerResponse, error)
DeleteServerStatus deletes a server status record
func (*Client) GetComponentCapability ¶ added in v1.20.2
func (c *Client) GetComponentCapability(ctx context.Context, componentID uuid.UUID) (*ComponentCapability, *ServerResponse, error)
GetComponentCapability retrieves a component capability by component ID and capability name
func (*Client) GetComponentMetadata ¶ added in v1.20.2
func (c *Client) GetComponentMetadata(ctx context.Context, componentID uuid.UUID, namespace string) (*ComponentMetadata, *ServerResponse, error)
GetComponentMetadata retrieves a component metadata by component ID and namespace
func (*Client) GetComponentStatus ¶ added in v1.20.2
func (c *Client) GetComponentStatus(ctx context.Context, componentID uuid.UUID) (*ComponentStatus, *ServerResponse, error)
GetComponentStatus retrieves a component status by component ID
func (*Client) GetComponents ¶
func (c *Client) GetComponents(ctx context.Context, srvUUID uuid.UUID, params *ServerComponentGetParams) (ServerComponentSlice, *ServerResponse, error)
GetComponents will get all the components for a given server
func (*Client) GetCredential ¶
func (c *Client) GetCredential(ctx context.Context, srvUUID uuid.UUID, secretSlug string) (*ServerCredential, *ServerResponse, error)
GetCredential will return the secret for the secret type for the given server UUID
func (*Client) GetHardwareModel ¶ added in v1.20.1
func (c *Client) GetHardwareModel(ctx context.Context, name string) (*HardwareModel, *ServerResponse, error)
GetHardwareModel retrieves a hardware vendor model record
func (*Client) GetHardwareVendor ¶ added in v1.20.1
func (c *Client) GetHardwareVendor(ctx context.Context, name string) (*HardwareVendor, *ServerResponse, error)
GetHardwareVendor retrieves a hardware vendor record by its name
func (*Client) GetHistoryByID ¶
func (c *Client) GetHistoryByID(ctx context.Context, evtID uuid.UUID) ([]*Event, *ServerResponse, error)
GetHistoryByID returns the details of the event with the given ID
func (*Client) GetInstalledFirmware ¶ added in v1.20.1
func (c *Client) GetInstalledFirmware(ctx context.Context, componentID uuid.UUID) (*InstalledFirmware, *ServerResponse, error)
GetInstalledFirmware retrieves a server component firmware installed record by the componentID
func (*Client) GetServer ¶ added in v1.20.2
func (c *Client) GetServer(ctx context.Context, srvUUID uuid.UUID, params *ServerQueryParams) (*Server, *ServerResponse, error)
GetServer will return a server by it's UUID
func (*Client) GetServerBMC ¶ added in v1.20.1
func (c *Client) GetServerBMC(ctx context.Context, serverID uuid.UUID) (*ServerBMC, *ServerResponse, error)
GetServerBMC retrieves a server's BMC record
func (*Client) GetServerBiosConfigSet ¶
GetServerBiosConfigSet will retrieve the BiosConfigSet referred to by the given ID if found
func (*Client) GetServerComponentFirmware ¶
func (c *Client) GetServerComponentFirmware(ctx context.Context, fwUUID uuid.UUID) (*ComponentFirmwareVersion, *ServerResponse, error)
GetServerComponentFirmware will return a firmware by its UUID
func (*Client) GetServerComponentFirmwareSet ¶
func (c *Client) GetServerComponentFirmwareSet(ctx context.Context, fwSetUUID uuid.UUID) (*ComponentFirmwareSet, *ServerResponse, error)
GetServerComponentFirmwareSet will return a firmware by its UUID
func (*Client) GetServerEvents ¶
func (c *Client) GetServerEvents(ctx context.Context, srvID uuid.UUID, params *PaginationParams) ([]*Event, *ServerResponse, error)
GetServerEvents returns the most recent events for the given server ID
func (*Client) GetServerStatus ¶ added in v1.20.2
func (c *Client) GetServerStatus(ctx context.Context, serverID uuid.UUID) (*ServerStatus, *ServerResponse, error)
GetServerStatus retrieves a server status by server ID
func (*Client) InitComponentCollection ¶ added in v1.20.2
func (c *Client) InitComponentCollection(ctx context.Context, srvUUID uuid.UUID, components ServerComponentSlice, collectionMethod CollectionMethod) (*ServerResponse, error)
InitComponentCollection is to be called to initialize component and relational records for a server This will only create component records only if none already exist collectionMethod is one of inband/outofband
note: The {Report,Accept}ComponentChanges methods are used to add/delete components
func (*Client) ListComponentMetadata ¶ added in v1.20.2
func (c *Client) ListComponentMetadata(ctx context.Context, componentID uuid.UUID, namespace string) ([]*ComponentMetadata, *ServerResponse, error)
ListComponentMetadata lists all component metadata records componentID and namespace are optional filters
func (*Client) ListComponentStatus ¶ added in v1.20.2
func (c *Client) ListComponentStatus(ctx context.Context) ([]*ComponentStatus, *ServerResponse, error)
ListComponentStatus lists all component status records
func (*Client) ListComponents ¶
func (c *Client) ListComponents(ctx context.Context, params *ServerComponentListParams) (ServerComponentSlice, *ServerResponse, error)
ListComponents will get all the components matching the given parameters
func (*Client) ListHardwareModels ¶ added in v1.20.1
func (c *Client) ListHardwareModels(ctx context.Context) ([]*HardwareModel, *ServerResponse, error)
ListHardwareModels lists hardware vendor model records
func (*Client) ListHardwareVendors ¶ added in v1.20.1
func (c *Client) ListHardwareVendors(ctx context.Context) ([]*HardwareVendor, *ServerResponse, error)
ListHardwareVendors lists hardware vendor records
func (*Client) ListInstalledFirmware ¶ added in v1.20.1
func (c *Client) ListInstalledFirmware(ctx context.Context) ([]*InstalledFirmware, *ServerResponse, error)
ListInstalledFirmware lists server component firmware installed records
func (*Client) ListServerBiosConfigSet ¶
func (c *Client) ListServerBiosConfigSet(ctx context.Context, params *BiosConfigSetListParams) (*ServerResponse, error)
ListServerBiosConfigSet will return a list of BiosConfigSets referred to by the given query. More details about querying at the type definition of BiosConfigSetListParams.
func (*Client) ListServerComponentFirmware ¶
func (c *Client) ListServerComponentFirmware(ctx context.Context, params *ComponentFirmwareVersionListParams) ([]ComponentFirmwareVersion, *ServerResponse, error)
ListServerComponentFirmware will return all firmwares with optional params to filter the results
func (*Client) ListServerComponentFirmwareSet ¶
func (c *Client) ListServerComponentFirmwareSet(ctx context.Context, params *ComponentFirmwareSetListParams) ([]ComponentFirmwareSet, *ServerResponse, error)
ListServerComponentFirmwareSet will return all firmwares with optional params to filter the results if AttributeListParams is defined then ignore the main struct fields (Vendor, Model, Labels) otherwise do the selection based on the Vendor, Model, Labelswill return all firmwares with optional params to filter the results vendor and model should be non-empty. arbitraryLabels is formatted as k1=v1,k2=v2,etc. To view the behavior of the default/latest label, please check https://fleet-docs.pages.equinixmetal.net/procedures/firmware-install/#firmware-sets
func (*Client) ListServerComponentTypes ¶
func (c *Client) ListServerComponentTypes(ctx context.Context, params *ServerComponentTypeListParams) (ServerComponentTypeSlice, *ServerResponse, error)
ListServerComponentTypes will return the server component types with optional params
func (*Client) ListServerCredentialTypes ¶
func (c *Client) ListServerCredentialTypes(ctx context.Context, params *PaginationParams) ([]ServerCredentialType, *ServerResponse, error)
ListServerCredentialTypes will return all server secret types
func (*Client) ListServerStatus ¶ added in v1.20.2
func (c *Client) ListServerStatus(ctx context.Context) ([]*ServerStatus, *ServerResponse, error)
ListServerStatus lists all server status records
func (*Client) ListServers ¶ added in v1.20.3
func (c *Client) ListServers(ctx context.Context, params *ServerQueryParams) ([]Server, *ServerResponse, error)
ListServers will return all servers with optional params to filter the results
func (*Client) NextPage ¶
func (c *Client) NextPage(ctx context.Context, resp ServerResponse, recs interface{}) (*ServerResponse, error)
NextPage will update the server response with the next page of results
func (*Client) RemoveServerComponentFirmwareSetFirmware ¶
func (c *Client) RemoveServerComponentFirmwareSetFirmware(ctx context.Context, fwSetUUID uuid.UUID, firmwareSet ComponentFirmwareSetRequest) (*ServerResponse, error)
RemoveServerComponentFirmwareSetFirmware will update a firmware set by removing the mapping for the firmware id(s) passed in the firmwareSet parameter
func (*Client) ReportComponentChanges ¶ added in v1.20.2
func (c *Client) ReportComponentChanges(ctx context.Context, serverID string, change *ComponentChangeReport) (*ComponentChangeReportResponse, *ServerResponse, error)
ReportComponentChanges creates records for server component additions/deletes - these have to be accepted first
func (*Client) SetComponentCapability ¶ added in v1.20.2
func (c *Client) SetComponentCapability(ctx context.Context, capability []*ComponentCapability) (*ServerResponse, error)
SetComponentCapability creates or updates a component capability record
func (*Client) SetComponentMetadata ¶ added in v1.20.2
func (c *Client) SetComponentMetadata(ctx context.Context, metadata []*ComponentMetadata) (*ServerResponse, error)
SetComponentMetadata creates or updates a component metadata record
func (*Client) SetComponentStatus ¶ added in v1.20.2
func (c *Client) SetComponentStatus(ctx context.Context, componentStatus *ComponentStatus) (*ServerResponse, error)
SetComponentStatus creates or updates a component status record
func (*Client) SetCredential ¶
func (c *Client) SetCredential(ctx context.Context, srvUUID uuid.UUID, secretSlug, username, password string) (*ServerResponse, error)
SetCredential will set the secret for a given server UUID and secret type.
func (*Client) SetDumper ¶
SetDumper sets requests and responses to be written to the given writer (os.Stdout for example) to aid debugging.
func (*Client) SetInstalledFirmware ¶ added in v1.20.1
func (c *Client) SetInstalledFirmware(ctx context.Context, installedFirmware *InstalledFirmware) (*ServerResponse, error)
SetInstalledFirmware creates a server component installed firmware record - requires the component relation
func (*Client) SetServerStatus ¶ added in v1.20.2
func (c *Client) SetServerStatus(ctx context.Context, serverStatus *ServerStatus) (*ServerResponse, error)
SetServerStatus creates or updates a server status record
func (*Client) Update ¶
func (c *Client) Update(ctx context.Context, srvUUID uuid.UUID, srv Server) (*ServerResponse, error)
Update will to update a server with the new values passed in
func (*Client) UpdateComponentCollection ¶ added in v1.20.2
func (c *Client) UpdateComponentCollection(ctx context.Context, srvUUID uuid.UUID, components ServerComponentSlice, collectionMethod CollectionMethod) (*ServerResponse, error)
UpdateComponentCollection will update existing component and related records for a server - this will not delete any or add any components.
note: The {Report,Accept}ComponentChanges methods are used to add/delete components
func (*Client) UpdateComponentFirmwareSetRequest ¶
func (c *Client) UpdateComponentFirmwareSetRequest(ctx context.Context, fwSetUUID uuid.UUID, firmwareSet ComponentFirmwareSetRequest) (*ServerResponse, error)
UpdateComponentFirmwareSetRequest will add a firmware set with the new firmware id(s) passed in the firmwareSet parameter
func (*Client) UpdateEvent ¶
UpdateEvent adds a new event to the event history
func (*Client) UpdateServerBiosConfigSet ¶
func (c *Client) UpdateServerBiosConfigSet(ctx context.Context, id uuid.UUID, set BiosConfigSet) (*ServerResponse, error)
UpdateServerBiosConfigSet will update a config set.
func (*Client) UpdateServerComponentFirmware ¶
func (c *Client) UpdateServerComponentFirmware(ctx context.Context, fwUUID uuid.UUID, firmware ComponentFirmwareVersion) (*ServerResponse, error)
UpdateServerComponentFirmware will to update a firmware with the new values passed in
func (*Client) ValidateFirmwareSet ¶
func (c *Client) ValidateFirmwareSet(ctx context.Context, srvID, fwSetID uuid.UUID, on time.Time) error
ValidateFirmwareSet inserts or updates a record containing facts about the validation of this particular firmware set. On a successful execution the API returns 204 (http.StatusNoContent), so there is nothing useful to put into a ServerResponse.
type ClientError ¶
type ClientError struct {
Message string
}
ClientError is returned when invalid arguments are provided to the client
func (*ClientError) Error ¶
func (e *ClientError) Error() string
Error returns the ClientError in string format
type ClientInterface ¶
type ClientInterface interface {
Create(context.Context, Server) (*uuid.UUID, *ServerResponse, error)
Delete(context.Context, Server) (*ServerResponse, error)
Get(context.Context, uuid.UUID) (*Server, *ServerResponse, error)
ListServers(context.Context, *ServerQueryParams) ([]Server, *ServerResponse, error)
Update(context.Context, uuid.UUID, Server) (*ServerResponse, error)
GetComponents(context.Context, uuid.UUID, *PaginationParams) ([]ServerComponent, *ServerResponse, error)
ListComponents(context.Context, *ServerComponentListParams) ([]ServerComponent, *ServerResponse, error)
CreateComponents(context.Context, uuid.UUID, ServerComponentSlice) (*ServerResponse, error)
UpdateComponents(context.Context, uuid.UUID, ServerComponentSlice) (*ServerResponse, error)
DeleteServerComponents(context.Context, uuid.UUID) (*ServerResponse, error)
CreateServerComponentFirmware(context.Context, ComponentFirmwareVersion) (*uuid.UUID, *ServerResponse, error)
DeleteServerComponentFirmware(context.Context, ComponentFirmwareVersion) (*ServerResponse, error)
GetServerComponentFirmware(context.Context, uuid.UUID) (*ComponentFirmwareVersion, *ServerResponse, error)
ListServerComponentFirmware(context.Context, *ComponentFirmwareVersionListParams) ([]ComponentFirmwareVersion, *ServerResponse, error)
UpdateServerComponentFirmware(context.Context, uuid.UUID, ComponentFirmwareVersion) (*ServerResponse, error)
CreateServerComponentFirmwareSet(context.Context, ComponentFirmwareSetRequest) (*uuid.UUID, *ServerResponse, error)
UpdateComponentFirmwareSetRequest(context.Context, ComponentFirmwareSetRequest) (*uuid.UUID, *ServerResponse, error)
GetServerComponentFirmwareSet(context.Context, uuid.UUID) (*ComponentFirmwareSet, *ServerResponse, error)
ListServerComponentFirmwareSet(context.Context, *ComponentFirmwareSetListParams) ([]ComponentFirmwareSet, *ServerResponse, error)
ListFirmwareSets(context.Context, *ComponentFirmwareSetListParams) ([]ComponentFirmwareSet, *ServerResponse, error)
DeleteServerComponentFirmwareSet(context.Context, uuid.UUID) (*ServerResponse, error)
ValidateFirmwareSet(context.Context, uuid.UUID, uuid.UUID, time.Time) error
GetCredential(context.Context, uuid.UUID, string) (*ServerCredential, *ServerResponse, error)
SetCredential(context.Context, uuid.UUID, string, string) (*ServerResponse, error)
DeleteCredential(context.Context, uuid.UUID, string) (*ServerResponse, error)
ListServerCredentialTypes(context.Context) (*ServerResponse, error)
GetHistoryByID(context.Context, uuid.UUID) (*Event, *ServerResponse, error)
GetServerEvents(context.Context, uuid.UUID) ([]*Event, *ServerResponse, error)
UpdateEvent(context.Context, *Event) (*ServerResponse, error)
CreateServerBiosConfigSet(context.Context, BiosConfigSet) (*uuid.UUID, *ServerResponse, error)
GetServerBiosConfigSet(context.Context, uuid.UUID) (*BiosConfigSet, *ServerResponse, error)
DeleteServerBiosConfigSet(context.Context, uuid.UUID) (*ServerResponse, error)
ListServerBiosConfigSet(context.Context) (*ServerResponse, error)
UpdateServerBiosConfigSet(context.Context, uuid.UUID, BiosConfigSet) (*ServerResponse, error)
CreateHardwareVendor(context.Context, *HardwareVendor) (*ServerResponse, error)
GetHardwareVendor(context.Context, string) (*HardwareVendor, *ServerResponse, error)
ListHardwareVendors(context.Context) ([]*HardwareVendor, *ServerResponse, error)
DeleteHardwareVendor(context.Context, string) (*ServerResponse, error)
CreateHardwareModel(context.Context, *HardwareModel) (*ServerResponse, error)
GetHardwareModel(context.Context, string) (*HardwareModel, *ServerResponse, error)
ListHardwareModels(context.Context) ([]*HardwareModel, *ServerResponse, error)
DeleteHardwareModel(context.Context, string) (*ServerResponse, error)
}
ClientInterface provides an interface for the expected calls to interact with a fleetdb api
type CollectionMethod ¶ added in v1.20.2
type CollectionMethod string
CollectionMethod indicates how the data was collected
var ( // Inband identifies data collected through the ironlib image running on the host OS Inband CollectionMethod = "inband" // Outofband identifies data collected through the host BMC Outofband CollectionMethod = "outofband" ErrSlugs = errors.New("component slug error") )
type ComparisonOperator ¶ added in v1.20.3
type ComparisonOperator string
type ComponentCapability ¶ added in v1.20.2
type ComponentCapability struct {
ID uuid.UUID `json:"id,omitempty"`
ServerComponentID uuid.UUID `json:"server_component_id,omitempty" binding:"required"`
ComponentName string `json:"component_name"`
Name string `json:"name" binding:"required"`
Description string `json:"description" binding:"required"`
Enabled bool `json:"enabled"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
func CompareCapabilitySlices ¶ added in v1.20.2
func CompareCapabilitySlices(existing, incoming []*ComponentCapability) (creates, updates, deletes []*ComponentCapability)
CompareCapabilitySlices compares slices of ComponentCapability using Name as the key and checks Description and Enabled fields for changes
func (*ComponentCapability) Equals ¶ added in v1.20.2
func (c *ComponentCapability) Equals(b *ComponentCapability) bool
Equals compares two ComponentCapabilities focusing on required fields
type ComponentChangeAccept ¶ added in v1.20.2
type ComponentChangeAccept struct {
ChangeIDs []string `json:"change_ids" binding:"required"` // ChangeIDs for which component changes are to be merged
}
ComponentChangeAccept is the payload sent by the client to merge component add/deletes records
type ComponentChangeReport ¶ added in v1.20.2
type ComponentChangeReport struct {
CollectionMethod string `json:"collection_method" binding:"required"` // inband OR outofband
Creates []*ServerComponent `json:"creates,omitempty"` // Components to be added
Deletes []*ServerComponent `json:"deletes,omitempty"` // Components to be removed
}
ComponentChangeReport represents addition/removal of server components to or from an existing set.
An inventory client submits component changes when a server has existing component records, the changes submitted here are stored in the component_change_review table and once reviewed by an operator or automation, they can be merged.
type ComponentChangeReportResponse ¶ added in v1.20.2
type ComponentFirmwareSet ¶
type ComponentFirmwareSet struct {
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Name string `json:"name"`
// TODO: remove the dependency on attributes and purge attributes storage
Attributes []Attributes `json:"attributes"`
ComponentFirmware []ComponentFirmwareVersion `json:"component_firmware"`
UUID uuid.UUID `json:"uuid"`
}
ComponentFirmwareSet represents a group of firmwares
type ComponentFirmwareSetListParams ¶
type ComponentFirmwareSetListParams struct {
Name string `form:"name"`
Vendor string `form:"vendor"`
Model string `form:"model"`
Labels string `form:"labels"`
Pagination *PaginationParams
AttributeListParams []AttributeListParams
}
ComponentFirmwareSetListParams allows you to filter the results
type ComponentFirmwareSetRequest ¶
type ComponentFirmwareSetRequest struct {
Name string `json:"name"`
Attributes []Attributes `json:"attributes"`
ComponentFirmwareUUIDs []string `json:"component_firmware_uuids"`
ID uuid.UUID `json:"uuid"`
}
ComponentFirmwareSetRequest represents the payload to create a firmware set
type ComponentFirmwareVersion ¶
type ComponentFirmwareVersion struct {
UUID uuid.UUID `json:"uuid"`
Vendor string `json:"vendor" binding:"required,lowercase"`
Model []string `json:"model" binding:"required"`
Filename string `json:"filename" binding:"required"`
Version string `json:"version" binding:"required"`
Component string `json:"component" binding:"required,lowercase"`
Checksum string `json:"checksum" binding:"required,lowercase"`
UpstreamURL string `json:"upstream_url" binding:"required"`
RepositoryURL string `json:"repository_url" binding:"required"`
// The client has to always explicitly set this to true or false
// for this to work with the validator, it needs to be a bool.
InstallInband *bool `json:"install_inband" binding:"required"`
OEM *bool `json:"oem" binding:"required"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
ComponentFirmwareVersion represents a firmware file
type ComponentFirmwareVersionListParams ¶
type ComponentFirmwareVersionListParams struct {
Vendor string `form:"vendor"`
Model []string `form:"model"`
Version string `form:"version"`
Filename string `form:"filename"`
Checksum string `form:"checksum"`
Component string `form:"component"`
Pagination *PaginationParams
}
ComponentFirmwareVersionListParams allows you to filter the results
type ComponentMetadata ¶ added in v1.20.2
type ComponentMetadata struct {
ID uuid.UUID `json:"id,omitempty"`
ServerComponentID uuid.UUID `json:"server_component_id,omitempty" binding:"required"`
ComponentName string `json:"component_name,omitempty"`
Namespace string `json:"namespace" binding:"required"`
Data types.JSON `json:"data" binding:"required"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
func CompareMetadataSlices ¶ added in v1.20.2
func CompareMetadataSlices(existing, incoming []*ComponentMetadata) (creates, updates, deletes []*ComponentMetadata)
Compare metdata data slices for changes
func (*ComponentMetadata) Equals ¶ added in v1.20.2
func (c *ComponentMetadata) Equals(b *ComponentMetadata) bool
Equals compares two ComponentMetadata
type ComponentSlugMap ¶ added in v1.20.2
type ComponentSlugMap map[string]*ServerComponentType
ComponentSlugMap holds a lookup map for component slug to component type objs
type ComponentStatus ¶ added in v1.20.2
type ComponentStatus struct {
ID uuid.UUID `json:"id,omitempty"`
ServerComponentID uuid.UUID `json:"server_component_id,omitempty"`
ComponentName string `json:"component_name,omitempty"`
Health string `json:"health" binding:"required"`
State string `json:"state" binding:"required"`
Info string `json:"info"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
func (*ComponentStatus) Equals ¶ added in v1.20.2
func (c *ComponentStatus) Equals(b *ComponentStatus) bool
Equals compares two ComponentStatus
type Converter ¶ added in v1.20.2
type Converter struct {
CollectionMethod CollectionMethod
// contains filtered or unexported fields
}
Converter converts from the common.Device type to the fleetdbapi Server,Component types
This is an exported type to enable fleetdbapi clients to publish server inventory data.
func NewComponentConverter ¶ added in v1.20.2
func NewComponentConverter(method CollectionMethod, slugs ComponentSlugMap, skipSlugCheck bool) *Converter
Initializes and returns a new common.Device to fleetdbapi.Server converter
skipSlugCheck when set will cause the convertor to not verify the components are of a valid ComponentSlugType in fleetdbapi this check should not be disabled for when the converted inventory has to be stored in fleetdb.
type Event ¶
type Event struct {
EventID uuid.UUID `json:"event_id" binding:"required,uuid4_rfc4122"`
Type string `json:"event_type" binding:"required"`
Start time.Time `json:"event_start" binding:"required,ltfield=End"`
End time.Time `json:"event_end" binding:"required,gtfield=Start"`
Target uuid.UUID `json:"target_server" binding:"required,uuid4_rfc4122"`
Parameters json.RawMessage `json:"parameters,omitempty" binding:"-"`
FinalState string `json:"final_state" binding:"required"`
FinalStatus json.RawMessage `json:"final_status,omitempty" binding:"-"`
}
type Filter ¶ added in v1.20.3
type Filter struct {
Attribute string // the left hand side parameter
ComparisonOperator ComparisonOperator // The comparison operator
Modifier Modifier // The string match modifier
Value string // The value
}
Filter represents a query parameter
type FilterParams ¶ added in v1.20.3
type FilterParams struct {
// type that implements the FilterTarget interface
Target FilterTarget
// Filters to apply
Filters []Filter
// Apply a logical operation on the given Filters
LogicalOperation []string // odd elements are FilterableColumns, even are operators
}
func (*FilterParams) LogicalOperatorFor ¶ added in v1.20.3
func (s *FilterParams) LogicalOperatorFor(a, b string) LogicalOperator
Helper method that returns the logical operator specified for the given two attributes method assumes the LogicalOperation is validated
type FilterTarget ¶ added in v1.20.3
type FilterTarget interface {
// FilterableColumnNames is the list of column names a client is allowed to create filters on
FilterableColumnNames() []string
}
A type that implements the FilterTarget is required to be passed into FilterParams
type FirmwareSetValidation ¶
type HardwareModel ¶ added in v1.20.1
type HardwareVendor ¶ added in v1.20.1
type InstalledFirmware ¶ added in v1.20.1
type InstalledFirmware struct {
ID uuid.UUID `json:"id,omitempty"`
ServerComponentID uuid.UUID `json:"server_component_id,omitempty"`
ServerComponentName string `json:"server_component_name,omitempty"`
Version string `json:"version" binding:"required"`
Current bool `json:"current"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
func (*InstalledFirmware) Equals ¶ added in v1.20.2
func (t *InstalledFirmware) Equals(b *InstalledFirmware) bool
type Link ¶
type Link struct {
Href string `json:"href,omitempty"`
}
Link represents an address to a page
type LogicalOperator ¶ added in v1.20.3
type LogicalOperator string
type OperatorComparitorType ¶
type OperatorComparitorType string
OperatorComparitorType is used to control what kind of search is performed for any query. (preferrable option being UINTS)
type OperatorLogicalType ¶
type OperatorLogicalType string
OperatorLogicalType is used to define how to group a query with other queries. Ex: (query expression) AND (query expression) OR (query expression)
const ( // OperatorLogicalOR informs the SQL Builder to use OR when adding the param to the SQL Query. Making it Inclusive OperatorLogicalOR OperatorLogicalType = "or" // OperatorLogicalAND informs the SQL Builder to use AND when adding the param to the SQL Query. Making it Explicitly Inclusive OperatorLogicalAND = "and" )
TODO; Should these just be ints?
type PaginationParams ¶
type PaginationParams struct {
Limit int `json:"limit,omitempty"`
Page int `json:"page,omitempty"`
Cursor string `json:"cursor,omitempty"`
Preload bool `json:"preload,omitempty"`
OrderBy string `json:"orderby,omitempty"`
}
PaginationParams allow you to paginate the results. Some tables can have multiple preloadable child tables. Set Preload to true to load them. TODO; Preload should probably be moved over to the params of each individual endpoint. Example: ServerListParams.
type Router ¶
type Router struct {
AuthMW *ginauth.MultiTokenMiddleware
DB *sqlx.DB
SecretsKeeper *secrets.Keeper
Logger *zap.Logger
}
Router provides a router for the v1 API
func (*Router) Routes ¶
func (r *Router) Routes(rg *gin.RouterGroup)
Routes will add the routes for this API version to a router group
nolint:gocritic // TODO: split code handler into directories and move route blocks in there
type Server ¶
type Server struct {
UUID uuid.UUID `json:"uuid"`
Name string `json:"name"`
FacilityCode string `json:"facility_code" binding:"required"`
Vendor string `json:"vendor" binding:"required"`
Model string `json:"model"`
Serial string `json:"serial"`
BMC *ServerBMC `json:"bmc,omitempty"`
Components []*ServerComponent `json:"components"`
Status *ServerStatus `json:"status"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
// DeletedAt is a pointer to a Time in order to be able to support checks for nil time
DeletedAt *time.Time `json:"deleted_at,omitempty"`
// InventoryRefreshedAt indicates the last time the server inventory was collected
InventoryRefreshedAt time.Time `json:"inventory_refreshed_at"`
}
Server represents a server in a facility
func (*Server) FilterableColumnNames ¶ added in v1.20.3
FilterableComlumnNames implements the FilterTarget interface and returns the columns the Server object is allowed to be filtered on.
type ServerBMC ¶ added in v1.20.1
type ServerBMC struct {
ID uuid.UUID `json:"id"`
ServerID uuid.UUID `json:"server_id" binding:"required,uuid"` // Note: binding attributes should not have spaces
HardwareVendorName string `json:"hardware_vendor_name" binding:"required"`
HardwareVendorID string `json:"-"`
HardwareModelName string `json:"hardware_model_name" binding:"required"`
HardwareModelID string `json:"-"`
Username string `json:"username" binding:"required"`
Password string `json:"password" binding:"required"`
IPAddress string `json:"ipaddress" binding:"required,ip"`
MacAddress string `json:"macaddress" binding:"mac"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type ServerComponent ¶
type ServerComponent struct {
UUID uuid.UUID `json:"uuid"`
ServerUUID uuid.UUID `json:"server_uuid" binding:"required"`
Name string `json:"name" binding:"required"` // name is the component slug
Vendor string `json:"vendor"`
Model string `json:"model"`
Serial string `json:"serial" binding:"required"`
Description string `json:"description"`
ServerComponentTypeID string `json:"server_component_type_id,omitempty"`
Metadata []*ComponentMetadata `json:"metadata,omitempty"`
Capabilities []*ComponentCapability `json:"capabilities,omitempty"`
InstalledFirmware *InstalledFirmware `json:"firmware,omitempty"`
Status *ComponentStatus `json:"status,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
ServerComponent represents a component of a server. These can be things like processors, NICs, hard drives, etc.
Note: when setting validator struct tags, ensure no extra spaces are present between
comma separated values or validation will fail with a not so useful 500 error.
func ServerComponentFromModel ¶ added in v1.20.2
func ServerComponentFromModel(dbC *models.ServerComponent) *ServerComponent
func (*ServerComponent) Equals ¶ added in v1.20.2
func (c *ServerComponent) Equals(b *ServerComponent) (string, bool)
Equals compares ServerComponents, excluding certain fields and timestamps
nolint:gocyclo // this is fine
type ServerComponentGetParams ¶ added in v1.20.2
type ServerComponentGetParams struct {
InstalledFirmware bool // include installed firmware
Status bool // include status, health
Capabilities bool // include capabilities
Metadata []string // include metadata identified by the namespace
Pagination *PaginationParams
}
Set fields in this struct to for additional data to be included in the response
type ServerComponentListParams ¶
type ServerComponentListParams struct {
Name string
Vendor string
Model string
Serial string
ServerComponentType string
AttributeListParams []AttributeListParams
VersionedAttributeListParams []AttributeListParams
Pagination *PaginationParams
}
ServerComponentListParams allows you to filter the results by server components
type ServerComponentSlice ¶
type ServerComponentSlice []*ServerComponent
ServerComponentSlice is a slice of ServerComponent objects
func (ServerComponentSlice) AsMap ¶ added in v1.20.5
func (s ServerComponentSlice) AsMap() map[string]*ServerComponent
AsMap returns the slice as a map with the items keyed by the name:serial
func (ServerComponentSlice) Compare ¶ added in v1.20.2
func (s ServerComponentSlice) Compare(incomming ServerComponentSlice) (creates, updates, deletes ServerComponentSlice)
type ServerComponentType ¶
type ServerComponentType struct {
ID string `json:"id"`
Name string `json:"name"`
Slug string `json:"slug"`
}
ServerComponentType provides a way to group server components by the type
type ServerComponentTypeListParams ¶
type ServerComponentTypeListParams struct {
Name string
PaginationParams *PaginationParams
}
ServerComponentTypeListParams allows you to filter the results
type ServerComponentTypeSlice ¶
type ServerComponentTypeSlice []*ServerComponentType
ServerComponentTypeSlice is a slice of the ServerComponentType
func (ServerComponentTypeSlice) ByID ¶
func (ts ServerComponentTypeSlice) ByID(id string) *ServerComponentType
ByID returns the ServerComponentType matched by its ID field value
func (ServerComponentTypeSlice) ByName ¶
func (ts ServerComponentTypeSlice) ByName(name string) *ServerComponentType
ByName returns the ServerComponentType matched by its Name field value
func (ServerComponentTypeSlice) BySlug ¶
func (ts ServerComponentTypeSlice) BySlug(slug string) *ServerComponentType
BySlug returns the ServerComponentType matched by its Slug field value
type ServerCredential ¶
type ServerCredential struct {
ServerID uuid.UUID `json:"uuid,omitempty"`
SecretType string `json:"secret_type"`
Password string `json:"password"`
Username string `json:"username"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
ServerCredential provides a way to encrypt secrets about a server in the database
type ServerCredentialType ¶
type ServerCredentialType struct {
Name string `json:"name"`
Slug string `json:"slug"`
Builtin bool `json:"builtin"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
ServerCredentialType represents a type of server secret. There are some built in default secret types, for example a type exists for BMC passwords.
type ServerError ¶
type ServerError struct {
Message string `json:"message"`
ErrorMessage string `json:"error"`
StatusCode int
}
ServerError is returned when the client receives an error back from the server
func (ServerError) Error ¶
func (e ServerError) Error() string
Error returns the ServerError in string format
type ServerQueryParams ¶ added in v1.20.4
type ServerQueryParams struct {
// serverInclude BMC attributes, including credentials
IncludeBMC bool
// serverInclude server status attributes
IncludeStatus bool
// serverInclude components
IncludeComponents bool
// Component serverInclude parameters
//
// requires Components set to true
ComponentParams *ServerComponentGetParams
// FilterParams applies to queries listing more than one server
FilterParams *FilterParams
// ParginationParams applies to queries listing more than one server
PaginationParams *PaginationParams
}
ServerQueryParams allows you to filter server results and specify what related data to serverInclude.
TODO: move serverInclude params into its own type? Generalize IncludeParams into its own type Have Servers implement a Includable() method that returns the various serverInclude feilds - similar to the FilterTarget interface
type ServerResponse ¶
type ServerResponse struct {
PageSize int `json:"page_size,omitempty"`
Page int `json:"page,omitempty"`
PageCount int `json:"page_count,omitempty"`
TotalPages int `json:"total_pages,omitempty"`
TotalRecordCount int64 `json:"total_record_count,omitempty"`
Links ServerResponseLinks `json:"_links,omitempty"`
Message string `json:"message,omitempty"`
Error string `json:"error,omitempty"`
Slug string `json:"slug,omitempty"`
Data interface{} `json:"data,omitempty"` // data is not a DB record/records, but is structured
Record interface{} `json:"record,omitempty"`
Records interface{} `json:"records,omitempty"`
}
ServerResponse represents the data that the server will return on any given call
func (*ServerResponse) HasNextPage ¶
func (r *ServerResponse) HasNextPage() bool
HasNextPage will return if there are additional resources to load on additional pages
type ServerResponseLinks ¶
type ServerResponseLinks struct {
Self *Link `json:"self,omitempty"`
First *Link `json:"first,omitempty"`
Previous *Link `json:"previous,omitempty"`
Next *Link `json:"next,omitempty"`
Last *Link `json:"last,omitempty"`
}
ServerResponseLinks represent links that could be returned on a page
type ServerStatus ¶ added in v1.20.2
type ServerStatus struct {
ID uuid.UUID `json:"id"`
ServerID uuid.UUID `json:"server_id" binding:"required"`
ServerName string `json:"server_name"`
Health string `json:"health" binding:"required"`
State string `json:"state" binding:"required"`
Info string `json:"info"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Source Files
¶
- attribute_list_params.go
- attributes.go
- bios_config_component.go
- bios_config_component_params.go
- bios_config_set.go
- bios_config_set_params.go
- bios_config_setting.go
- bios_config_setting_params.go
- client.go
- client_methods.go
- component_capability.go
- component_change_report.go
- component_converter.go
- component_metadata.go
- component_status.go
- doc.go
- errors.go
- firmware.go
- firmware_list_params.go
- firmware_set.go
- firmware_set_list_params.go
- installed_firmware.go
- pagination.go
- query_filters.go
- query_operators.go
- requests.go
- router.go
- router_bios_config_set.go
- router_events.go
- router_firmware.go
- router_firmware_set.go
- router_hardware_models.go
- router_hardware_vendors.go
- router_responses.go
- router_server_bmc.go
- router_server_component_type.go
- router_server_secret_types.go
- router_server_secrets.go
- server.go
- server_component_get_params.go
- server_component_list_params.go
- server_component_type.go
- server_component_type_list_params.go
- server_component_type_service.go
- server_components.go
- server_query_params.go
- server_secret.go
- server_secret_type.go
- server_status.go