Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AWS ¶
type AWS interface {
GetBucketName() string
CheckBucketFileExists(file string) (bool, error)
UploadArchiveToS3(uploadFileName, destKeyName string) error
DownloadArchiveFromS3(filename string) (string, func(), error)
}
AWS provides an interface to interact with AWS services.
type AWSContext ¶
type AWSContext struct {
// contains filtered or unexported fields
}
AWSContext implements the AWS interface and provides methods to interact with AWS S3.
func NewAWSContext ¶ added in v0.3.0
func NewAWSContext(bucket string) (*AWSContext, error)
NewAWSContext creates a new AWSContext with the specified bucket name.
func (*AWSContext) CheckBucketFileExists ¶
func (a *AWSContext) CheckBucketFileExists(file string) (bool, error)
CheckBucketFileExists checks if a file exists in the S3 bucket.
func (*AWSContext) DownloadArchiveFromS3 ¶ added in v0.3.0
func (a *AWSContext) DownloadArchiveFromS3(archiveName string) (path string, cleanup func(), err error)
DownloadArchiveFromS3 downloads a file from an S3 bucket.
func (*AWSContext) GetBucketName ¶
func (a *AWSContext) GetBucketName() string
GetBucketName returns the name of the S3 bucket used in AWSContext.
func (*AWSContext) UploadArchiveToS3 ¶
func (a *AWSContext) UploadArchiveToS3(uploadFileName, destKeyName string) error
UploadArchiveToS3 uploads a file to an S3 bucket.
type Context ¶
type Context struct {
Store Store
Logger logrus.FieldLogger
AWS AWS
Workdir string
RequestID string
}
Context provides the API with all necessary data and interfaces for responding to requests.
It is cloned before each request, allowing per-request changes such as logger annotations.
type Store ¶
type Store interface {
GetTranslation(id string) (*model.Translation, error)
GetTranslationsByInstallation(id string) ([]*model.Translation, error)
GetAllTranslations() ([]*model.Translation, error)
CreateTranslation(t *model.Translation) error
UpdateTranslation(t *model.Translation) error
GetAndClaimNextReadyImport(provisionerID string) (*model.Import, error)
GetAllImports() ([]*model.Import, error)
GetImport(id string) (*model.Import, error)
GetImportsInProgress() ([]*model.Import, error)
GetImportsByInstallation(id string) ([]*model.Import, error)
GetImportsByTranslation(id string) ([]*model.Import, error)
UpdateImport(imp *model.Import) error
GetUpload(id string) (*model.Upload, error)
GetUploads() ([]*model.Upload, error)
CreateUpload(id string, archiveType model.BackupType) error
CompleteUpload(uploadID, errorMessage string) error
}
Store defines the interface for data storage and retrieval operations. It provides methods for managing translations, imports, and uploads within the system.