Documentation ¶
Overview ¶
Package api controls the bulk of the Gofer API logic.
Index ¶
- Constants
- Variables
- func StartEventsService(config *config.API, api *API)
- type API
- func (api *API) AbandonPipeline(ctx context.Context, request *proto.AbandonPipelineRequest) (*proto.AbandonPipelineResponse, error)
- func (api *API) AddRegistryAuth(ctx context.Context, request *proto.AddRegistryAuthRequest) (*proto.AddRegistryAuthResponse, error)
- func (api *API) BatchGetRuns(ctx context.Context, request *proto.BatchGetRunsRequest) (*proto.BatchGetRunsResponse, error)
- func (api *API) BatchGetTriggerEvents(ctx context.Context, request *proto.BatchGetTriggerEventsRequest) (*proto.BatchGetTriggerEventsResponse, error)
- func (api *API) BootstrapToken(ctx context.Context, request *proto.BootstrapTokenRequest) (*proto.BootstrapTokenResponse, error)
- func (api *API) CancelAllRuns(ctx context.Context, request *proto.CancelAllRunsRequest) (*proto.CancelAllRunsResponse, error)
- func (api *API) CancelRun(ctx context.Context, request *proto.CancelRunRequest) (*proto.CancelRunResponse, error)
- func (api *API) CancelTaskRun(ctx context.Context, request *proto.CancelTaskRunRequest) (*proto.CancelTaskRunResponse, error)
- func (api *API) CreateNamespace(ctx context.Context, request *proto.CreateNamespaceRequest) (*proto.CreateNamespaceResponse, error)
- func (api *API) CreatePipelineByURL(ctx context.Context, request *proto.CreatePipelineByURLRequest) (*proto.CreatePipelineByURLResponse, error)
- func (api *API) CreatePipelineRaw(ctx context.Context, request *proto.CreatePipelineRawRequest) (*proto.CreatePipelineRawResponse, error)
- func (api *API) CreateToken(ctx context.Context, request *proto.CreateTokenRequest) (*proto.CreateTokenResponse, error)
- func (api *API) DeleteNamespace(ctx context.Context, request *proto.DeleteNamespaceRequest) (*proto.DeleteNamespaceResponse, error)
- func (api *API) DeletePipelineObject(ctx context.Context, request *proto.DeletePipelineObjectRequest) (*proto.DeletePipelineObjectResponse, error)
- func (api *API) DeleteRunObject(ctx context.Context, request *proto.DeleteRunObjectRequest) (*proto.DeleteRunObjectResponse, error)
- func (api *API) DeleteTaskRunLogs(ctx context.Context, request *proto.DeleteTaskRunLogsRequest) (*proto.DeleteTaskRunLogsResponse, error)
- func (api *API) DeleteToken(ctx context.Context, request *proto.DeleteTokenRequest) (*proto.DeleteTokenResponse, error)
- func (api *API) DisablePipeline(ctx context.Context, request *proto.DisablePipelineRequest) (*proto.DisablePipelineResponse, error)
- func (api *API) EnablePipeline(ctx context.Context, request *proto.EnablePipelineRequest) (*proto.EnablePipelineResponse, error)
- func (api *API) GetNamespace(ctx context.Context, request *proto.GetNamespaceRequest) (*proto.GetNamespaceResponse, error)
- func (api *API) GetPipeline(ctx context.Context, request *proto.GetPipelineRequest) (*proto.GetPipelineResponse, error)
- func (api *API) GetPipelineObject(ctx context.Context, request *proto.GetPipelineObjectRequest) (*proto.GetPipelineObjectResponse, error)
- func (api *API) GetRun(ctx context.Context, request *proto.GetRunRequest) (*proto.GetRunResponse, error)
- func (api *API) GetRunObject(ctx context.Context, request *proto.GetRunObjectRequest) (*proto.GetRunObjectResponse, error)
- func (api *API) GetSystemInfo(context context.Context, request *proto.GetSystemInfoRequest) (*proto.GetSystemInfoResponse, error)
- func (api *API) GetTaskRun(ctx context.Context, request *proto.GetTaskRunRequest) (*proto.GetTaskRunResponse, error)
- func (api *API) GetTaskRunLogs(request *proto.GetTaskRunLogsRequest, stream proto.Gofer_GetTaskRunLogsServer) error
- func (api *API) GetToken(ctx context.Context, request *proto.GetTokenRequest) (*proto.GetTokenResponse, error)
- func (api *API) GetTrigger(ctx context.Context, request *proto.GetTriggerRequest) (*proto.GetTriggerResponse, error)
- func (api *API) GetTriggerEvent(ctx context.Context, request *proto.GetTriggerEventRequest) (*proto.GetTriggerEventResponse, error)
- func (api *API) ListNamespaces(ctx context.Context, request *proto.ListNamespacesRequest) (*proto.ListNamespacesResponse, error)
- func (api *API) ListPipelines(ctx context.Context, request *proto.ListPipelinesRequest) (*proto.ListPipelinesResponse, error)
- func (api *API) ListRegistryAuths(ctx context.Context, request *proto.ListRegistryAuthsRequest) (*proto.ListRegistryAuthsResponse, error)
- func (api *API) ListRuns(ctx context.Context, request *proto.ListRunsRequest) (*proto.ListRunsResponse, error)
- func (api *API) ListTaskRuns(ctx context.Context, request *proto.ListTaskRunsRequest) (*proto.ListTaskRunsResponse, error)
- func (api *API) ListTriggerEvents(ctx context.Context, request *proto.ListTriggerEventsRequest) (*proto.ListTriggerEventsResponse, error)
- func (api *API) ListTriggers(ctx context.Context, request *proto.ListTriggersRequest) (*proto.ListTriggersResponse, error)
- func (api *API) PutPipelineObject(ctx context.Context, request *proto.PutPipelineObjectRequest) (*proto.PutPipelineObjectResponse, error)
- func (api *API) PutRunObject(ctx context.Context, request *proto.PutRunObjectRequest) (*proto.PutRunObjectResponse, error)
- func (api *API) RemoveRegistryAuth(ctx context.Context, request *proto.RemoveRegistryAuthRequest) (*proto.RemoveRegistryAuthResponse, error)
- func (api *API) RepairOrphan(ctx context.Context, request *proto.RepairOrphanRequest) (*proto.RepairOrphanResponse, error)
- func (api *API) RetryRun(ctx context.Context, request *proto.RetryRunRequest) (*proto.RetryRunResponse, error)
- func (api *API) StartAPIService()
- func (api *API) StartRun(ctx context.Context, request *proto.StartRunRequest) (*proto.StartRunResponse, error)
- func (api *API) ToggleEventIngress(ctx context.Context, request *proto.ToggleEventIngressRequest) (*proto.ToggleEventIngressResponse, error)
- func (api *API) UpdateNamespace(ctx context.Context, request *proto.UpdateNamespaceRequest) (*proto.UpdateNamespaceResponse, error)
- func (api *API) UpdatePipelineByURL(ctx context.Context, request *proto.UpdatePipelineByURLRequest) (*proto.UpdatePipelineByURLResponse, error)
- func (api *API) UpdatePipelineRaw(ctx context.Context, request *proto.UpdatePipelineRawRequest) (*proto.UpdatePipelineRawResponse, error)
- type CancelContext
Constants ¶
View Source
const ( ObjectPipelineKeyFmt = "%s_%s_%s" // namespaceid_pipelineid_key ObjectRunKeyFmt = "%s_%s_%d_%s" // namespaceid_pipelineid_runid_key )
View Source
const ( TASKCONTAINERIDFORMAT = "%s_%d_%s" // pipelineid_runid_taskrunid // GOFEREOF is a special string marker we include at the end of log files. // It denotes that no further logs will be written. This is to provide the functionality for downstream // applications to follow log files and not also have to monitor the container for state to know when // logs will not longer be printed. GOFEREOF string = "GOFER_EOF" )
View Source
const TRIGGERCONTAINERIDFORMAT = "trigger_%s" // trigger_triggerKind
Variables ¶
View Source
var ( // ErrPipelineNotActive is returned when a request is made against a pipeline that is not in the active state. ErrPipelineNotActive = errors.New("api: pipeline is not in state 'active'") // ErrPipelineActive is returned when a request is made against a pipeline in the active state. ErrPipelineActive = errors.New("api: pipeline is in state 'active'") // ErrPipelineAbandoned is returned when a request is made against a pipeline in the abandoned state. ErrPipelineAbandoned = errors.New("api: pipeline is in state 'abandoned'") // ErrPipelineRunsInProgress is returned when a request is made against a pipeline with currently in progress runs. ErrPipelineRunsInProgress = errors.New("api: pipeline has runs which are still in progress") // ErrTriggerConfigNotValid is returned when a pipeline configuration contains is not valid for the trigger requested. ErrTriggerConfigNotValid = errors.New("api: trigger configuration is invalid") // ErrTriggerNotFound is returned when a pipeline configuration contains a trigger that was not registered with the API. ErrTriggerNotFound = errors.New("api: trigger is not found") )
Functions ¶
func StartEventsService ¶
StartEventsService starts the events http service, which is used to pass external events (like a github webhook) to triggers.
Types ¶
type API ¶
type API struct { // We opt out of forward compatibility with this embedded interface. This is required by GRPC. // // We don't embed the "proto.UnimplementedGoferServer" as there should never(I assume this will come back to bite me) // be an instance where we add proto methods without also updating the server to support those methods. // There is the added benefit that without it embedded we get compile time errors when a function isn't correctly // implemented. Saving us from weird "Unimplemented" RPC bugs. proto.UnsafeGoferServer // contains filtered or unexported fields }
API represents the main Gofer service API. It is run using a GRPC/HTTP combined server. This main API handles 99% of interactions with the gofer service itself and is only missing the hooks for the gofer events service.
func NewAPI ¶
func NewAPI(config *config.API, storage storage.Engine, scheduler scheduler.Engine, objectStore objectstore.Engine) (*API, error)
NewAPI creates a new instance of the main Gofer API service.
func (*API) AbandonPipeline ¶
func (api *API) AbandonPipeline(ctx context.Context, request *proto.AbandonPipelineRequest) (*proto.AbandonPipelineResponse, error)
func (*API) AddRegistryAuth ¶
func (api *API) AddRegistryAuth(ctx context.Context, request *proto.AddRegistryAuthRequest) (*proto.AddRegistryAuthResponse, error)
func (*API) BatchGetRuns ¶
func (api *API) BatchGetRuns(ctx context.Context, request *proto.BatchGetRunsRequest) (*proto.BatchGetRunsResponse, error)
func (*API) BatchGetTriggerEvents ¶
func (api *API) BatchGetTriggerEvents(ctx context.Context, request *proto.BatchGetTriggerEventsRequest) (*proto.BatchGetTriggerEventsResponse, error)
func (*API) BootstrapToken ¶
func (api *API) BootstrapToken(ctx context.Context, request *proto.BootstrapTokenRequest) (*proto.BootstrapTokenResponse, error)
func (*API) CancelAllRuns ¶
func (api *API) CancelAllRuns(ctx context.Context, request *proto.CancelAllRunsRequest) (*proto.CancelAllRunsResponse, error)
func (*API) CancelRun ¶
func (api *API) CancelRun(ctx context.Context, request *proto.CancelRunRequest) (*proto.CancelRunResponse, error)
func (*API) CancelTaskRun ¶
func (api *API) CancelTaskRun(ctx context.Context, request *proto.CancelTaskRunRequest) (*proto.CancelTaskRunResponse, error)
func (*API) CreateNamespace ¶
func (api *API) CreateNamespace(ctx context.Context, request *proto.CreateNamespaceRequest) (*proto.CreateNamespaceResponse, error)
func (*API) CreatePipelineByURL ¶
func (api *API) CreatePipelineByURL(ctx context.Context, request *proto.CreatePipelineByURLRequest) (*proto.CreatePipelineByURLResponse, error)
func (*API) CreatePipelineRaw ¶
func (api *API) CreatePipelineRaw(ctx context.Context, request *proto.CreatePipelineRawRequest) (*proto.CreatePipelineRawResponse, error)
func (*API) CreateToken ¶
func (api *API) CreateToken(ctx context.Context, request *proto.CreateTokenRequest) (*proto.CreateTokenResponse, error)
func (*API) DeleteNamespace ¶
func (api *API) DeleteNamespace(ctx context.Context, request *proto.DeleteNamespaceRequest) (*proto.DeleteNamespaceResponse, error)
func (*API) DeletePipelineObject ¶
func (api *API) DeletePipelineObject(ctx context.Context, request *proto.DeletePipelineObjectRequest) (*proto.DeletePipelineObjectResponse, error)
func (*API) DeleteRunObject ¶
func (api *API) DeleteRunObject(ctx context.Context, request *proto.DeleteRunObjectRequest) (*proto.DeleteRunObjectResponse, error)
func (*API) DeleteTaskRunLogs ¶
func (api *API) DeleteTaskRunLogs(ctx context.Context, request *proto.DeleteTaskRunLogsRequest) (*proto.DeleteTaskRunLogsResponse, error)
func (*API) DeleteToken ¶
func (api *API) DeleteToken(ctx context.Context, request *proto.DeleteTokenRequest) (*proto.DeleteTokenResponse, error)
func (*API) DisablePipeline ¶
func (api *API) DisablePipeline(ctx context.Context, request *proto.DisablePipelineRequest) (*proto.DisablePipelineResponse, error)
func (*API) EnablePipeline ¶
func (api *API) EnablePipeline(ctx context.Context, request *proto.EnablePipelineRequest) (*proto.EnablePipelineResponse, error)
func (*API) GetNamespace ¶
func (api *API) GetNamespace(ctx context.Context, request *proto.GetNamespaceRequest) (*proto.GetNamespaceResponse, error)
func (*API) GetPipeline ¶
func (api *API) GetPipeline(ctx context.Context, request *proto.GetPipelineRequest) (*proto.GetPipelineResponse, error)
func (*API) GetPipelineObject ¶
func (api *API) GetPipelineObject(ctx context.Context, request *proto.GetPipelineObjectRequest) (*proto.GetPipelineObjectResponse, error)
func (*API) GetRun ¶
func (api *API) GetRun(ctx context.Context, request *proto.GetRunRequest) (*proto.GetRunResponse, error)
func (*API) GetRunObject ¶
func (api *API) GetRunObject(ctx context.Context, request *proto.GetRunObjectRequest) (*proto.GetRunObjectResponse, error)
func (*API) GetSystemInfo ¶
func (api *API) GetSystemInfo(context context.Context, request *proto.GetSystemInfoRequest) (*proto.GetSystemInfoResponse, error)
GetSystemInfo returns system information and health
func (*API) GetTaskRun ¶
func (api *API) GetTaskRun(ctx context.Context, request *proto.GetTaskRunRequest) (*proto.GetTaskRunResponse, error)
func (*API) GetTaskRunLogs ¶
func (api *API) GetTaskRunLogs(request *proto.GetTaskRunLogsRequest, stream proto.Gofer_GetTaskRunLogsServer) error
func (*API) GetToken ¶
func (api *API) GetToken(ctx context.Context, request *proto.GetTokenRequest) (*proto.GetTokenResponse, error)
func (*API) GetTrigger ¶
func (api *API) GetTrigger(ctx context.Context, request *proto.GetTriggerRequest) (*proto.GetTriggerResponse, error)
func (*API) GetTriggerEvent ¶
func (api *API) GetTriggerEvent(ctx context.Context, request *proto.GetTriggerEventRequest) (*proto.GetTriggerEventResponse, error)
func (*API) ListNamespaces ¶
func (api *API) ListNamespaces(ctx context.Context, request *proto.ListNamespacesRequest) (*proto.ListNamespacesResponse, error)
func (*API) ListPipelines ¶
func (api *API) ListPipelines(ctx context.Context, request *proto.ListPipelinesRequest) (*proto.ListPipelinesResponse, error)
func (*API) ListRegistryAuths ¶
func (api *API) ListRegistryAuths(ctx context.Context, request *proto.ListRegistryAuthsRequest) (*proto.ListRegistryAuthsResponse, error)
func (*API) ListRuns ¶
func (api *API) ListRuns(ctx context.Context, request *proto.ListRunsRequest) (*proto.ListRunsResponse, error)
func (*API) ListTaskRuns ¶
func (api *API) ListTaskRuns(ctx context.Context, request *proto.ListTaskRunsRequest) (*proto.ListTaskRunsResponse, error)
func (*API) ListTriggerEvents ¶
func (api *API) ListTriggerEvents(ctx context.Context, request *proto.ListTriggerEventsRequest) (*proto.ListTriggerEventsResponse, error)
func (*API) ListTriggers ¶
func (api *API) ListTriggers(ctx context.Context, request *proto.ListTriggersRequest) (*proto.ListTriggersResponse, error)
func (*API) PutPipelineObject ¶
func (api *API) PutPipelineObject(ctx context.Context, request *proto.PutPipelineObjectRequest) (*proto.PutPipelineObjectResponse, error)
func (*API) PutRunObject ¶
func (api *API) PutRunObject(ctx context.Context, request *proto.PutRunObjectRequest) (*proto.PutRunObjectResponse, error)
func (*API) RemoveRegistryAuth ¶
func (api *API) RemoveRegistryAuth(ctx context.Context, request *proto.RemoveRegistryAuthRequest) (*proto.RemoveRegistryAuthResponse, error)
func (*API) RepairOrphan ¶
func (api *API) RepairOrphan(ctx context.Context, request *proto.RepairOrphanRequest) (*proto.RepairOrphanResponse, error)
func (*API) RetryRun ¶
func (api *API) RetryRun(ctx context.Context, request *proto.RetryRunRequest) (*proto.RetryRunResponse, error)
func (*API) StartAPIService ¶
func (api *API) StartAPIService()
StartAPIService starts the Gofer API service and blocks until a SIGINT or SIGTERM is received.
func (*API) StartRun ¶
func (api *API) StartRun(ctx context.Context, request *proto.StartRunRequest) (*proto.StartRunResponse, error)
func (*API) ToggleEventIngress ¶
func (api *API) ToggleEventIngress(ctx context.Context, request *proto.ToggleEventIngressRequest) (*proto.ToggleEventIngressResponse, error)
func (*API) UpdateNamespace ¶
func (api *API) UpdateNamespace(ctx context.Context, request *proto.UpdateNamespaceRequest) (*proto.UpdateNamespaceResponse, error)
func (*API) UpdatePipelineByURL ¶
func (api *API) UpdatePipelineByURL(ctx context.Context, request *proto.UpdatePipelineByURLRequest) (*proto.UpdatePipelineByURLResponse, error)
func (*API) UpdatePipelineRaw ¶
func (api *API) UpdatePipelineRaw(ctx context.Context, request *proto.UpdatePipelineRawRequest) (*proto.UpdatePipelineRawResponse, error)
type CancelContext ¶
type CancelContext struct {
// contains filtered or unexported fields
}
Source Files ¶
Click to show internal directories.
Click to hide internal directories.