apiserver

package
v0.0.0-...-98ba599 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2020 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Overview

Package apiserver contains all request handlers for gRPC and HTTP servers.

It has these top-level request handlers:

Admin	   - Administrative functionality related to managing the workflow engine.
Invocation - Functionality related to managing invocations.
Workflow   - functionality related to managing workflows.

The purpose of this package is purely to provide handlers to gRPC and HTTP servers. Therefore, it should not contain any logic (validation, composition, etc.) related to the workflows, invocations or any other targets that it provides. All this logic should be placed in the actual packages that are responsible for the business logic, such as `api`.

Package apiserver is a generated protocol buffer package.

It is generated from these files:

pkg/apiserver/apiserver.proto

It has these top-level messages:

WorkflowList
AddTaskRequest
InvocationListQuery
WorkflowInvocationList
ObjectEvents
Health

Package apiserver is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	CreateSyncPollInterval = 100 * time.Millisecond
)
View Source
const StatusOK = "OK!"

Variables

This section is empty.

Functions

func RegisterAdminAPIHandler

func RegisterAdminAPIHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterAdminAPIHandler registers the http handlers for service AdminAPI to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterAdminAPIHandlerClient

func RegisterAdminAPIHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AdminAPIClient) error

RegisterAdminAPIHandler registers the http handlers for service AdminAPI to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "AdminAPIClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "AdminAPIClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "AdminAPIClient" to call the correct interceptors.

func RegisterAdminAPIHandlerFromEndpoint

func RegisterAdminAPIHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterAdminAPIHandlerFromEndpoint is same as RegisterAdminAPIHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterAdminAPIServer

func RegisterAdminAPIServer(s *grpc.Server, srv AdminAPIServer)

func RegisterWorkflowAPIHandler

func RegisterWorkflowAPIHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterWorkflowAPIHandler registers the http handlers for service WorkflowAPI to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterWorkflowAPIHandlerClient

func RegisterWorkflowAPIHandlerClient(ctx context.Context, mux *runtime.ServeMux, client WorkflowAPIClient) error

RegisterWorkflowAPIHandler registers the http handlers for service WorkflowAPI to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "WorkflowAPIClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "WorkflowAPIClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "WorkflowAPIClient" to call the correct interceptors.

func RegisterWorkflowAPIHandlerFromEndpoint

func RegisterWorkflowAPIHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterWorkflowAPIHandlerFromEndpoint is same as RegisterWorkflowAPIHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterWorkflowAPIServer

func RegisterWorkflowAPIServer(s *grpc.Server, srv WorkflowAPIServer)

func RegisterWorkflowInvocationAPIHandler

func RegisterWorkflowInvocationAPIHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterWorkflowInvocationAPIHandler registers the http handlers for service WorkflowInvocationAPI to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterWorkflowInvocationAPIHandlerClient

func RegisterWorkflowInvocationAPIHandlerClient(ctx context.Context, mux *runtime.ServeMux, client WorkflowInvocationAPIClient) error

RegisterWorkflowInvocationAPIHandler registers the http handlers for service WorkflowInvocationAPI to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "WorkflowInvocationAPIClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "WorkflowInvocationAPIClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "WorkflowInvocationAPIClient" to call the correct interceptors.

func RegisterWorkflowInvocationAPIHandlerFromEndpoint

func RegisterWorkflowInvocationAPIHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterWorkflowInvocationAPIHandlerFromEndpoint is same as RegisterWorkflowInvocationAPIHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterWorkflowInvocationAPIServer

func RegisterWorkflowInvocationAPIServer(s *grpc.Server, srv WorkflowInvocationAPIServer)

Types

type AddTaskRequest

type AddTaskRequest struct {
	InvocationID string                         `protobuf:"bytes,1,opt,name=invocationID" json:"invocationID,omitempty"`
	Task         *fission_workflows_types1.Task `protobuf:"bytes,2,opt,name=task" json:"task,omitempty"`
}

func (*AddTaskRequest) Descriptor

func (*AddTaskRequest) Descriptor() ([]byte, []int)

func (*AddTaskRequest) GetInvocationID

func (m *AddTaskRequest) GetInvocationID() string

func (*AddTaskRequest) GetTask

func (*AddTaskRequest) ProtoMessage

func (*AddTaskRequest) ProtoMessage()

func (*AddTaskRequest) Reset

func (m *AddTaskRequest) Reset()

func (*AddTaskRequest) String

func (m *AddTaskRequest) String() string

type Admin

type Admin struct {
}

Admin is responsible for all administrative functions related to managing the workflow engine.

func (*Admin) Status

func (as *Admin) Status(ctx context.Context, _ *empty.Empty) (*Health, error)

func (*Admin) Version

func (as *Admin) Version(ctx context.Context, _ *empty.Empty) (*version.Info, error)

type AdminAPIClient

type AdminAPIClient interface {
	Status(ctx context.Context, in *google_protobuf3.Empty, opts ...grpc.CallOption) (*Health, error)
	Version(ctx context.Context, in *google_protobuf3.Empty, opts ...grpc.CallOption) (*fission_workflows_version.Info, error)
}

func NewAdminAPIClient

func NewAdminAPIClient(cc *grpc.ClientConn) AdminAPIClient

type Client

type Client struct {
	Admin      AdminAPIClient
	Invocation WorkflowInvocationAPIClient
	Workflow   WorkflowAPIClient
}

func Connect

func Connect(addr string) (*Client, error)

Connect attempts to connect to the server at addr and returns a Client.

addr should be of the format <hostname>:<port>, without a method. (e.g. workflows:5555)

func NewClient

func NewClient(conn *grpc.ClientConn) *Client

func (*Client) Await

func (c *Client) Await(ctx context.Context) error

Await blocks until the gRPC connection has been established

type Empty

type Empty = empty.Empty

type Health

type Health struct {
	Status string `protobuf:"bytes,1,opt,name=status" json:"status,omitempty"`
}

func (*Health) Descriptor

func (*Health) Descriptor() ([]byte, []int)

func (*Health) GetStatus

func (m *Health) GetStatus() string

func (*Health) ProtoMessage

func (*Health) ProtoMessage()

func (*Health) Reset

func (m *Health) Reset()

func (*Health) String

func (m *Health) String() string

type Invocation

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

Invocation is responsible for all functionality related to managing invocations.

func (*Invocation) AddTask

func (gi *Invocation) AddTask(ctx context.Context, req *AddTaskRequest) (*empty.Empty, error)

func (*Invocation) Cancel

func (gi *Invocation) Cancel(ctx context.Context, objectMetadata *types.ObjectMetadata) (*empty.Empty, error)

func (*Invocation) Events

func (gi *Invocation) Events(ctx context.Context, md *types.ObjectMetadata) (*ObjectEvents, error)

func (*Invocation) Get

func (gi *Invocation) Get(ctx context.Context, objectMetadata *types.ObjectMetadata) (*types.WorkflowInvocation, error)

func (*Invocation) Invoke

func (*Invocation) InvokeSync

func (*Invocation) List

func (*Invocation) Validate

func (gi *Invocation) Validate(ctx context.Context, spec *types.WorkflowInvocationSpec) (*empty.Empty, error)

type InvocationListQuery

type InvocationListQuery struct {
	Workflows []string `protobuf:"bytes,1,rep,name=workflows" json:"workflows,omitempty"`
}

func (*InvocationListQuery) Descriptor

func (*InvocationListQuery) Descriptor() ([]byte, []int)

func (*InvocationListQuery) GetWorkflows

func (m *InvocationListQuery) GetWorkflows() []string

func (*InvocationListQuery) ProtoMessage

func (*InvocationListQuery) ProtoMessage()

func (*InvocationListQuery) Reset

func (m *InvocationListQuery) Reset()

func (*InvocationListQuery) String

func (m *InvocationListQuery) String() string

type ObjectEvents

type ObjectEvents struct {
	Metadata *fission_workflows_types1.ObjectMetadata `protobuf:"bytes,1,opt,name=metadata" json:"metadata,omitempty"`
	Events   []*fission_workflows_eventstore.Event    `protobuf:"bytes,2,rep,name=events" json:"events,omitempty"`
}

func (*ObjectEvents) Descriptor

func (*ObjectEvents) Descriptor() ([]byte, []int)

func (*ObjectEvents) GetEvents

func (*ObjectEvents) GetMetadata

func (*ObjectEvents) ProtoMessage

func (*ObjectEvents) ProtoMessage()

func (*ObjectEvents) Reset

func (m *ObjectEvents) Reset()

func (*ObjectEvents) String

func (m *ObjectEvents) String() string

type Workflow

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

Workflow is responsible for all functionality related to managing workflows.

func NewWorkflow

func NewWorkflow(api *api.Workflow, store *store.Workflows, backend fes.Backend) *Workflow

func (*Workflow) Create

func (ga *Workflow) Create(ctx context.Context, spec *types.WorkflowSpec) (*types.ObjectMetadata, error)

func (*Workflow) CreateSync

func (ga *Workflow) CreateSync(ctx context.Context, spec *types.WorkflowSpec) (*types.Workflow, error)

func (*Workflow) Delete

func (ga *Workflow) Delete(ctx context.Context, workflowID *types.ObjectMetadata) (*empty.Empty, error)

func (*Workflow) Events

func (ga *Workflow) Events(ctx context.Context, md *types.ObjectMetadata) (*ObjectEvents, error)

func (*Workflow) Get

func (ga *Workflow) Get(ctx context.Context, workflowID *types.ObjectMetadata) (*types.Workflow, error)

func (*Workflow) List

func (ga *Workflow) List(ctx context.Context, req *empty.Empty) (*WorkflowList, error)

func (*Workflow) Validate

func (ga *Workflow) Validate(ctx context.Context, spec *types.WorkflowSpec) (*empty.Empty, error)

type WorkflowInvocationAPIClient

type WorkflowInvocationAPIClient interface {
	// Create a new workflow invocation
	//
	// In case the invocation specification is missing fields or contains invalid fields, a HTTP 400 is returned.
	Invoke(ctx context.Context, in *fission_workflows_types1.WorkflowInvocationSpec, opts ...grpc.CallOption) (*fission_workflows_types1.ObjectMetadata, error)
	InvokeSync(ctx context.Context, in *fission_workflows_types1.WorkflowInvocationSpec, opts ...grpc.CallOption) (*fission_workflows_types1.WorkflowInvocation, error)
	AddTask(ctx context.Context, in *AddTaskRequest, opts ...grpc.CallOption) (*google_protobuf3.Empty, error)
	// Cancel a workflow invocation
	//
	// This action is irreverisble. A canceled invocation cannot be resumed or restarted.
	// In case that an invocation already is canceled, has failed or has completed, nothing happens.
	// In case that an invocation does not exist a HTTP 404 error status is returned.
	Cancel(ctx context.Context, in *fission_workflows_types1.ObjectMetadata, opts ...grpc.CallOption) (*google_protobuf3.Empty, error)
	List(ctx context.Context, in *InvocationListQuery, opts ...grpc.CallOption) (*WorkflowInvocationList, error)
	// Get the specification and status of a workflow invocation
	//
	// Get returns three different aspects of the workflow invocation, namely the spec (specification), status and logs.
	// To lighten the request load, consider using a more specific request.
	Get(ctx context.Context, in *fission_workflows_types1.ObjectMetadata, opts ...grpc.CallOption) (*fission_workflows_types1.WorkflowInvocation, error)
	Events(ctx context.Context, in *fission_workflows_types1.ObjectMetadata, opts ...grpc.CallOption) (*ObjectEvents, error)
	Validate(ctx context.Context, in *fission_workflows_types1.WorkflowInvocationSpec, opts ...grpc.CallOption) (*google_protobuf3.Empty, error)
}

func NewWorkflowInvocationAPIClient

func NewWorkflowInvocationAPIClient(cc *grpc.ClientConn) WorkflowInvocationAPIClient

type WorkflowInvocationAPIServer

type WorkflowInvocationAPIServer interface {
	// Create a new workflow invocation
	//
	// In case the invocation specification is missing fields or contains invalid fields, a HTTP 400 is returned.
	Invoke(context.Context, *fission_workflows_types1.WorkflowInvocationSpec) (*fission_workflows_types1.ObjectMetadata, error)
	InvokeSync(context.Context, *fission_workflows_types1.WorkflowInvocationSpec) (*fission_workflows_types1.WorkflowInvocation, error)
	AddTask(context.Context, *AddTaskRequest) (*google_protobuf3.Empty, error)
	// Cancel a workflow invocation
	//
	// This action is irreverisble. A canceled invocation cannot be resumed or restarted.
	// In case that an invocation already is canceled, has failed or has completed, nothing happens.
	// In case that an invocation does not exist a HTTP 404 error status is returned.
	Cancel(context.Context, *fission_workflows_types1.ObjectMetadata) (*google_protobuf3.Empty, error)
	List(context.Context, *InvocationListQuery) (*WorkflowInvocationList, error)
	// Get the specification and status of a workflow invocation
	//
	// Get returns three different aspects of the workflow invocation, namely the spec (specification), status and logs.
	// To lighten the request load, consider using a more specific request.
	Get(context.Context, *fission_workflows_types1.ObjectMetadata) (*fission_workflows_types1.WorkflowInvocation, error)
	Events(context.Context, *fission_workflows_types1.ObjectMetadata) (*ObjectEvents, error)
	Validate(context.Context, *fission_workflows_types1.WorkflowInvocationSpec) (*google_protobuf3.Empty, error)
}

func NewInvocation

func NewInvocation(api *api.Invocation, invocations *store.Invocations, workflows *store.Workflows, backend fes.Backend) WorkflowInvocationAPIServer

type WorkflowInvocationList

type WorkflowInvocationList struct {
	Invocations []string `protobuf:"bytes,1,rep,name=invocations" json:"invocations,omitempty"`
}

func (*WorkflowInvocationList) Descriptor

func (*WorkflowInvocationList) Descriptor() ([]byte, []int)

func (*WorkflowInvocationList) GetInvocations

func (m *WorkflowInvocationList) GetInvocations() []string

func (*WorkflowInvocationList) ProtoMessage

func (*WorkflowInvocationList) ProtoMessage()

func (*WorkflowInvocationList) Reset

func (m *WorkflowInvocationList) Reset()

func (*WorkflowInvocationList) String

func (m *WorkflowInvocationList) String() string

type WorkflowList

type WorkflowList struct {
	Workflows []string `protobuf:"bytes,1,rep,name=workflows" json:"workflows,omitempty"`
}

func (*WorkflowList) Descriptor

func (*WorkflowList) Descriptor() ([]byte, []int)

func (*WorkflowList) GetWorkflows

func (m *WorkflowList) GetWorkflows() []string

func (*WorkflowList) ProtoMessage

func (*WorkflowList) ProtoMessage()

func (*WorkflowList) Reset

func (m *WorkflowList) Reset()

func (*WorkflowList) String

func (m *WorkflowList) String() string

Directories

Path Synopsis
Package httpclient is a lightweight implementation of a client for the HTTP gateway.
Package httpclient is a lightweight implementation of a client for the HTTP gateway.

Jump to

Keyboard shortcuts

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