client

package
v0.0.0-...-e25df9a Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2015 License: MIT Imports: 7 Imported by: 0

README

Kala Go Client Library

Documentation

Overview

TODO

Index

Constants

This section is empty.

Variables

View Source
var (
	JobNotFound      = errors.New("Job not found")
	JobCreationError = errors.New("Error creating job")

	GenericError = errors.New("An error occured performing your request")
)

Functions

This section is empty.

Types

type KalaClient

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

KalaClient is the base struct for this package.

func New

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

func (kc *KalaClient) CreateJob(body map[string]string) (string, error)

CreateJob is used for creating a new job within Kala. It uses a map of strings to strings. Example:

c := New("http://127.0.0.1:8000")
body := map[string]string{
	"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) DeleteJob

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

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

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

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

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

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)

Jump to

Keyboard shortcuts

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