client

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2022 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = &Config{}

DefaultConfig is a configuration that uses default values.

Functions

This section is empty.

Types

type BuildInfo added in v0.0.2

type BuildInfo struct {
	ID            string     `json:"id"`
	SubmitTime    time.Time  `json:"submitTime"`
	StartTime     *time.Time `json:"startTime,omitempty"`
	IsComplete    bool       `json:"isComplete"`
	CompleteTime  *time.Time `json:"completeTime,omitempty"`
	ImageSize     int64      `json:"imageSize,omitempty"`
	ImageChecksum string     `json:"imageChecksum,omitempty"`
	LibraryRef    string     `json:"libraryRef"`
	LibraryURL    string     `json:"libraryURL"`
	CallbackURL   string     `json:"callbackURL"`
	DefinitionRaw []byte     `json:"definitionRaw"`
}

BuildInfo contains the details of an individual build

type BuildRequest added in v0.0.2

type BuildRequest struct {
	LibraryRef          string            `json:"libraryRef"`
	LibraryURL          string            `json:"libraryURL"`
	CallbackURL         string            `json:"callbackURL"`
	DefinitionRaw       []byte            `json:"definitionRaw"`
	BuilderRequirements map[string]string `json:"builderRequirements"`
}

BuildRequest contains the info necessary for submitting a build to build service

type Client

type Client struct {
	// Base URL of the service.
	BaseURL *url.URL
	// Auth token to include in the Authorization header of each request (if supplied).
	AuthToken string
	// User agent to include in each request (if supplied).
	UserAgent string
	// HTTPClient to use to make HTTP requests.
	HTTPClient *http.Client
	// Logger to be used when output is generated
	Logger log.Logger
}

Client describes the client details.

func New added in v0.0.2

func New(cfg *Config) (c *Client, err error)

New sets up a new build service client with the specified base URL and auth token.

func (*Client) Cancel added in v0.1.0

func (c *Client) Cancel(ctx context.Context, buildID string) error

Cancel cancels an existing build. The context controls the lifetime of the request.

func (*Client) GetOutput added in v0.0.2

func (c *Client) GetOutput(ctx context.Context, buildID string, w io.Writer) error

GetOutput streams build output for the provided buildID to w. The context controls the lifetime of the request.

func (*Client) GetStatus added in v0.0.2

func (c *Client) GetStatus(ctx context.Context, buildID string) (bi BuildInfo, err error)

GetStatus gets the status of a build from the Build Service by build ID

func (*Client) GetVersion

func (c *Client) GetVersion(ctx context.Context) (vi VersionInfo, err error)

GetVersion gets version information from the build service. The context controls the lifetime of the request.

func (*Client) Submit added in v0.0.2

func (c *Client) Submit(ctx context.Context, br BuildRequest) (bi BuildInfo, err error)

Submit sends a build job to the Build Service. The context controls the lifetime of the request.

type Config

type Config struct {
	// Base URL of the service (https://build.sylabs.io is used if not supplied).
	BaseURL string
	// Auth token to include in the Authorization header of each request (if supplied).
	AuthToken string
	// User agent to include in each request (if supplied).
	UserAgent string
	// HTTPClient to use to make HTTP requests (if supplied).
	HTTPClient *http.Client
	// Logger to be used when output is generated
	Logger log.Logger
}

Config contains the client configuration.

type VersionInfo

type VersionInfo struct {
	Version string `json:"version"`
}

VersionInfo contains version information.

Jump to

Keyboard shortcuts

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