Documentation
¶
Index ¶
- Constants
- Variables
- type Core
- func (c *Core) CheckToken(tokenID uint64, token string) (bool, error)
- func (c *Core) CreateInstance(ctx context.Context, providerName string, attr CreateInstanceAttributes) (*Instance, error)
- func (c *Core) GetInstance(ctx context.Context, id string) (*Instance, error)
- func (c *Core) ProviderCreateInstance(job *work.Job) error
- func (c *Core) ProviderRefresh(ctx context.Context) error
- func (c *Core) ProviderRemoveInstance(job *work.Job) error
- func (c *Core) RemoveInstance(ctx context.Context, attr DeleteInstanceAttributes) error
- type CreateInstanceAttributes
- type DeleteInstanceAttributes
- type Instance
Constants ¶
const MaxCreateRetries = 10
MaxCreateRetries is the number of times the "create" job will be retried.
Variables ¶
var ( //VersionString gets set during `make` VersionString = "?" //RevisionString gets set during `make` RevisionString = "?" //RevisionURLString gets set during `make` RevisionURLString = "?" //GeneratedString gets set during `make` GeneratedString = "?" //CopyrightString gets set during `make` CopyrightString = "?" )
Functions ¶
This section is empty.
Types ¶
type Core ¶
type Core struct {
// contains filtered or unexported fields
}
Core is used as a central manager for all Cloud Brain functionality. The HTTP API and the background workers are just frontends for the Core, and calls methods on Core for functionality.
func NewCore ¶
NewCore is used to create a new Core backed by the given database and background Backend.
func (*Core) CheckToken ¶
CheckToken is used to check whether a given tokenID+token is in the database. Returns (true, nil) iff the token is valid, (false, nil) if the token is invalid, and (false, err) if an error occurred while fetching the token.
func (*Core) CreateInstance ¶
func (c *Core) CreateInstance(ctx context.Context, providerName string, attr CreateInstanceAttributes) (*Instance, error)
CreateInstance creates an instance in the database and queues off the cloud create job in the background.
func (*Core) GetInstance ¶
GetInstance gets the instance information stored in the database for a given instance ID.
func (*Core) ProviderCreateInstance ¶
ProviderCreateInstance is used to schedule the creation of the instance with the given ID on the provider selected for that instance.
func (*Core) ProviderRefresh ¶
ProviderRefresh is used to synchronize the data on all the cloud providers with the data in our database.
func (*Core) ProviderRemoveInstance ¶
ProviderRemoveInstance is used to schedule the creation of the instance with the given ID on the provider selected for that instance.
func (*Core) RemoveInstance ¶
func (c *Core) RemoveInstance(ctx context.Context, attr DeleteInstanceAttributes) error
RemoveInstance creates an instance in the database and queues off the cloud create job in the background.
type CreateInstanceAttributes ¶
CreateInstanceAttributes contains attributes needed to start an instance
type DeleteInstanceAttributes ¶
type DeleteInstanceAttributes struct {
InstanceID string
}
DeleteInstanceAttributes contains attributes needed to delete an instance