client

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2019 License: BSD-3-Clause Imports: 11 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 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
}

Client describes the client details.

func NewClient

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

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

func (*Client) GetBuildStatus

func (c *Client) GetBuildStatus(ctx context.Context, buildID string) (rd ResponseData, err error)

GetBuildStatus gets the status of a build from the Remote Build Service

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) StreamOutput

func (c *Client) StreamOutput(ctx context.Context, wsURL string) error

StreamOutput reads log output from the websocket URL. The context controls the lifetime of the request.

func (*Client) SubmitBuild

func (c *Client) SubmitBuild(ctx context.Context, d Definition, libraryRef string, libraryURL string) (rd ResponseData, err error)

Build submits 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
}

Config contains the client configuration.

type Data

type Data struct {
	Files   []FileTransport `json:"files"`
	Scripts `json:"buildScripts"`
}

Data contains any scripts, metadata, etc... that the Builder may need to know only at build time to build the image

type Definition

type Definition struct {
	Header     map[string]string `json:"header"`
	ImageData  `json:"imageData"`
	BuildData  Data              `json:"buildData"`
	CustomData map[string]string `json:"customData"`
	Raw        []byte            `json:"raw"`
}

Definition describes how to build an image.

type FileTransport

type FileTransport struct {
	Src string `json:"source"`
	Dst string `json:"destination"`
}

FileTransport holds source and destination information of files to copy into the container

type ImageData

type ImageData struct {
	Metadata     []byte            `json:"metadata"`
	Labels       map[string]string `json:"labels"`
	ImageScripts `json:"imageScripts"`
}

ImageData contains any scripts, metadata, etc... that needs to be present in some from in the final built image

type ImageScripts

type ImageScripts struct {
	Help        string `json:"help"`
	Environment string `json:"environment"`
	Runscript   string `json:"runScript"`
	Test        string `json:"test"`
	Startscript string `json:"startScript"`
}

ImageScripts contains scripts that are used after build time.

type RequestData

type RequestData struct {
	Definition  `json:"definition"`
	LibraryRef  string `json:"libraryRef"`
	LibraryURL  string `json:"libraryURL"`
	CallbackURL string `json:"callbackURL"`
}

RequestData contains the info necessary for submitting a build to a remote service

type ResponseData

type ResponseData struct {
	ID            string     `json:"id"`
	CreatedBy     string     `json:"createdBy"`
	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"`
	Definition    Definition `json:"definition"`
	WSURL         string     `json:"wsURL,omitempty"`
	LibraryRef    string     `json:"libraryRef"`
	LibraryURL    string     `json:"libraryURL"`
	CallbackURL   string     `json:"callbackURL"`
}

ResponseData contains the details of an individual build

type Scripts

type Scripts struct {
	Pre   string `json:"pre"`
	Setup string `json:"setup"`
	Post  string `json:"post"`
	Test  string `json:"test"`
}

Scripts defines scripts that are used at build time.

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