proxy

package
v0.0.0-...-a9a7757 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: MIT Imports: 24 Imported by: 19

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FunctionStoreList

func FunctionStoreList(store string) ([]v2.StoreFunction, 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.

Types

type BasicAuth

type BasicAuth struct {
	// contains filtered or unexported fields
}

BasicAuth basic authentication type

func (*BasicAuth) Set

func (auth *BasicAuth) Set(req *http.Request) error

type BearerToken

type BearerToken struct {
	// contains filtered or unexported fields
}

BearerToken bearer token

func (*BearerToken) Set

func (c *BearerToken) Set(req *http.Request) error

type CLIAuth

type CLIAuth struct {
	Username string
	Password string
	Token    string
}

CLIAuth auth struct for the CLI

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, error)

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) (types.GatewayInfo, 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) ScaleFunction

func (c *Client) ScaleFunction(ctx context.Context, functionName, namespace string, replicas uint64) error

ScaleFunction scale a function

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

func NewCLIAuth

func NewCLIAuth(token string, gateway string) (ClientAuth, error)

NewCLIAuth returns a new CLI Auth

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

type StoreResult

type StoreResult struct {
	Version   string             `json:"version"`
	Functions []v2.StoreFunction `json:"functions"`
}

Jump to

Keyboard shortcuts

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