gateway

package
v0.42.1 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateWorkloadResponse

type CreateWorkloadResponse struct {
	ID string `json:"id"`
}

CreateWorkloadResponse represents the response returned to the user on workload creation

type Endpoint

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

Endpoint wraps an async-gateway Service with HTTP logic

func NewEndpoint

func NewEndpoint(svc Service, logger *zap.SugaredLogger) *Endpoint

NewEndpoint creates and initializes a new Endpoint struct

func (*Endpoint) CreateWorkload

func (e *Endpoint) CreateWorkload(w http.ResponseWriter, r *http.Request)

CreateWorkload is a handler for the async-gateway service workload creation route

func (*Endpoint) GetWorkload

func (e *Endpoint) GetWorkload(w http.ResponseWriter, r *http.Request)

GetWorkload is a handler for the async-gateway service workload retrieval route

type GetWorkloadResponse

type GetWorkloadResponse struct {
	ID        string        `json:"id"`
	Status    async.Status  `json:"status"`
	Result    *UserResponse `json:"result,omitempty"`
	Timestamp *time.Time    `json:"timestamp,omitempty"`
}

GetWorkloadResponse represents the workload response that is returned to the user

type Queue

type Queue interface {
	SendMessage(message string, uniqueID string) error
}

Queue is an interface to abstract communication with event queues

func NewSQS

func NewSQS(queueURL string, sess *session.Session) Queue

NewSQS creates a new SQS client that satisfies the Queue interface

type Service

type Service interface {
	CreateWorkload(id string, apiName string, queueURL string, payload io.Reader, headers http.Header) (string, error)
	GetWorkload(id string, apiName string) (GetWorkloadResponse, error)
}

Service provides an interface to the async-gateway business logic

func NewService

func NewService(clusterUID string, storage Storage, logger *zap.SugaredLogger, session session.Session) Service

NewService creates a new async-gateway service

type Storage

type Storage interface {
	Upload(key string, payload io.Reader, contentType string) error
	Download(key string) ([]byte, error)
	List(key string) ([]string, error)
	GetLastModified(key string) (time.Time, error)
}

Storage is an interface that abstracts cloud storage uploading

func NewS3

func NewS3(sess *session.Session, bucket string) Storage

NewS3 creates a new S3 client that satisfies the Storage interface

type UserResponse

type UserResponse = map[string]interface{}

UserResponse represents the user's API response, which has to be JSON serializable

Jump to

Keyboard shortcuts

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