requests

package
v0.0.0-...-5981ba6 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2019 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package requests package provides a client SDK or library for the OpenFaaS gateway REST API

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AsyncReport

type AsyncReport struct {
	FunctionName string  `json:"name"`
	StatusCode   int     `json:"statusCode"`
	TimeTaken    float64 `json:"timeTaken"`
}

AsyncReport is the report from a function executed on a queue worker.

type CreateFunctionRequest

type CreateFunctionRequest struct {

	// Service corresponds to a Docker Service
	Service string `json:"service"`

	// Image corresponds to a Docker image
	Image string `json:"image"`

	// Network is specific to Docker Swarm - default overlay network is: func_functions
	Network string `json:"network"`

	// EnvProcess corresponds to the fprocess variable for your container watchdog.
	EnvProcess string `json:"envProcess"`

	// EnvVars provides overrides for functions.
	EnvVars map[string]string `json:"envVars"`

	// RegistryAuth is the registry authentication (optional)
	// in the same encoded format as Docker native credentials
	// (see ~/.docker/config.json)
	RegistryAuth string `json:"registryAuth,omitempty"`

	// Constraints are specific to back-end orchestration platform
	Constraints []string `json:"constraints"`

	// Secrets list of secrets to be made available to function
	Secrets []string `json:"secrets"`

	// Labels are metadata for functions which may be used by the
	// back-end for making scheduling or routing decisions
	Labels *map[string]string `json:"labels"`

	// Annotations are metadata for functions which may be used by the
	// back-end for management, orchestration, events and build tasks
	Annotations *map[string]string `json:"annotations"`

	// Limits for function
	Limits *FunctionResources `json:"limits"`

	// Requests of resources requested by function
	Requests *FunctionResources `json:"requests"`

	// ReadOnlyRootFilesystem removes write-access from the root filesystem
	// mount-point.
	ReadOnlyRootFilesystem bool `json:"readOnlyRootFilesystem"`
}

CreateFunctionRequest create a function in the swarm.

type DeleteFunctionRequest

type DeleteFunctionRequest struct {
	FunctionName string `json:"functionName"`
}

DeleteFunctionRequest delete a deployed function

type ForwardRequest

type ForwardRequest struct {
	RawPath  string
	RawQuery string
	Method   string
}

ForwardRequest for proxying incoming requests

func NewForwardRequest

func NewForwardRequest(method string, url url.URL) ForwardRequest

NewForwardRequest create a ForwardRequest

func (*ForwardRequest) ToURL

func (f *ForwardRequest) ToURL(addr string, watchdogPort int) string

ToURL create formatted URL

type Function

type Function struct {
	Name            string  `json:"name"`
	Image           string  `json:"image"`
	InvocationCount float64 `json:"invocationCount"` // TODO: shouldn't this be int64?
	Replicas        uint64  `json:"replicas"`
	EnvProcess      string  `json:"envProcess"`

	// AvailableReplicas is the count of replicas ready to receive invocations as reported by the back-end
	AvailableReplicas uint64 `json:"availableReplicas"`

	// Labels are metadata for functions which may be used by the
	// back-end for making scheduling or routing decisions
	Labels *map[string]string `json:"labels"`

	// Annotations are metadata for functions which may be used by the
	// back-end for management, orchestration, events and build tasks
	Annotations *map[string]string `json:"annotations"`
}

Function exported for system/functions endpoint

type FunctionResources

type FunctionResources struct {
	Memory string `json:"memory"`
	CPU    string `json:"cpu"`
}

FunctionResources Memory and CPU

type PrometheusAlert

type PrometheusAlert struct {
	Status   string                 `json:"status"`
	Receiver string                 `json:"receiver"`
	Alerts   []PrometheusInnerAlert `json:"alerts"`
}

PrometheusAlert as produced by AlertManager

type PrometheusInnerAlert

type PrometheusInnerAlert struct {
	Status string                    `json:"status"`
	Labels PrometheusInnerAlertLabel `json:"labels"`
}

PrometheusInnerAlert PrometheusInnerAlert

type PrometheusInnerAlertLabel

type PrometheusInnerAlertLabel struct {
	AlertName    string `json:"alertname"`
	FunctionName string `json:"function_name"`
}

PrometheusInnerAlertLabel PrometheusInnerAlertLabel

type Secret

type Secret struct {
	Name  string `json:"name"`
	Value string `json:"value,omitempty"`
}

Secret for underlying orchestrator

Jump to

Keyboard shortcuts

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