2022-02-24 07:12:57 -05:00
|
|
|
package upload
|
|
|
|
|
|
|
|
import (
|
|
|
|
"gitlab.com/gitlab-org/gitlab/workhorse/internal/api"
|
2022-03-15 08:07:44 -04:00
|
|
|
"gitlab.com/gitlab-org/gitlab/workhorse/internal/upload/destination"
|
2022-02-24 07:12:57 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
// Preparer is a pluggable behavior that interprets a Rails API response
|
|
|
|
// and either tells Workhorse how to handle the upload, via the
|
2022-05-11 08:09:03 -04:00
|
|
|
// UploadOpts, or it rejects the request by returning a non-nil error.
|
|
|
|
// Its intended use is to make sure the upload gets stored in the right
|
|
|
|
// location: either a local directory, or one of several supported object
|
|
|
|
// storage backends.
|
2022-02-24 07:12:57 -05:00
|
|
|
type Preparer interface {
|
2022-05-11 08:09:03 -04:00
|
|
|
Prepare(a *api.Response) (*destination.UploadOpts, error)
|
2022-02-24 07:12:57 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
type DefaultPreparer struct{}
|
|
|
|
|
2022-05-11 08:09:03 -04:00
|
|
|
func (s *DefaultPreparer) Prepare(a *api.Response) (*destination.UploadOpts, error) {
|
|
|
|
return destination.GetOpts(a)
|
2022-02-24 07:12:57 -05:00
|
|
|
}
|