kala: github.com/ajvb/kala/client Index | Files

package client

import "github.com/ajvb/kala/client"

KalaClient in the official Go client library for interfacing with the Kala HTTP API.

It is a simple wrapper around the Sling library, and it is thread-safe.

Index

Package Files

client.go doc.go

Variables

var (
    ErrJobNotFound      = errors.New("Job not found")
    ErrJobCreationError = errors.New("Error creating job")

    ErrGenericError = errors.New("An error occurred performing your request")
)

type KalaClient Uses

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

KalaClient is the base struct for this package.

func New Uses

func New(apiEndpoint string) *KalaClient

New is used to create a new KalaClient based off of the apiEndpoint Example:

c := New("http://127.0.0.1:8000")

func (*KalaClient) CreateJob Uses

func (kc *KalaClient) CreateJob(body *job.Job) (string, error)

CreateJob is used for creating a new job within Kala. Note that the Name and Command fields are the only ones that are required. Example:

c := New("http://127.0.0.1:8000")
body := &job.Job{
	Schedule: "R2/2015-06-04T19:25:16.828696-07:00/PT10S",
	Name:	  "test_job",
	Command:  "bash -c 'date'",
}
id, err := c.CreateJob(body)

func (*KalaClient) DeleteAllJobs Uses

func (kc *KalaClient) DeleteAllJobs() (bool, error)

DeleteAllJobs is used to delete all jobs from Kala Example:

c := New("http://127.0.0.1:8000")
ok, err := c.DeleteAllJobs()

func (*KalaClient) DeleteJob Uses

func (kc *KalaClient) DeleteJob(id string) (bool, error)

DeleteJob is used to delete a Job from Kala by its ID. Example:

c := New("http://127.0.0.1:8000")
id := "93b65499-b211-49ce-57e0-19e735cc5abd"
ok, err := c.DeleteJob(id)

func (*KalaClient) DisableJob Uses

func (kc *KalaClient) DisableJob(id string) (bool, error)

DisableJob is used to disable a Job in Kala using its ID. Example:

c := New("http://127.0.0.1:8000")
id := "93b65499-b211-49ce-57e0-19e735cc5abd"
ok, err := c.DisableJob(id)

func (*KalaClient) EnableJob Uses

func (kc *KalaClient) EnableJob(id string) (bool, error)

EnableJob is used to enable a disabled Job in Kala using its ID. Example:

c := New("http://127.0.0.1:8000")
id := "93b65499-b211-49ce-57e0-19e735cc5abd"
ok, err := c.EnableJob(id)

func (*KalaClient) GetAllJobs Uses

func (kc *KalaClient) GetAllJobs() (map[string]*job.Job, error)

GetAllJobs returns a map of string (ID's) to job.Job's which contains all Jobs currently within Kala. Example:

c := New("http://127.0.0.1:8000")
jobs, err := c.GetAllJobs()

func (*KalaClient) GetJob Uses

func (kc *KalaClient) GetJob(id string) (*job.Job, error)

GetJob is used to retrieve a Job from Kala by its ID. Example:

c := New("http://127.0.0.1:8000")
id := "93b65499-b211-49ce-57e0-19e735cc5abd"
job, err := c.GetJob(id)

func (*KalaClient) GetJobStats Uses

func (kc *KalaClient) GetJobStats(id string) ([]*job.JobStat, error)

GetJobStats is used to retrieve stats about a Job from Kala by its ID. Example:

c := New("http://127.0.0.1:8000")
id := "93b65499-b211-49ce-57e0-19e735cc5abd"
stats, err := c.GetJobStats(id)

func (*KalaClient) GetKalaStats Uses

func (kc *KalaClient) GetKalaStats() (*job.KalaStats, error)

GetKalaStats retrieves system-level metrics about Kala Example:

c := New("http://127.0.0.1:8000")
stats, err := c.GetKalaStats()

func (*KalaClient) StartJob Uses

func (kc *KalaClient) StartJob(id string) (bool, error)

StartJob is used to manually start a Job by its ID. Example:

c := New("http://127.0.0.1:8000")
id := "93b65499-b211-49ce-57e0-19e735cc5abd"
ok, err := c.StartJob(id)

Package client imports 9 packages (graph) and is imported by 1 packages. Updated 2020-06-26. Refresh now. Tools for package owners.