golang

package module
v0.0.0-...-cc9f890 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2018 License: Apache-2.0 Imports: 16 Imported by: 0

README

gosdk

Golang sdk for gaia pipelines

Documentation

Index

Constants

View Source
const ProtocolType = "grpc"

ProtocolType is the type used to communicate.

View Source
const ProtocolVersion = 2

ProtocolVersion currently in use by Gaia

Variables

View Source
var (
	// ErrorJobNotFound is returned when a given job id was not found
	// locally.
	ErrorJobNotFound = errors.New("job not found in plugin")

	// ErrorExitPipeline is used to safely exit the pipeline (actually not an error).
	// Prevents the pipeline to be marked as 'failed'.
	ErrorExitPipeline = errors.New("pipeline exit requested by job")

	// ErrorDuplicateJob is returned when two jobs have the same title which is restricted.
	ErrorDuplicateJob = errors.New("duplicate job found (two jobs with same title)")
)

Functions

func Serve

func Serve(j Jobs) error

Serve initiates the gRPC Server and listens. This method should be last called in the plugin main function.

Types

type Argument

type Argument struct {
	Description string
	Type        InputType
	Key         string
	Value       string
}

Argument represents a single argument.

type Arguments

type Arguments []Argument

Arguments is a collection of argument

type GRPCServer

type GRPCServer struct{}

GRPCServer is the plugin gRPC implementation.

func (GRPCServer) ExecuteJob

func (GRPCServer) ExecuteJob(ctx context.Context, j *proto.Job) (*proto.JobResult, error)

ExecuteJob receives a job and executes it. Returns a JobResult object which gives information about job execution.

func (GRPCServer) GetJobs

func (GRPCServer) GetJobs(empty *proto.Empty, stream proto.Plugin_GetJobsServer) error

GetJobs streams all given jobs back.

type InputType

type InputType string

InputType represents the available input types.

const (
	// TextFieldInp text field input
	TextFieldInp InputType = "textfield"

	// TextAreaInp text area input
	TextAreaInp InputType = "textarea"

	// BoolInp boolean input
	BoolInp InputType = "boolean"

	// VaultInp vault automatic input
	VaultInp InputType = "vault"
)

func (InputType) String

func (i InputType) String() string

String returns a input type string back

type Job

type Job struct {
	Handler     func(Arguments) error
	Title       string
	Description string
	DependsOn   []string
	Args        Arguments
	Interaction *ManualInteraction
}

Job represents a single job which should be executed during pipeline run. Handler is the function pointer to the function which will be executed.

type Jobs

type Jobs []Job

Jobs is a collection of job

type ManualInteraction

type ManualInteraction struct {
	Description string
	Type        InputType
	Value       string
}

ManualInteraction represents a manual interaction which can be set per job. Before the related job is executed, the manual interaction is displayed to the Gaia user.

Jump to

Keyboard shortcuts

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