Documentation ¶
Overview ¶
Package serverservice provides the v1 api for the server service
Index ¶
- Constants
- Variables
- func NewCreateServerMessage(srv *models.Server) ([]byte, error)
- type AocMacAddressBom
- type AttributeListParams
- type AttributeOperatorType
- type Attributes
- type BmcMacAddressBom
- type Bom
- type Client
- func (c *Client) BillOfMaterialsBatchUpload(ctx context.Context, boms []Bom) (*ServerResponse, error)
- func (c *Client) Create(ctx context.Context, srv Server) (*uuid.UUID, *ServerResponse, error)
- func (c *Client) CreateAttributes(ctx context.Context, srvUUID uuid.UUID, attr Attributes) (*ServerResponse, error)
- func (c *Client) CreateComponents(ctx context.Context, srvUUID uuid.UUID, components ServerComponentSlice) (*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) CreateVersionedAttributes(ctx context.Context, srvUUID uuid.UUID, va VersionedAttributes) (*ServerResponse, error)
- func (c *Client) Delete(ctx context.Context, srv Server) (*ServerResponse, error)
- func (c *Client) DeleteAttributes(ctx context.Context, srvUUID uuid.UUID, ns string) (*ServerResponse, error)
- func (c *Client) DeleteCredential(ctx context.Context, srvUUID uuid.UUID, secretSlug string) (*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) Get(ctx context.Context, srvUUID uuid.UUID) (*Server, *ServerResponse, error)
- func (c *Client) GetAttributes(ctx context.Context, srvUUID uuid.UUID, ns string) (*Attributes, *ServerResponse, error)
- func (c *Client) GetBomInfoByAOCMacAddr(ctx context.Context, aocMacAddr string) (*Bom, *ServerResponse, error)
- func (c *Client) GetBomInfoByBMCMacAddr(ctx context.Context, bmcMacAddr string) (*Bom, *ServerResponse, error)
- func (c *Client) GetComponents(ctx context.Context, srvUUID uuid.UUID, params *PaginationParams) (ServerComponentSlice, *ServerResponse, error)
- func (c *Client) GetCredential(ctx context.Context, srvUUID uuid.UUID, secretSlug string) (*ServerCredential, *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) GetVersionedAttributes(ctx context.Context, srvUUID uuid.UUID, ns string) ([]VersionedAttributes, *ServerResponse, error)
- func (c *Client) List(ctx context.Context, params *ServerListParams) ([]Server, *ServerResponse, error)
- func (c *Client) ListAttributes(ctx context.Context, srvUUID uuid.UUID, params *PaginationParams) ([]Attributes, *ServerResponse, error)
- func (c *Client) ListComponents(ctx context.Context, params *ServerComponentListParams) (ServerComponentSlice, *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) ListVersionedAttributes(ctx context.Context, srvUUID uuid.UUID) ([]VersionedAttributes, *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) SetCredential(ctx context.Context, srvUUID uuid.UUID, secretSlug, username, password string) (*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) UpdateAttributes(ctx context.Context, srvUUID uuid.UUID, ns string, data json.RawMessage) (*ServerResponse, error)
- func (c *Client) UpdateComponentFirmwareSetRequest(ctx context.Context, fwSetUUID uuid.UUID, ...) (*ServerResponse, error)
- func (c *Client) UpdateComponents(ctx context.Context, srvUUID uuid.UUID, components ServerComponentSlice) (*ServerResponse, error)
- func (c *Client) UpdateServerComponentFirmware(ctx context.Context, fwUUID uuid.UUID, firmware ComponentFirmwareVersion) (*ServerResponse, error)
- type ClientError
- type ClientInterface
- type ComponentFirmwareSet
- type ComponentFirmwareSetListParams
- type ComponentFirmwareSetRequest
- type ComponentFirmwareVersion
- type ComponentFirmwareVersionListParams
- type CreateServer
- type Doer
- type Link
- type MsgMetadata
- type OperatorType
- type PaginationParams
- type Router
- type Server
- type ServerComponent
- type ServerComponentListParams
- type ServerComponentSlice
- type ServerComponentType
- type ServerComponentTypeListParams
- type ServerComponentTypeSlice
- type ServerCredential
- type ServerCredentialType
- type ServerError
- type ServerListParams
- type ServerResponse
- type ServerResponseLinks
- type VersionedAttributes
Constants ¶
const ( // OperatorEqual means the value has to match the keys exactly OperatorEqual OperatorType = "eq" // OperatorLike 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 OperatorLike = "like" // OperatorGreaterThan will convert the value at the given key to an int and return results that are greater than Value OperatorGreaterThan = "gt" // OperatorLessThan will convert the value at the given key to an int and return results that are less than Value OperatorLessThan = "lt" )
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") )
Functions ¶
Types ¶
type AocMacAddressBom ¶ added in v0.16.2
type AocMacAddressBom struct { AocMacAddress string `json:"aoc_mac_address"` SerialNum string `json:"serial_num"` }
AocMacAddressBom provides a struct to map the aoc_mac_address table.
type AttributeListParams ¶
type AttributeListParams struct { Namespace string Keys []string Operator OperatorType Value string // AttributeOperatorType is used to define how this AttributeListParam value should be SQL queried // this value defaults to AttributeLogicalAND. AttributeOperator AttributeOperatorType }
AttributeListParams allow you to filter the results based on attributes
type AttributeOperatorType ¶ added in v0.16.0
type AttributeOperatorType string
AttributeOperatorType is used to define how one or more AttributeListParam values should be SQL queried.
const ( // AttributeLogicalOR can be passed into a AttributeListParam to SQL select the attribute an OR clause. AttributeLogicalOR AttributeOperatorType = "or" // AttributeLogicalAND is the default attribute operator, it can be passed into a AttributeListParam to SQL select the attribute a AND clause. AttributeLogicalAND AttributeOperatorType = "and" )
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 BmcMacAddressBom ¶ added in v0.16.2
type BmcMacAddressBom struct { BmcMacAddress string `json:"bmc_mac_address"` SerialNum string `json:"serial_num"` }
BmcMacAddressBom provides a struct to map the bmc_mac_address table.
type Bom ¶ added in v0.16.2
type Bom struct { SerialNum string `json:"serial_num"` // physical serial number listed outside of a server AocMacAddress string `json:"aoc_mac_address"` // Aoc is alternative name of the fiber channel card MAC address BmcMacAddress string `json:"bmc_mac_address"` NumDefiPmi string `json:"num_defi_pmi"` NumDefPWD string `json:"num_def_pwd"` // DefPWD is the IPMI Password in the portal Metro string `json:"metro"` }
Bom provides a struct to map the bom_info table. Naming conversion is strange here just in order to make it consistent with generated BomInfo.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client has the ability to talk to a hollow server service api server running at the given URI
func NewClient ¶
NewClient will return a server service 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, _ := serverservice.NewClient("HOLLOW_URI", oauthConfig.Client(ctx))
func NewClientWithToken ¶ added in v0.12.0
NewClientWithToken will initialize a new hollow client with the given auth token and URL
func (*Client) BillOfMaterialsBatchUpload ¶ added in v0.16.2
func (c *Client) BillOfMaterialsBatchUpload(ctx context.Context, boms []Bom) (*ServerResponse, error)
BillOfMaterialsBatchUpload will attempt to write multiple boms to database.
func (*Client) Create ¶ added in v0.12.0
Create will attempt to create a server in Hollow and return the new server's UUID
func (*Client) CreateAttributes ¶ added in v0.12.0
func (c *Client) CreateAttributes(ctx context.Context, srvUUID uuid.UUID, attr Attributes) (*ServerResponse, error)
CreateAttributes will to create the given attributes for a given server
func (*Client) CreateComponents ¶ added in v0.13.5
func (c *Client) CreateComponents(ctx context.Context, srvUUID uuid.UUID, components ServerComponentSlice) (*ServerResponse, error)
CreateComponents will create given components for a given server
func (*Client) CreateServerComponentFirmware ¶ added in v0.13.5
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 ¶ added in v0.13.7
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 ¶ added in v0.12.0
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 ¶ added in v0.13.7
func (c *Client) CreateServerCredentialType(ctx context.Context, sType *ServerCredentialType) (*ServerResponse, error)
CreateServerCredentialType will create a new server secret type
func (*Client) CreateVersionedAttributes ¶ added in v0.12.0
func (c *Client) CreateVersionedAttributes(ctx context.Context, srvUUID uuid.UUID, va VersionedAttributes) (*ServerResponse, error)
CreateVersionedAttributes will create a new versioned attribute for a given server
func (*Client) Delete ¶ added in v0.12.0
Delete will attempt to delete a server in Hollow and return an error on failure
func (*Client) DeleteAttributes ¶ added in v0.12.0
func (c *Client) DeleteAttributes(ctx context.Context, srvUUID uuid.UUID, ns string) (*ServerResponse, error)
DeleteAttributes will attempt to delete attributes by server uuid and namespace return an error on failure
func (*Client) DeleteCredential ¶ added in v0.13.7
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) DeleteServerComponentFirmware ¶ added in v0.13.5
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 ¶ added in v0.13.7
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 ¶ added in v0.13.7
func (c *Client) DeleteServerComponents(ctx context.Context, srvUUID uuid.UUID) (*ServerResponse, error)
DeleteServerComponents will delete components for the given server identifier.
func (*Client) GetAttributes ¶ added in v0.12.0
func (c *Client) GetAttributes(ctx context.Context, srvUUID uuid.UUID, ns string) (*Attributes, *ServerResponse, error)
GetAttributes will get all the attributes in a namespace for a given server
func (*Client) GetBomInfoByAOCMacAddr ¶ added in v0.16.2
func (c *Client) GetBomInfoByAOCMacAddr(ctx context.Context, aocMacAddr string) (*Bom, *ServerResponse, error)
GetBomInfoByAOCMacAddr will return the bom info object by the aoc mac address.
func (*Client) GetBomInfoByBMCMacAddr ¶ added in v0.16.2
func (c *Client) GetBomInfoByBMCMacAddr(ctx context.Context, bmcMacAddr string) (*Bom, *ServerResponse, error)
GetBomInfoByBMCMacAddr will return the bom info object by the bmc mac address.
func (*Client) GetComponents ¶ added in v0.13.5
func (c *Client) GetComponents(ctx context.Context, srvUUID uuid.UUID, params *PaginationParams) (ServerComponentSlice, *ServerResponse, error)
GetComponents will get all the components for a given server
func (*Client) GetCredential ¶ added in v0.13.7
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) GetServerComponentFirmware ¶ added in v0.13.5
func (c *Client) GetServerComponentFirmware(ctx context.Context, fwUUID uuid.UUID) (*ComponentFirmwareVersion, *ServerResponse, error)
GetServerComponentFirmware will return a firmware by its UUID
func (*Client) GetServerComponentFirmwareSet ¶ added in v0.13.7
func (c *Client) GetServerComponentFirmwareSet(ctx context.Context, fwSetUUID uuid.UUID) (*ComponentFirmwareSet, *ServerResponse, error)
GetServerComponentFirmwareSet will return a firmware by its UUID
func (*Client) GetVersionedAttributes ¶ added in v0.12.0
func (c *Client) GetVersionedAttributes(ctx context.Context, srvUUID uuid.UUID, ns string) ([]VersionedAttributes, *ServerResponse, error)
GetVersionedAttributes will return all the versioned attributes for a given server
func (*Client) List ¶ added in v0.12.0
func (c *Client) List(ctx context.Context, params *ServerListParams) ([]Server, *ServerResponse, error)
List will return all servers with optional params to filter the results
func (*Client) ListAttributes ¶ added in v0.12.0
func (c *Client) ListAttributes(ctx context.Context, srvUUID uuid.UUID, params *PaginationParams) ([]Attributes, *ServerResponse, error)
ListAttributes will get all the attributes for a given server
func (*Client) ListComponents ¶ added in v0.12.0
func (c *Client) ListComponents(ctx context.Context, params *ServerComponentListParams) (ServerComponentSlice, *ServerResponse, error)
ListComponents will get all the components matching the given parameters
func (*Client) ListServerComponentFirmware ¶ added in v0.13.5
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 ¶ added in v0.13.7
func (c *Client) ListServerComponentFirmwareSet(ctx context.Context, params *ComponentFirmwareSetListParams) ([]ComponentFirmwareSet, *ServerResponse, error)
ListServerComponentFirmwareSet will return all firmwares with optional params to filter the results
func (*Client) ListServerComponentTypes ¶ added in v0.12.0
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 ¶ added in v0.13.7
func (c *Client) ListServerCredentialTypes(ctx context.Context, params *PaginationParams) ([]ServerCredentialType, *ServerResponse, error)
ListServerCredentialTypes will return all server secret types
func (*Client) ListVersionedAttributes ¶ added in v0.12.0
func (c *Client) ListVersionedAttributes(ctx context.Context, srvUUID uuid.UUID) ([]VersionedAttributes, *ServerResponse, error)
ListVersionedAttributes will return all the versioned attributes for a given server
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 ¶ added in v0.13.7
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) SetCredential ¶ added in v0.13.7
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) Update ¶ added in v0.12.0
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) UpdateAttributes ¶ added in v0.12.0
func (c *Client) UpdateAttributes(ctx context.Context, srvUUID uuid.UUID, ns string, data json.RawMessage) (*ServerResponse, error)
UpdateAttributes will to update the data stored in a given namespace for a given server
func (*Client) UpdateComponentFirmwareSetRequest ¶ added in v0.13.7
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) UpdateComponents ¶ added in v0.13.5
func (c *Client) UpdateComponents(ctx context.Context, srvUUID uuid.UUID, components ServerComponentSlice) (*ServerResponse, error)
UpdateComponents will update given components for a given server
func (*Client) UpdateServerComponentFirmware ¶ added in v0.13.5
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
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 ¶ added in v0.12.0
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) List(context.Context, *ServerListParams) ([]Server, *ServerResponse, error) Update(context.Context, uuid.UUID, Server) (*ServerResponse, error) CreateAttributes(context.Context, uuid.UUID, Attributes) (*ServerResponse, error) DeleteAttributes(ctx context.Context, u uuid.UUID, ns string) (*ServerResponse, error) GetAttributes(context.Context, uuid.UUID, string) (*Attributes, *ServerResponse, error) ListAttributes(context.Context, uuid.UUID, *PaginationParams) ([]Attributes, *ServerResponse, error) UpdateAttributes(ctx context.Context, u uuid.UUID, ns string, data json.RawMessage) (*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) CreateVersionedAttributes(context.Context, uuid.UUID, VersionedAttributes) (*ServerResponse, error) GetVersionedAttributes(context.Context, uuid.UUID, string) ([]VersionedAttributes, *ServerResponse, error) ListVersionedAttributes(context.Context, uuid.UUID) ([]VersionedAttributes, *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) DeleteServerComponentFirmwareSet(context.Context, uuid.UUID) (*ServerResponse, 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) BillOfMaterialsBatchUpload(context.Context, []Bom) (*ServerResponse, error) GetBomInfoByAOCMacAddr(context.Context, string) (*Bom, *ServerResponse, error) GetBomInfoByBMCMacAddr(context.Context, string) (*Bom, *ServerResponse, error) }
ClientInterface provides an interface for the expected calls to interact with a server service api
type ComponentFirmwareSet ¶ added in v0.13.7
type ComponentFirmwareSet struct { CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` Name string `json:"name"` Attributes []Attributes `json:"attributes"` ComponentFirmware []ComponentFirmwareVersion `json:"component_firmware"` UUID uuid.UUID `json:"uuid"` }
ComponentFirmwareSet represents a group of firmwares
type ComponentFirmwareSetListParams ¶ added in v0.13.7
type ComponentFirmwareSetListParams struct { Name string `form:"name"` Pagination *PaginationParams AttributeListParams []AttributeListParams }
ComponentFirmwareSetListParams allows you to filter the results
type ComponentFirmwareSetRequest ¶ added in v0.13.7
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 ¶ added in v0.13.5
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"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
ComponentFirmwareVersion represents a firmware file
type ComponentFirmwareVersionListParams ¶ added in v0.13.5
type ComponentFirmwareVersionListParams struct { Vendor string `form:"vendor"` Model []string `form:"model"` Version string `form:"version"` Filename string `form:"filename"` Checksum string `form:"checksum"` Pagination *PaginationParams }
ComponentFirmwareVersionListParams allows you to filter the results
type CreateServer ¶ added in v0.13.10
type CreateServer struct { Metadata *MsgMetadata `json:"metadata,omitempty"` Name null.String `json:"name"` FacilityCode null.String `json:"facility_code"` ID string `json:"id"` }
CreateServer is a message type published via NATS
func DeserializeCreateServer ¶ added in v0.13.10
func DeserializeCreateServer(inc []byte) (*CreateServer, error)
DeserializeCreateServer reconstitutes a CreateServer from raw bytes
type Link ¶
type Link struct {
Href string `json:"href,omitempty"`
}
Link represents an address to a page
type MsgMetadata ¶ added in v0.13.10
type MsgMetadata struct { CreatedAt time.Time `json:"created_at,omitempty"` UpdatedAt time.Time `json:"updated_at,omitempty"` }
MsgMetadata captures some message-type agnostic descriptive data a consumer might need
type OperatorType ¶ added in v0.13.0
type OperatorType string
OperatorType is used to control what kind of search is performed for an AttributeListParams value.
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
type Router ¶
type Router struct { AuthMW *ginjwt.Middleware DB *sqlx.DB SecretsKeeper *secrets.Keeper Logger *zap.Logger EventStream events.Stream }
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
type Server ¶
type Server struct { UUID uuid.UUID `json:"uuid"` Name string `json:"name"` FacilityCode string `json:"facility"` Attributes []Attributes `json:"attributes"` Components []ServerComponent `json:"components"` VersionedAttributes []VersionedAttributes `json:"versioned_attributes"` 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"` }
Server represents a server in a facility
type ServerComponent ¶
type ServerComponent struct { UUID uuid.UUID `json:"uuid"` ServerUUID uuid.UUID `json:"server_uuid" binding:"required"` Name string `json:"name" binding:"required"` Vendor string `json:"vendor"` Model string `json:"model"` Serial string `json:"serial" binding:"required"` Attributes []Attributes `json:"attributes"` VersionedAttributes []VersionedAttributes `json:"versioned_attributes"` ComponentTypeID string `json:"component_type_id" binding:"required"` ComponentTypeName string `json:"component_type_name" binding:"required"` ComponentTypeSlug string `json:"component_type_slug" binding:"required"` 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.
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 ¶ added in v0.13.5
type ServerComponentSlice []ServerComponent
ServerComponentSlice is a slice of ServerComponent objects
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 ¶ added in v0.13.5
type ServerComponentTypeSlice []*ServerComponentType
ServerComponentTypeSlice is a slice of the ServerComponentType
func (ServerComponentTypeSlice) ByID ¶ added in v0.13.5
func (ts ServerComponentTypeSlice) ByID(id string) *ServerComponentType
ByID returns the ServerComponentType matched by its ID field value
func (ServerComponentTypeSlice) ByName ¶ added in v0.13.5
func (ts ServerComponentTypeSlice) ByName(name string) *ServerComponentType
ByName returns the ServerComponentType matched by its Name field value
func (ServerComponentTypeSlice) BySlug ¶ added in v0.13.5
func (ts ServerComponentTypeSlice) BySlug(slug string) *ServerComponentType
BySlug returns the ServerComponentType matched by its Slug field value
type ServerCredential ¶ added in v0.13.7
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 ¶ added in v0.13.7
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 ServerListParams ¶
type ServerListParams struct { FacilityCode string `form:"facility-code"` ComponentListParams []ServerComponentListParams AttributeListParams []AttributeListParams IncludeDeleted bool `form:"include-deleted"` VersionedAttributeListParams []AttributeListParams PaginationParams *PaginationParams }
ServerListParams allows you to filter the results
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"` 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 VersionedAttributes ¶
type VersionedAttributes struct { Namespace string `json:"namespace" binding:"required"` Data json.RawMessage `json:"data" binding:"required"` Tally int `json:"tally"` LastReportedAt time.Time `json:"last_reported_at"` CreatedAt time.Time `json:"created_at"` }
VersionedAttributes represents a set of attributes of an entity at a given time
Source Files ¶
- attribute_list_params.go
- attributes.go
- bom.go
- client.go
- doc.go
- errors.go
- firmware.go
- firmware_list_params.go
- firmware_set.go
- firmware_set_list_params.go
- messages.go
- pagination.go
- requests.go
- router.go
- router_bom.go
- router_firmware.go
- router_firmware_set.go
- router_responses.go
- router_server.go
- router_server_attributes.go
- router_server_component_type.go
- router_server_components.go
- router_server_secret_types.go
- router_server_secrets.go
- server.go
- server_component.go
- server_component_list_params.go
- server_component_type.go
- server_component_type_list_params.go
- server_component_type_service.go
- server_list_params.go
- server_secret.go
- server_secret_type.go
- server_service.go
- versioned_attributes.go