func ComputeFunctionMD5(fn *Function) string
ComputeFunctionMD5 computes the ID of a function
func FunctionDeploy(function Function) (*types.FaasApiResponse, error)
func FunctionExecute(functionName string, payload []byte, contentType string) (*types.FaasApiResponse, error)
func FunctionGetAvailableReplicas(serviceName string) (uint, error)
func FunctionGetReplicas(serviceName string) (uint, error)
func FunctionScale(functionName string, replicas uint) (*types.FaasApiResponse, error)
func FunctionScaleByOne(functionName string) (*types.FaasApiResponse, error)
func FunctionScaleDownByOne(functionName string) (*types.FaasApiResponse, error)
func GenFunctionDeploy(host string, function Function) (*types.FaasApiResponse, error)
func GenFunctionExecute(host string, functionName string, payload []byte, contentType string) (*types.FaasApiResponse, error)
func GenFunctionGetAvailableReplicas(host string, serviceName string) (uint, error)
func GenFunctionGetReplicas(host string, serviceName string) (uint, error)
func GenFunctionScale(host string, functionName string, replicas uint) (*types.FaasApiResponse, error)
func GenFunctionScaleByOne(host string, functionName string) (*types.FaasApiResponse, error)
func GenFunctionScaleDownByOne(host string, functionName string) (*types.FaasApiResponse, error)
func GetApiFunctionUrl(host string, functionName string) string
func GetApiScaleFunction(host string, functionName string) string
func GetApiSystemFunctionUrl(host string, functionName string) string
func GetApiSystemFunctionsUrl(host string) string
func GetApiUrl(host string) string
func GetDurationFromExecuteApiCallResponse(res *types.FaasApiResponse) float64
func HttpGet(url string) (*http.Response, error)
func HttpPost(url string, payload []byte, contentType string) (*http.Response, error)
func HttpPostJSON(url string, json string) (*http.Response, error)
func SetAuthHeader(req *http.Request)
type CurrentLoad struct {
NumberOfServices uint `json:"total_services" bson:"total_services"`
TotalReplicas uint `json:"total_replicas" bson:"total_running_replicas"`
TotalAvailableReplicas uint `json:"total_available_replicas" bson:"total_available_replicas"`
}
func GenGetCurrentLoad(host string) (*CurrentLoad, error)
GetCurrentLoad parse the current load from OpenFaas
func GetCurrentLoad() (*CurrentLoad, error)
GetCurrentLoad parse the current load from OpenFaas
type ErrorFunctionNotFound struct{}
func (ErrorFunctionNotFound) Error() string
type ErrorGeneric struct {
ResponseBody string
}
func (e ErrorGeneric) Error() string
type ErrorHttpCannotCreateRequest struct{}
func (e ErrorHttpCannotCreateRequest) Error() string
type ErrorImpossibleToScaleFunction struct{}
func (e ErrorImpossibleToScaleFunction) Error() string
type ErrorInternal struct {
ResponseBody string
}
func (e ErrorInternal) Error() string
type Function struct {
Name string `json:"name,omitempty" bson:"name"`
Service string `json:"service,omitempty" bson:"service"`
Network string `json:"network,omitempty" bson:"network"`
Image string `json:"image,omitempty" bson:"image"`
EnvProcess string `json:"envProcess,omitempty" bson:"envProcess"`
EnvVars map[string]string `json:"envVars,omitempty" bson:"envVars"`
Constraints []string `json:"constraints,omitempty" bson:"constraints"`
Labels map[string]string `json:"labels,omitempty" bson:"labels"`
Annotations []string `json:"annotations,omitempty" bson:"annotations"`
Secrets []string `json:"secrets,omitempty" bson:"secrets"`
RegistryAuth string `json:"registryAuth,omitempty" bson:"registryAuth"`
Limits MachineResources `json:"limits,omitempty" bson:"limits"`
Requests MachineResources `json:"requests,omitempty" bson:"requests"`
InvocationCount uint `json:"invocationCount,omitempty" bson:"invocationCount"`
Replicas uint `json:"replicas,omitempty" bson:"replicas"`
AvailableReplicas uint `json:"availableReplicas,omitempty" bson:"availableReplicas"`
}
func FunctionGet(functionName string) (*Function, *types.FaasApiResponse, error)
func FunctionsGet() ([]Function, *types.FaasApiResponse, error)
func GenFunctionGet(host string, functionName string) (*Function, *types.FaasApiResponse, error)
func GenFunctionsGet(host string) ([]Function, *types.FaasApiResponse, error)
type FunctionScalePayload struct {
Service string `json:"service,omitempty" bson:"service"`
Replicas uint `json:"replicas,omitempty" bson:"replicas"`
}
type IdentifiableFunction struct {
Name string `json:"name,omitempty" bson:"name"`
Service string `json:"service,omitempty" bson:"service"`
Network string `json:"network,omitempty" bson:"network"`
Image string `json:"image,omitempty" bson:"image"`
EnvProcess string `json:"envProcess,omitempty" bson:"envProcess"`
EnvVars map[string]string `json:"envVars,omitempty" bson:"envVars"`
Constraints []string `json:"constraints,omitempty" bson:"constraints"`
Labels map[string]string `json:"labels,omitempty" bson:"labels"`
Annotations []string `json:"annotations,omitempty" bson:"annotations"`
Secrets []string `json:"secrets,omitempty" bson:"secrets"`
RegistryAuth string `json:"registryAuth,omitempty" bson:"registryAuth"`
Limits MachineResources `json:"limits,omitempty" bson:"limits"`
Requests MachineResources `json:"requests,omitempty" bson:"requests"`
}
type MachineResources struct {
Memory string `json:"memory,omitempty" bson:"memory"`
CPU string `json:"cpu,omitempty" bson:"cpu"`
}
type Service struct {
OpenFaaSFunction Function `json:"openfaas_service,omitempty" bson:"openfaas_service"`
Deadline uint64 `json:"deadline,omitempty" bson:"deadline"`
}