artifacts

package
v54.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 30, 2023 License: MPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseArtifact

type BaseArtifact struct {
	Name    string
	Expires tcclient.Time
}

Common properties across all implementations.

func (*BaseArtifact) Base

func (base *BaseArtifact) Base() *BaseArtifact

func (*BaseArtifact) FinishArtifact

func (*BaseArtifact) FinishArtifact(response interface{}, queue tc.Queue, taskID, runID, name string) error

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 interface{}, logger Logger, serviceFactory tc.ServiceFactory, config *gwconfig.Config) error

func (*ErrorArtifact) RequestObject

func (errArtifact *ErrorArtifact) RequestObject() interface{}

func (*ErrorArtifact) ResponseObject

func (errArtifact *ErrorArtifact) ResponseObject() interface{}

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 interface{}, logger Logger, serviceFactory tc.ServiceFactory, config *gwconfig.Config) error

func (*LinkArtifact) RequestObject

func (linkArtifact *LinkArtifact) RequestObject() interface{}

func (*LinkArtifact) ResponseObject

func (linkArtifact *LinkArtifact) ResponseObject() interface{}

type Logger

type Logger interface {
	// Infof formats and lots a message at the info level
	Infof(format string, a ...interface{})

	// Errorf formats and lots a message at the error level
	Errorf(format string, a ...interface{})
}

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 (a *ObjectArtifact) FinishArtifact(resp interface{}, queue tc.Queue, taskID, runID, name string) error

func (*ObjectArtifact) ProcessResponse

func (a *ObjectArtifact) ProcessResponse(resp interface{}, logger Logger, serviceFactory tc.ServiceFactory, config *gwconfig.Config) (err error)

func (*ObjectArtifact) RequestObject

func (a *ObjectArtifact) RequestObject() interface{}

func (*ObjectArtifact) ResponseObject

func (a *ObjectArtifact) ResponseObject() interface{}

func (*ObjectArtifact) String

func (a *ObjectArtifact) String() string

type RedirectArtifact

type RedirectArtifact struct {
	*BaseArtifact
	URL         string
	ContentType string
}

func (*RedirectArtifact) ProcessResponse

func (redirectArtifact *RedirectArtifact) ProcessResponse(response interface{}, logger Logger, serviceFactory tc.ServiceFactory, config *gwconfig.Config) error

func (*RedirectArtifact) RequestObject

func (redirectArtifact *RedirectArtifact) RequestObject() interface{}

func (*RedirectArtifact) ResponseObject

func (redirectArtifact *RedirectArtifact) ResponseObject() interface{}

type S3Artifact

type S3Artifact struct {
	*BaseArtifact
	// Path is the filename of the file containing the data
	// for this artifact.
	Path            string
	ContentEncoding string
	ContentType     string
}

func (*S3Artifact) ProcessResponse

func (s3Artifact *S3Artifact) ProcessResponse(resp interface{}, logger Logger, serviceFactory tc.ServiceFactory, config *gwconfig.Config) (err error)

func (*S3Artifact) RequestObject

func (s3Artifact *S3Artifact) RequestObject() interface{}

func (*S3Artifact) ResponseObject

func (s3Artifact *S3Artifact) ResponseObject() interface{}

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() interface{}

	// 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() interface{}

	// 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 interface{}, logger Logger, serviceFactory tc.ServiceFactory, config *gwconfig.Config) error

	// FinishArtifact calls queue.FinishArtifact if necessary for the artifact type
	FinishArtifact(response interface{}, queue tc.Queue, taskID, runID, name string) error

	// 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL