Documentation ¶
Overview ¶
Package faas makes possible the communication with the OpenFaaS service.
Index ¶
- func ComputeFunctionMD5(fn *Function) string
- func FunctionGet(functionName string) (*Function, *APIResponse, error)
- func FunctionGetAvailableReplicas(serviceName string) (uint, error)
- func FunctionGetReplicas(serviceName string) (uint, error)
- func FunctionsGet() ([]Function, *APIResponse, error)
- func GenFunctionGet(host string, functionName string) (*Function, *APIResponse, error)
- func GenFunctionGetAvailableReplicas(host string, serviceName string) (uint, error)
- func GenFunctionGetReplicas(host string, serviceName string) (uint, error)
- func GenFunctionsGet(host string) ([]Function, *APIResponse, 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 *APIResponse) 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 APIResponse
- func FunctionDeploy(function Function) (*APIResponse, error)
- func FunctionExecute(functionName string, payload []byte, contentType string) (*APIResponse, error)
- func FunctionScale(functionName string, replicas uint) (*APIResponse, error)
- func FunctionScaleByOne(functionName string) (*APIResponse, error)
- func FunctionScaleDownByOne(functionName string) (*APIResponse, error)
- func GenFunctionDeploy(host string, function Function) (*APIResponse, error)
- func GenFunctionExecute(host string, functionName string, payload []byte, contentType string) (*APIResponse, error)
- func GenFunctionScale(host string, functionName string, replicas uint) (*APIResponse, error)
- func GenFunctionScaleByOne(host string, functionName string) (*APIResponse, error)
- func GenFunctionScaleDownByOne(host string, functionName string) (*APIResponse, error)
- type CurrentLoad
- type ErrorFunctionNotFound
- type ErrorGeneric
- type ErrorHttpCannotCreateRequest
- type ErrorImpossibleToScaleFunction
- type ErrorInternal
- type Function
- type FunctionScalePayload
- type IdentifiableFunction
- type MachineResources
- type Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComputeFunctionMD5 ¶
ComputeFunctionMD5 computes the ID of a function
func FunctionGet ¶
func FunctionGet(functionName string) (*Function, *APIResponse, error)
func FunctionGetReplicas ¶
func FunctionsGet ¶
func FunctionsGet() ([]Function, *APIResponse, error)
func GenFunctionGet ¶
func GenFunctionGet(host string, functionName string) (*Function, *APIResponse, error)
func GenFunctionGetReplicas ¶
func GenFunctionsGet ¶
func GenFunctionsGet(host string) ([]Function, *APIResponse, error)
func GetApiFunctionUrl ¶
func GetApiScaleFunction ¶
func GetApiSystemFunctionUrl ¶
func GetDurationFromExecuteApiCallResponse ¶
func GetDurationFromExecuteApiCallResponse(res *APIResponse) float64
func SetAuthHeader ¶
Types ¶
type APIResponse ¶
func FunctionDeploy ¶
func FunctionDeploy(function Function) (*APIResponse, error)
func FunctionExecute ¶
func FunctionExecute(functionName string, payload []byte, contentType string) (*APIResponse, error)
func FunctionScale ¶
func FunctionScale(functionName string, replicas uint) (*APIResponse, error)
func FunctionScaleByOne ¶
func FunctionScaleByOne(functionName string) (*APIResponse, error)
func FunctionScaleDownByOne ¶
func FunctionScaleDownByOne(functionName string) (*APIResponse, error)
func GenFunctionDeploy ¶
func GenFunctionDeploy(host string, function Function) (*APIResponse, error)
func GenFunctionExecute ¶
func GenFunctionScale ¶
func GenFunctionScale(host string, functionName string, replicas uint) (*APIResponse, error)
func GenFunctionScaleByOne ¶
func GenFunctionScaleByOne(host string, functionName string) (*APIResponse, error)
func GenFunctionScaleDownByOne ¶
func GenFunctionScaleDownByOne(host string, functionName string) (*APIResponse, error)
type CurrentLoad ¶
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 ¶
func GenGetCurrentLoad(host string) (*CurrentLoad, error)
GetCurrentLoad parse the current load from OpenFaas
func GetCurrentLoad ¶
func GetCurrentLoad() (*CurrentLoad, error)
GetCurrentLoad parse the current load from OpenFaas
type ErrorFunctionNotFound ¶
type ErrorFunctionNotFound struct{}
func (ErrorFunctionNotFound) Error ¶
func (ErrorFunctionNotFound) Error() string
type ErrorGeneric ¶
type ErrorGeneric struct {
ResponseBody string
}
func (ErrorGeneric) Error ¶
func (e ErrorGeneric) Error() string
type ErrorHttpCannotCreateRequest ¶
type ErrorHttpCannotCreateRequest struct{}
func (ErrorHttpCannotCreateRequest) Error ¶
func (e ErrorHttpCannotCreateRequest) Error() string
type ErrorImpossibleToScaleFunction ¶
type ErrorImpossibleToScaleFunction struct{}
func (ErrorImpossibleToScaleFunction) Error ¶
func (e ErrorImpossibleToScaleFunction) Error() string
type ErrorInternal ¶
type ErrorInternal struct {
ResponseBody string
}
func (ErrorInternal) Error ¶
func (e ErrorInternal) Error() string
type Function ¶
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"` }
type FunctionScalePayload ¶
type IdentifiableFunction ¶
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 ¶
Click to show internal directories.
Click to hide internal directories.