Documentation ¶
Overview ¶
Package client is where the interaction between the client and the flyte api occurs. Normally you will only need to reference the client.NewClient(...) function.
Index ¶
Examples ¶
Constants ¶
View Source
const (
ApiVersion = "v1"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action struct { CommandName string `json:"command"` Input json.RawMessage `json:"input"` Links []Link `json:"links"` }
type Client ¶
type Client interface { // CreatePack is responsible for posting your pack to the flyte server. CreatePack(Pack) error // PostEvent posts events to the flyte server. PostEvent(Event) error // TakeAction takes the next action the pack should process. If no action is available, nil is returned. TakeAction() (*Action, error) // CompleteAction posts the action result to the flyte server. CompleteAction(Action, Event) error // GetFlyteHealthCheckURL gets the flyte api healthcheck url GetFlyteHealthCheckURL() (*url.URL, error) }
func NewClient ¶
To create a new client, please provide the url of the flyte server and the timeout. timeout specifies a time limit for requests made by this client. A timeout of zero means no timeout. Insecure mode is either true or false
Example ¶
package main import ( "github.com/HotelsDotCom/flyte-client/client" "github.com/HotelsDotCom/flyte-client/flyte" "net/url" "time" ) func main() { rootUrl, _ := url.Parse("http://example.com/") timeout := 10 * time.Second client := client.NewClient(rootUrl, timeout) packDef := flyte.PackDef{ Name: "JiraPack", Commands: []flyte.Command{ // command/s }, } p := flyte.NewPack(packDef, client) p.Start() }
Output:
type Command ¶
type Command struct { Name string `json:"name"` // command name EventNames []string `json:"events"` // the command output events Links []Link `json:"links,omitempty"` // the command link/s, optional. Normally a help url }
the command struct represents the commands a pack exposes
type EventDef ¶
type EventDef struct { Name string `json:"name"` // the event name Links []Link `json:"links,omitempty"` // the event link/s, optional. Could be a help link or anything related to the event }
the event definition, this describes events a pack can send
type Link ¶
func (Link) MarshalJSON ¶
custom marshaller to avoid marshalling all url.URL fields
func (*Link) UnmarshalJSON ¶
type NotFoundError ¶
type NotFoundError struct {
Message string
}
func (NotFoundError) Error ¶
func (e NotFoundError) Error() string
type Pack ¶
type Pack struct { Name string `json:"name"` // pack name Labels map[string]string `json:"labels,omitempty"` // pack labels - these act as a filter that determines when the pack will execute against a flow EventDefs []EventDef `json:"events"` // the event definitions of a pack. These can be events a pack observes and sends spontaneously Commands []Command `json:"commands,omitempty"` // the commands a pack exposes Links []Link `json:"links, omitempty"` // contains links the pack uses, such as the take action url and the events url, or links the pack exposes such as the pack help url }
the client Pack struct is used when registering with the flyte api.
Click to show internal directories.
Click to hide internal directories.