proxy

package
v0.0.0-...-b0a70a3 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2020 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FunctionStoreList

func FunctionStoreList(store string) ([]schema.StoreItem, error)

FunctionStoreList returns functions from a store URL

func InvokeFunction

func InvokeFunction(gateway string, name string, bytesIn *[]byte, contentType string, query []string, headers []string, async bool, httpMethod string, tlsInsecure bool, namespace string) (*[]byte, error)

InvokeFunction a function

func MakeHTTPClient

func MakeHTTPClient(timeout *time.Duration, tlsInsecure bool) http.Client

MakeHTTPClient makes a HTTP client with good defaults for timeouts.

func SetAuth

func SetAuth(req *http.Request, gateway string)

SetAuth sets basic auth for the given gateway

func SetBasicAuth

func SetBasicAuth(req *http.Request, authConfig config.AuthConfig)

SetBasicAuth set basic authentication

func SetOauth2

func SetOauth2(req *http.Request, authConfig config.AuthConfig)

SetOauth2 set oauth2 token

func SetToken

func SetToken(req *http.Request, token string)

SetToken sets authentication token

Types

type Client

type Client struct {

	//ClientAuth a type implementing ClientAuth interface for client authentication
	ClientAuth ClientAuth
	//GatewayURL base URL of OpenFaaS gateway
	GatewayURL *url.URL
	//UserAgent user agent for the client
	UserAgent string
	// contains filtered or unexported fields
}

Client an API client to perform all operations

func NewClient

func NewClient(auth ClientAuth, gatewayURL string, transport http.RoundTripper, timeout *time.Duration) *Client

NewClient initializes a new API client

func (*Client) AddCheckRedirect

func (c *Client) AddCheckRedirect(checkRedirect func(*http.Request, []*http.Request) error)

AddCheckRedirect add CheckRedirect to the client

func (*Client) CreateSecret

func (c *Client) CreateSecret(ctx context.Context, secret types.Secret) (int, string)

CreateSecret create secret

func (*Client) DeleteFunction

func (c *Client) DeleteFunction(ctx context.Context, functionName string, namespace string) error

DeleteFunction delete a function from the OpenFaaS server

func (*Client) DeployFunction

func (c *Client) DeployFunction(context context.Context, spec *DeployFunctionSpec) int

DeployFunction first tries to deploy a function and if it exists will then attempt a rolling update. Warnings are suppressed for the second API call (if required.)

func (*Client) GetFunctionInfo

func (c *Client) GetFunctionInfo(ctx context.Context, functionName string, namespace string) (types.FunctionStatus, error)

GetFunctionInfo get an OpenFaaS function information

func (*Client) GetLogs

func (c *Client) GetLogs(ctx context.Context, params logs.Request) (<-chan logs.Message, error)

GetLogs return stream for the logs

func (*Client) GetSecretList

func (c *Client) GetSecretList(ctx context.Context, namespace string) ([]types.Secret, error)

GetSecretList get secrets list

func (*Client) GetSystemInfo

func (c *Client) GetSystemInfo(ctx context.Context) (map[string]interface{}, error)

GetSystemInfo get system information from /system/info endpoint

func (*Client) ListFunctions

func (c *Client) ListFunctions(ctx context.Context, namespace string) ([]types.FunctionStatus, error)

ListFunctions list deployed functions

func (*Client) ListNamespaces

func (c *Client) ListNamespaces(ctx context.Context) ([]string, error)

ListNamespaces lists available function namespaces

func (*Client) RemoveSecret

func (c *Client) RemoveSecret(ctx context.Context, secret types.Secret) error

RemoveSecret remove a secret via the OpenFaaS API by name

func (*Client) UpdateSecret

func (c *Client) UpdateSecret(ctx context.Context, secret types.Secret) (int, string)

UpdateSecret update a secret via the OpenFaaS API by name

type ClientAuth

type ClientAuth interface {
	Set(req *http.Request) error
}

ClientAuth an interface for client authentication. to add authentication to the client implement this interface

type DeployFunctionSpec

type DeployFunctionSpec struct {
	FProcess                string
	FunctionName            string
	Image                   string
	RegistryAuth            string
	Language                string
	Replace                 bool
	EnvVars                 map[string]string
	Network                 string
	Constraints             []string
	Update                  bool
	Secrets                 []string
	Labels                  map[string]string
	Annotations             map[string]string
	FunctionResourceRequest FunctionResourceRequest
	ReadOnlyRootFilesystem  bool
	TLSInsecure             bool
	Token                   string
	Namespace               string
}

DeployFunctionSpec defines the spec used when deploying a function

type FunctionResourceRequest

type FunctionResourceRequest struct {
	Limits   *stack.FunctionResources
	Requests *stack.FunctionResources
}

FunctionResourceRequest defines a request to set function resources

Jump to

Keyboard shortcuts

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