Documentation
¶
Index ¶
- type BaseArtifact
- type ErrorArtifact
- type LinkArtifact
- type Logger
- type ObjectArtifact
- func (a *ObjectArtifact) FinishArtifact(resp any, queue tc.Queue, taskID, runID, name string) error
- func (a *ObjectArtifact) ProcessResponse(resp any, logger Logger, serviceFactory tc.ServiceFactory, ...) (err error)
- func (a *ObjectArtifact) RequestObject() any
- func (a *ObjectArtifact) ResponseObject() any
- func (a *ObjectArtifact) String() string
- type RedirectArtifact
- func (redirectArtifact *RedirectArtifact) ProcessResponse(response any, logger Logger, serviceFactory tc.ServiceFactory, ...) error
- func (redirectArtifact *RedirectArtifact) RequestObject() any
- func (redirectArtifact *RedirectArtifact) ResponseObject() any
- func (redirectArtifact *RedirectArtifact) String() string
- type S3Artifact
- type TaskArtifact
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseArtifact ¶
Common properties across all implementations.
func (*BaseArtifact) Base ¶
func (base *BaseArtifact) Base() *BaseArtifact
func (*BaseArtifact) FinishArtifact ¶
FinishArtifact implements TaskArtifact#FinishArtifact.
This provides a default implementation that does not call queue.FinishArtifact, as appropriate for link, redirect, error, and s3 artifact types.
type ErrorArtifact ¶
type ErrorArtifact struct {
*BaseArtifact
Path string
Message string
Reason string
}
func (*ErrorArtifact) ProcessResponse ¶
func (errArtifact *ErrorArtifact) ProcessResponse(response any, logger Logger, serviceFactory tc.ServiceFactory, config *gwconfig.Config) error
func (*ErrorArtifact) RequestObject ¶
func (errArtifact *ErrorArtifact) RequestObject() any
func (*ErrorArtifact) ResponseObject ¶
func (errArtifact *ErrorArtifact) ResponseObject() any
func (*ErrorArtifact) String ¶
func (errArtifact *ErrorArtifact) String() string
type LinkArtifact ¶
type LinkArtifact struct {
*BaseArtifact
Artifact string
ContentType string
}
func (*LinkArtifact) ProcessResponse ¶
func (linkArtifact *LinkArtifact) ProcessResponse(response any, logger Logger, serviceFactory tc.ServiceFactory, config *gwconfig.Config) error
func (*LinkArtifact) RequestObject ¶
func (linkArtifact *LinkArtifact) RequestObject() any
func (*LinkArtifact) ResponseObject ¶
func (linkArtifact *LinkArtifact) ResponseObject() any
func (*LinkArtifact) String ¶
func (linkArtifact *LinkArtifact) String() string
type Logger ¶
type Logger interface {
// Infof formats and lots a message at the info level
Infof(format string, a ...any)
// Errorf formats and lots a message at the error level
Errorf(format string, a ...any)
}
Logger represents a target for log messages from the artifact implementation.
type ObjectArtifact ¶
type ObjectArtifact struct {
*BaseArtifact
// Path is the filename of the file containing the data
// for this artifact.
Path string
// ContentType is used in the Content-Type header.
ContentType string
}
func (*ObjectArtifact) FinishArtifact ¶
func (*ObjectArtifact) ProcessResponse ¶
func (a *ObjectArtifact) ProcessResponse(resp any, logger Logger, serviceFactory tc.ServiceFactory, config *gwconfig.Config) (err error)
func (*ObjectArtifact) RequestObject ¶
func (a *ObjectArtifact) RequestObject() any
func (*ObjectArtifact) ResponseObject ¶
func (a *ObjectArtifact) ResponseObject() any
func (*ObjectArtifact) String ¶
func (a *ObjectArtifact) String() string
type RedirectArtifact ¶
type RedirectArtifact struct {
*BaseArtifact
URL string
HideURL bool
ContentType string
}
func (*RedirectArtifact) ProcessResponse ¶
func (redirectArtifact *RedirectArtifact) ProcessResponse(response any, logger Logger, serviceFactory tc.ServiceFactory, config *gwconfig.Config) error
func (*RedirectArtifact) RequestObject ¶
func (redirectArtifact *RedirectArtifact) RequestObject() any
func (*RedirectArtifact) ResponseObject ¶
func (redirectArtifact *RedirectArtifact) ResponseObject() any
func (*RedirectArtifact) String ¶
func (redirectArtifact *RedirectArtifact) String() string
type S3Artifact ¶
type S3Artifact struct {
*BaseArtifact
// Path is the filename of the file declared in the task payload.
Path string
// ContentPath is the filename of the file containing the data
// for this artifact. ContentPath may be equal to Path, or,
// in the case where a temporary file is created, it may be different.
// ContentPath will always be read from when uploading the artifact.
ContentPath string
ContentEncoding string
ContentType string
}
func (*S3Artifact) ProcessResponse ¶
func (s3Artifact *S3Artifact) ProcessResponse(resp any, logger Logger, serviceFactory tc.ServiceFactory, config *gwconfig.Config) (err error)
func (*S3Artifact) RequestObject ¶
func (s3Artifact *S3Artifact) RequestObject() any
func (*S3Artifact) ResponseObject ¶
func (s3Artifact *S3Artifact) ResponseObject() any
func (*S3Artifact) String ¶
func (s3Artifact *S3Artifact) String() string
type TaskArtifact ¶
type TaskArtifact interface {
// RequestObject returns a pointer to a go type containing the data for
// marshaling into tcqueue.PostArtifactRequest for passing to
// tcqueue.CreateArtifact.
//
// For example, this is a *tcqueue.S3ArtifactRequest for type
// S3Artifact.
RequestObject() any
// ResponseObject returns a pointer to an empty go type for
// unmarshaling the result of a tcqueue.CreateArtifact API call into.
//
// For example, this would be new(tcqueue.RedirectArtifactRequest) for
// RedirectArtifact.
ResponseObject() any
// ProcessResponse is a callback for performing actions after
// tcqueue.CreateArtifact API is called. response is the object
// returned by ResponseObject(), but populated with the result of
// tcqueue.CreateArtifact.
//
// For example, ProcessResponse for S3Artifact uploads the artifact to
// S3, since the tcqueue.CreateArtifact API call only informs the Queue
// that the artifact exists without uploading it.
//
// ProcessResponse can be an empty method if no post
// tcqueue.CreateArtifact steps are required.
ProcessResponse(response any, logger Logger, serviceFactory tc.ServiceFactory, config *gwconfig.Config) error
// FinishArtifact calls queue.FinishArtifact if necessary for the artifact type
FinishArtifact(response any, queue tc.Queue, taskID, runID, name string) error
// String returns a string representation of the artifact type
// with all properties.
//
// For example, String for S3Artifact would look something like:
// "S3 Artifact - Name: artifact, Path: /test/path, Expires: 2006-01-02T15:04:05.000Z,
// Content Encoding: 'gzip', MIME Type: 'text/plain; charset=utf-8'"
String() string
// Base returns a *BaseArtifact which stores the properties common to
// all implementations
Base() *BaseArtifact
}
TaskArtifact is the interface that all artifact types implement (S3Artifact, RedirectArtifact, ErrorArtifact), for publishing artifacts according to the tcqueue.CreateArtifact docs.
Click to show internal directories.
Click to hide internal directories.