patrick

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2024 License: BSD-3-Clause Imports: 6 Imported by: 1

README

go-patrick-http

REST client for Patrick Node

Testing

Run

go test ./...

Usage

// jid is a job id

c := New(ctx, URL(url string), Auth(token string), Provider(provider string))
jids, _ := c.Jobs(projectId string)

for _, jid := range jobs {
    _job, _ := c.Job(jid)
    _job.Logs // cid of the job's log file
    _job.Status // The status of the job  ( commonPatrick.JobStatus )
    _job.Meta.Repository.Id // The repository the job was ran on

    _job.TimeStamp // NOT IMPLEMENTED, TODO made in patrick/service/http_job.go

    readCloser, _ := c.LogFile(_job.Logs)

    // Print logs of the job to stdOut
    os.Copy(os.Stdout, readCloser)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context, options ...http.Option) (*Client, error)

func (*Client) Cancel

func (c *Client) Cancel(jid string) (response interface{}, err error)

func (*Client) Job

func (c *Client) Job(jid string) (job *patrickIface.Job, err error)

func (*Client) Jobs

func (c *Client) Jobs(projectId string) (jobList []string, err error)

func (*Client) LogFile

func (c *Client) LogFile(jobId, resourceId string) (log io.ReadCloser, err error)

func (*Client) Retry

func (c *Client) Retry(jid string) (response interface{}, err error)

Jump to

Keyboard shortcuts

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