Documentation ¶
Index ¶
Constants ¶
const ( // StatusWaiting defines the status when there is no backup running StatusWaiting = "Waiting" // StatusUnknown defines an unknown status StatusUnknown = "Unknown" // StatusRunning defines the status of a backup that is running StatusRunning = "Running" // StatusFailed defines the status of a backup that has failed StatusFailed = "Failed" // StatusSucceeded defines the status of a backup that has succeeded StatusSucceeded = "Succeeded" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller binds http requests to an api service and writes the service results to the http response
func (*Controller) CreateBackup ¶
func (c *Controller) CreateBackup(w http.ResponseWriter, r *http.Request)
CreateBackup - create an on-demand backup
func (*Controller) GetBackupByID ¶
func (c *Controller) GetBackupByID(w http.ResponseWriter, r *http.Request)
GetBackupByID - Get backup from UUID
func (*Controller) GetBackups ¶
func (c *Controller) GetBackups(w http.ResponseWriter, r *http.Request)
GetBackups - Get backups
func (*Controller) Routes ¶
func (c *Controller) Routes() openapi.Routes
Routes returns all of the api route for the ApiController
type Router ¶
type Router interface { Routes() openapi.Routes CreateBackup(http.ResponseWriter, *http.Request) GetBackupByID(http.ResponseWriter, *http.Request) GetBackups(http.ResponseWriter, *http.Request) }
Router defines the required methods for binding the api requests to a responses for the MysqlBackup The Router implementation should parse necessary information from the http request, pass the data to a Servicer to perform the required actions, then write the service results to the http response.
func NewController ¶
NewController creates a default api controller
type Service ¶
type Service struct { Backup backend.Backup CurrState string LastState string M sync.Mutex States map[string]openapi.Backup Status string Storages map[string]backend.Storage }
Service is a service that implements the logic for the MysqlBackupServicer This service should implement the business logic for every endpoint for the MysqlBackup API. Include any external packages or services that will be required by this service.
func NewService ¶
NewService creates a backup service
func (*Service) CreateBackup ¶
func (s *Service) CreateBackup(request openapi.BackupRequest, apiKey string) (interface{}, int, error)
CreateBackup - create an on-demand backup
func (*Service) GetBackupByID ¶
GetBackupByID - Get backup from UUID
type Servicer ¶
type Servicer interface { CreateBackup(openapi.BackupRequest, string) (interface{}, int, error) GetBackupByID(string, string) (interface{}, int, error) GetBackups(string) (interface{}, int, error) }
Servicer defines the api actions for the Backup service This interface intended to stay up to date with the openapi yaml used to generate it, while the service implementation can ignored with the .openapi-generator-ignore file and updated with the logic required for the API.