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 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
type UserResponse ¶
type UserResponse = map[string]interface{}
UserResponse represents the user's API response, which has to be JSON serializable